Index: src/execution.cc |
diff --git a/src/execution.cc b/src/execution.cc |
index ecf2d22f698f31f1893991a70c412479b5b70121..4cb612863a2e0d4b38594683601987aeb147721c 100644 |
--- a/src/execution.cc |
+++ b/src/execution.cc |
@@ -136,9 +136,18 @@ MaybeHandle<Object> Execution::Call(Isolate* isolate, Handle<Object> callable, |
handle(Handle<JSGlobalObject>::cast(receiver)->global_proxy(), isolate); |
} |
+ bool is_callback = false; |
Benedikt Meurer
2015/11/12 04:31:21
Please add a TODO here, that this code will need c
epertoso
2015/11/13 01:39:28
I refactored the code a bit.
I'm not sure I under
|
+ if (callable->IsJSFunction()) { |
+ Handle<JSFunction> function = Handle<JSFunction>::cast(callable); |
+ if (function->shared()->IsApiFunction()) { |
+ Object* call_code = function->shared()->get_api_func_data()->call_code(); |
+ is_callback = call_code->IsCallHandlerInfo() && |
+ !CallHandlerInfo::cast(call_code)->callback()->IsCode(); |
+ } |
+ } |
+ |
// api callbacks can be called directly. |
- if (callable->IsJSFunction() && |
- Handle<JSFunction>::cast(callable)->shared()->IsApiFunction()) { |
+ if (is_callback) { |
Handle<JSFunction> function = Handle<JSFunction>::cast(callable); |
SaveContext save(isolate); |
isolate->set_context(function->context()); |