Skip to content

Commit fee487d

Browse files
blagoevpetekanev
authored andcommitted
optimize the default path (no profiler enabled)
1 parent 749de8e commit fee487d

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

runtime/src/main/jni/MetadataNode.cpp

+13-13
Original file line numberDiff line numberDiff line change
@@ -533,13 +533,20 @@ void MetadataNode::SetInstanceMembersFromStaticMetadata(Isolate *isolate, Local<
533533

534534
auto funcData = External::New(isolate, callbackData);
535535
auto funcTemplate = FunctionTemplate::New(isolate, MethodCallback, funcData);
536-
auto func = funcTemplate->GetFunction();
537-
auto funcName = ArgConverter::ConvertToV8String(isolate, entry.name);
536+
auto funcName = ArgConverter::ConvertToV8String(isolate, entry.name);
538537

539-
Local<Function> wrappedFunc = Wrap(isolate, func, entry.name, origin, false /* isCtorFunc */);
540-
//prototypeTemplate->Set(funcName, Wrap(isolate, func, entry.name, origin, false /* isCtorFunc */));
538+
if (s_profilerEnabled)
539+
{
540+
auto func = funcTemplate->GetFunction();
541+
Local<Function> wrappedFunc = Wrap(isolate, func, entry.name, origin, false /* isCtorFunc */);
542+
prototypeTemplate->SetAccessor(funcName, WrappedFunctionGetterCallback, 0, wrappedFunc);
543+
}
544+
else
545+
{
546+
prototypeTemplate->Set(funcName, funcTemplate);
547+
}
541548

542-
prototypeTemplate->SetAccessor(funcName, WrappedFunctionGetterCallback, 0, wrappedFunc);
549+
//prototypeTemplate->Set(funcName, Wrap(isolate, func, entry.name, origin, false /* isCtorFunc */));
543550

544551
lastMethodName = entry.name;
545552
}
@@ -1825,17 +1832,10 @@ Local<Function> MetadataNode::Wrap(Isolate* isolate, const Local<Function>& func
18251832
if (!result.IsEmpty())
18261833
{
18271834
ret = result.As<Function>();
1828-
<<<<<<< d0f2ea1b050ce07b3bb9af9956d8400bc13383ea
1829-
ret->Set(ArgConverter::ConvertToV8String(isolate, "__func"), f);
1835+
ret->Set(ArgConverter::ConvertToV8String(isolate, "__func"), function);
18301836

18311837
auto prototypePropName = V8StringConstants::GetPrototype(isolate);
1832-
ret->Set(prototypePropName, f->Get(prototypePropName));
1833-
=======
1834-
ret->Set(ConvertToV8String("__func"), function);
1835-
1836-
auto prototypePropName = ConvertToV8String("prototype");
18371838
ret->Set(prototypePropName, function->Get(prototypePropName));
1838-
>>>>>>> return the wrapped function when property func name is get accessed
18391839
}
18401840
else
18411841
{

0 commit comments

Comments
 (0)