+ arguments[i] = toRef(exec, exec->argument(i));
+
+ JSValueRef exception = 0;
+ JSValueRef result;
+ {
+ APICallbackShim callbackShim(exec);
+ result = jsCast<JSCallbackFunction*>(toJS(functionRef))->m_callback(execRef, functionRef, thisObjRef, argumentCount, arguments.data(), &exception);
+ }
+ if (exception)
+ throwError(exec, toJS(exec, exception));
+
+ // result must be a valid JSValue.
+ if (!result)
+ return JSValue::encode(jsUndefined());