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

Unified Diff: src/api.cc

Issue 1316933002: [es6] Initial steps towards a correct implementation of IsCallable. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 4 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/api-natives.cc » ('j') | src/objects-debug.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 c73860f70688608df90cdea913ebe7d14513da69..c24b627f8332ae410586d9b6ce3a3baff8b8c710 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -4263,11 +4263,9 @@ MaybeLocal<Value> Object::CallAsFunction(Local<Context> context,
if (self->IsJSFunction()) {
fun = i::Handle<i::JSFunction>::cast(self);
} else {
- i::Handle<i::Object> delegate;
- has_pending_exception = !i::Execution::TryGetFunctionDelegate(isolate, self)
- .ToHandle(&delegate);
+ has_pending_exception =
+ !i::Execution::GetFunctionDelegate(isolate, self).ToHandle(&fun);
RETURN_ON_FAILED_EXECUTION(Value);
- fun = i::Handle<i::JSFunction>::cast(delegate);
recv_obj = self;
}
Local<Value> result;
@@ -4305,21 +4303,15 @@ MaybeLocal<Value> Object::CallAsConstructor(Local<Context> context, int argc,
RETURN_ON_FAILED_EXECUTION(Value);
RETURN_ESCAPED(result);
}
- i::Handle<i::Object> delegate;
- has_pending_exception = !i::Execution::TryGetConstructorDelegate(
- isolate, self).ToHandle(&delegate);
+ i::Handle<i::JSFunction> fun;
+ has_pending_exception =
+ !i::Execution::GetConstructorDelegate(isolate, self).ToHandle(&fun);
RETURN_ON_FAILED_EXECUTION(Value);
- if (!delegate->IsUndefined()) {
- auto fun = i::Handle<i::JSFunction>::cast(delegate);
- Local<Value> result;
- has_pending_exception =
- !ToLocal<Value>(i::Execution::Call(isolate, fun, self, argc, args),
- &result);
- RETURN_ON_FAILED_EXECUTION(Value);
- DCHECK(!delegate->IsUndefined());
- RETURN_ESCAPED(result);
- }
- return MaybeLocal<Value>();
+ Local<Value> result;
+ has_pending_exception = !ToLocal<Value>(
+ i::Execution::Call(isolate, fun, self, argc, args), &result);
+ RETURN_ON_FAILED_EXECUTION(Value);
+ RETURN_ESCAPED(result);
}
« no previous file with comments | « no previous file | src/api-natives.cc » ('j') | src/objects-debug.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698