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

Unified Diff: src/x64/builtins-x64.cc

Issue 1575973006: [builtins] Sanitize receiver patching for API functions. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: REBASE. MIPS fixes. 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/mips64/builtins-mips64.cc ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/x64/builtins-x64.cc
diff --git a/src/x64/builtins-x64.cc b/src/x64/builtins-x64.cc
index 6d8e9bcc0f63cc843e92c40df33cae85549a2381..b496fc92d08d5e334d35c0473dbbf411fe7d7f31 100644
--- a/src/x64/builtins-x64.cc
+++ b/src/x64/builtins-x64.cc
@@ -2332,10 +2332,6 @@ static void CompatibleReceiverCheck(MacroAssembler* masm, Register receiver,
Register map = scratch1;
Register constructor = scratch2;
- // If the receiver is not an object, jump to receiver_check_failed.
- __ CmpObjectType(receiver, FIRST_JS_OBJECT_TYPE, kScratchRegister);
- __ j(below, receiver_check_failed);
-
// If there is no signature, return the holder.
__ movp(signature, FieldOperand(function_template_info,
FunctionTemplateInfo::kSignatureOffset));
@@ -2408,13 +2404,6 @@ void Builtins::Generate_HandleFastApiCall(MacroAssembler* masm) {
// -----------------------------------
StackArgumentsAccessor args(rsp, rax);
- __ movp(rcx, args.GetReceiverOperand());
-
- // Update the receiver if this is a contextual call.
- Label set_global_proxy, valid_receiver;
- __ CompareRoot(rcx, Heap::kUndefinedValueRootIndex);
- __ j(equal, &set_global_proxy);
- __ bind(&valid_receiver);
// Load the FunctionTemplateInfo.
__ movp(rbx, FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset));
@@ -2422,6 +2411,7 @@ void Builtins::Generate_HandleFastApiCall(MacroAssembler* masm) {
// Do the compatible receiver check.
Label receiver_check_failed;
+ __ movp(rcx, args.GetReceiverOperand());
CompatibleReceiverCheck(masm, rcx, rbx, rdx, r8, r9, &receiver_check_failed);
// Get the callback offset from the FunctionTemplateInfo, and jump to the
@@ -2431,12 +2421,6 @@ void Builtins::Generate_HandleFastApiCall(MacroAssembler* masm) {
__ addp(rdx, Immediate(Code::kHeaderSize - kHeapObjectTag));
__ jmp(rdx);
- __ bind(&set_global_proxy);
- __ movp(rcx, NativeContextOperand());
- __ movp(rcx, ContextOperand(rcx, Context::GLOBAL_PROXY_INDEX));
- __ movp(args.GetReceiverOperand(), rcx);
- __ jmp(&valid_receiver, Label::kNear);
-
// Compatible receiver check failed: pop return address, arguments and
// receiver and throw an Illegal Invocation exception.
__ bind(&receiver_check_failed);
« no previous file with comments | « src/mips64/builtins-mips64.cc ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698