MCPcopy Create free account
hub / github.com/Snapchat/Valdi / call

Method call

third-party/jscore/include/JavaScriptCore/JSCallbackObjectFunctions.h:507–537  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

505
506template <class Parent>
507EncodedJSValue JSCallbackObject<Parent>::call(ExecState* exec)
508{
509 VM& vm = exec->vm();
510 auto scope = DECLARE_THROW_SCOPE(vm);
511
512 JSContextRef execRef = toRef(exec);
513 JSObjectRef functionRef = toRef(exec->jsCallee());
514 JSObjectRef thisObjRef = toRef(jsCast<JSObject*>(exec->thisValue().toThis(exec, NotStrictMode)));
515
516 for (JSClassRef jsClass = jsCast<JSCallbackObject<Parent>*>(toJS(functionRef))->classRef(); jsClass; jsClass = jsClass->parentClass) {
517 if (JSObjectCallAsFunctionCallback callAsFunction = jsClass->callAsFunction) {
518 size_t argumentCount = exec->argumentCount();
519 Vector<JSValueRef, 16> arguments;
520 arguments.reserveInitialCapacity(argumentCount);
521 for (size_t i = 0; i < argumentCount; ++i)
522 arguments.uncheckedAppend(toRef(exec, exec->uncheckedArgument(i)));
523 JSValueRef exception = 0;
524 JSValue result;
525 {
526 JSLock::DropAllLocks dropAllLocks(exec);
527 result = toJS(exec, callAsFunction(execRef, functionRef, thisObjRef, argumentCount, arguments.data(), &exception));
528 }
529 if (exception)
530 throwException(exec, scope, toJS(exec, exception));
531 return JSValue::encode(result);
532 }
533 }
534
535 RELEASE_ASSERT_NOT_REACHED(); // getCallData should prevent us from reaching here
536 return JSValue::encode(JSValue());
537}
538
539template <class Parent>
540void JSCallbackObject<Parent>::getOwnNonIndexPropertyNames(JSObject* object, ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)

Callers

nothing calls this directly

Calls 7

toRefFunction · 0.85
toJSFunction · 0.85
callAsFunctionFunction · 0.85
encodeFunction · 0.85
JSValueClass · 0.70
classRefMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected