Chromium Code Reviews| Index: src/execution.cc |
| diff --git a/src/execution.cc b/src/execution.cc |
| index ecf2d22f698f31f1893991a70c412479b5b70121..dd15342754682151c522fbb2f0807c3e154b27cf 100644 |
| --- a/src/execution.cc |
| +++ b/src/execution.cc |
| @@ -140,29 +140,34 @@ MaybeHandle<Object> Execution::Call(Isolate* isolate, Handle<Object> callable, |
| if (callable->IsJSFunction() && |
| Handle<JSFunction>::cast(callable)->shared()->IsApiFunction()) { |
| Handle<JSFunction> function = Handle<JSFunction>::cast(callable); |
| - SaveContext save(isolate); |
| - isolate->set_context(function->context()); |
| - // Do proper receiver conversion for non-strict mode api functions. |
| - if (!receiver->IsJSReceiver() && |
| - is_sloppy(function->shared()->language_mode())) { |
| - if (receiver->IsUndefined() || receiver->IsNull()) { |
| - receiver = handle(function->global_proxy(), isolate); |
| + Object* call_code = function->shared()->get_api_func_data()->call_code(); |
| + if (call_code->IsCallHandlerInfo() && |
| + !CallHandlerInfo::cast(call_code)->callback()->IsCode()) { |
|
Toon Verwaest
2015/11/13 09:55:49
Don't we want the ability to stay in C++ if we are
epertoso
2015/11/13 19:06:10
Well, not necessarily. The fast callback, on the c
Benedikt Meurer
2015/11/16 04:43:55
I think there should always be a C++ backup implem
epertoso
2015/11/17 10:32:43
Done. Added a new field to CallHandlerInfo, as dis
|
| + SaveContext save(isolate); |
| + isolate->set_context(function->context()); |
| + // Do proper receiver conversion for non-strict mode api functions. |
| + if (!receiver->IsJSReceiver() && |
| + is_sloppy(function->shared()->language_mode())) { |
| + if (receiver->IsUndefined() || receiver->IsNull()) { |
| + receiver = handle(function->global_proxy(), isolate); |
| + } else { |
| + ASSIGN_RETURN_ON_EXCEPTION(isolate, receiver, |
| + Execution::ToObject(isolate, receiver), |
| + Object); |
| + } |
| + } |
| + DCHECK(function->context()->global_object()->IsJSGlobalObject()); |
| + auto value = Builtins::InvokeApiFunction(function, receiver, argc, argv); |
| + bool has_exception = value.is_null(); |
| + DCHECK(has_exception == isolate->has_pending_exception()); |
| + if (has_exception) { |
| + isolate->ReportPendingMessages(); |
| + return MaybeHandle<Object>(); |
| } else { |
| - ASSIGN_RETURN_ON_EXCEPTION( |
| - isolate, receiver, Execution::ToObject(isolate, receiver), Object); |
| + isolate->clear_pending_message(); |
| } |
| + return value; |
| } |
| - DCHECK(function->context()->global_object()->IsJSGlobalObject()); |
| - auto value = Builtins::InvokeApiFunction(function, receiver, argc, argv); |
| - bool has_exception = value.is_null(); |
| - DCHECK(has_exception == isolate->has_pending_exception()); |
| - if (has_exception) { |
| - isolate->ReportPendingMessages(); |
| - return MaybeHandle<Object>(); |
| - } else { |
| - isolate->clear_pending_message(); |
| - } |
| - return value; |
| } |
| return Invoke(isolate, false, callable, receiver, argc, argv, |
| isolate->factory()->undefined_value()); |