Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(144)

Unified Diff: src/execution.cc

Issue 1407313004: Adds the possibility of setting a Code object as the callback of a FunctionTemplate. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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());

Powered by Google App Engine
This is Rietveld 408576698