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

Unified Diff: src/api.cc

Issue 1360793002: [builtins] Refactor Invoke to deal with any kind of callable. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 3 months 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 | « no previous file | src/arm/builtins-arm.cc » ('j') | src/arm/builtins-arm.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index 62e50dd449334960cdf42d6f0bfa72a4182d0921..1cb00f271fa7d0e9a4c7f0014606eb74535f8438 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -4244,18 +4244,9 @@ MaybeLocal<Value> Object::CallAsFunction(Local<Context> context,
auto recv_obj = Utils::OpenHandle(*recv);
STATIC_ASSERT(sizeof(v8::Local<v8::Value>) == sizeof(i::Object**));
i::Handle<i::Object>* args = reinterpret_cast<i::Handle<i::Object>*>(argv);
- i::Handle<i::JSFunction> fun;
- if (self->IsJSFunction()) {
- fun = i::Handle<i::JSFunction>::cast(self);
- } else {
- has_pending_exception =
- !i::Execution::GetFunctionDelegate(isolate, self).ToHandle(&fun);
- RETURN_ON_FAILED_EXECUTION(Value);
- recv_obj = self;
- }
Local<Value> result;
has_pending_exception = !ToLocal<Value>(
- i::Execution::Call(isolate, fun, recv_obj, argc, args), &result);
+ i::Execution::Call(isolate, self, recv_obj, argc, args), &result);
RETURN_ON_FAILED_EXECUTION(Value);
RETURN_ESCAPED(result);
}
@@ -4278,21 +4269,9 @@ MaybeLocal<Value> Object::CallAsConstructor(Local<Context> context, int argc,
auto self = Utils::OpenHandle(this);
STATIC_ASSERT(sizeof(v8::Local<v8::Value>) == sizeof(i::Object**));
i::Handle<i::Object>* args = reinterpret_cast<i::Handle<i::Object>*>(argv);
- if (self->IsJSFunction()) {
- auto fun = i::Handle<i::JSFunction>::cast(self);
- Local<Value> result;
- has_pending_exception =
- !ToLocal<Value>(i::Execution::New(fun, argc, args), &result);
- RETURN_ON_FAILED_EXECUTION(Value);
- RETURN_ESCAPED(result);
- }
- i::Handle<i::JSFunction> fun;
- has_pending_exception =
- !i::Execution::GetConstructorDelegate(isolate, self).ToHandle(&fun);
- RETURN_ON_FAILED_EXECUTION(Value);
Local<Value> result;
has_pending_exception = !ToLocal<Value>(
- i::Execution::Call(isolate, fun, self, argc, args), &result);
+ i::Execution::New(isolate, self, self, argc, args), &result);
RETURN_ON_FAILED_EXECUTION(Value);
RETURN_ESCAPED(result);
}
« no previous file with comments | « no previous file | src/arm/builtins-arm.cc » ('j') | src/arm/builtins-arm.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698