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

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: Update. 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
« no previous file with comments | « src/builtins.h ('k') | src/ic/x64/handler-compiler-x64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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());
« no previous file with comments | « src/builtins.h ('k') | src/ic/x64/handler-compiler-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698