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

Unified Diff: src/builtins.cc

Issue 1666673002: Version 4.10.145.1 (cherry-pick) (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@4.10.145
Patch Set: Created 4 years, 11 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 | « src/bootstrapper.cc ('k') | src/contexts.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/builtins.cc
diff --git a/src/builtins.cc b/src/builtins.cc
index dd8306c785112b856b3b17906bc24557d716abe0..6b6c4acd09dfb1b5217bcab016c99724321a3c6f 100644
--- a/src/builtins.cc
+++ b/src/builtins.cc
@@ -3559,33 +3559,22 @@ MUST_USE_RESULT MaybeHandle<Object> HandleApiCallHelper(
Isolate* isolate, BuiltinArguments<BuiltinExtraArguments::kTarget> args) {
HandleScope scope(isolate);
Handle<JSFunction> function = args.target();
- Handle<JSReceiver> receiver;
+ DCHECK(args.receiver()->IsJSReceiver());
// TODO(ishell): turn this back to a DCHECK.
CHECK(function->shared()->IsApiFunction());
Handle<FunctionTemplateInfo> fun_data(
function->shared()->get_api_func_data(), isolate);
if (is_construct) {
- DCHECK(args.receiver()->IsTheHole());
- if (fun_data->instance_template()->IsUndefined()) {
- v8::Local<ObjectTemplate> templ =
- ObjectTemplate::New(reinterpret_cast<v8::Isolate*>(isolate),
- ToApiHandle<v8::FunctionTemplate>(fun_data));
- fun_data->set_instance_template(*Utils::OpenHandle(*templ));
- }
- Handle<ObjectTemplateInfo> instance_template(
- ObjectTemplateInfo::cast(fun_data->instance_template()), isolate);
- ASSIGN_RETURN_ON_EXCEPTION(isolate, receiver,
- ApiNatives::InstantiateObject(instance_template),
- Object);
- args[0] = *receiver;
- DCHECK_EQ(*receiver, *args.receiver());
- } else {
- DCHECK(args.receiver()->IsJSReceiver());
- receiver = args.at<JSReceiver>(0);
+ ASSIGN_RETURN_ON_EXCEPTION(
+ isolate, fun_data,
+ ApiNatives::ConfigureInstance(isolate, fun_data,
+ Handle<JSObject>::cast(args.receiver())),
+ Object);
}
if (!is_construct && !fun_data->accept_any_receiver()) {
+ Handle<JSReceiver> receiver = args.at<JSReceiver>(0);
if (receiver->IsJSObject() && receiver->IsAccessCheckNeeded()) {
Handle<JSObject> js_receiver = Handle<JSObject>::cast(receiver);
if (!isolate->MayAccess(handle(isolate->context()), js_receiver)) {
@@ -3595,7 +3584,7 @@ MUST_USE_RESULT MaybeHandle<Object> HandleApiCallHelper(
}
}
- Object* raw_holder = fun_data->GetCompatibleReceiver(isolate, *receiver);
+ Object* raw_holder = fun_data->GetCompatibleReceiver(isolate, args[0]);
if (raw_holder->IsNull()) {
// This function cannot be called with the given receiver. Abort!
@@ -3639,7 +3628,7 @@ MUST_USE_RESULT MaybeHandle<Object> HandleApiCallHelper(
}
}
- return scope.CloseAndEscape(receiver);
+ return scope.CloseAndEscape(args.receiver());
}
} // namespace
« no previous file with comments | « src/bootstrapper.cc ('k') | src/contexts.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698