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

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: Rebase again. 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/api-natives.cc » ('j') | no next file with comments »
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 2cb41a09215ebfe985786c06e2fc35442aa72dff..e42c6930da113b2a0629559291bef1ac2d54020d 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -4264,11 +4264,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;
@@ -4306,21 +4304,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') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698