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

Unified Diff: src/ia32/builtins-ia32.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/builtins.cc ('k') | src/mips/builtins-mips.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ia32/builtins-ia32.cc
diff --git a/src/ia32/builtins-ia32.cc b/src/ia32/builtins-ia32.cc
index 3fc42c4e8ef18b4f3faa9e35b2d7d67fe854a70e..0ce058f955a307e13d7a0addfdace423990b65d5 100644
--- a/src/ia32/builtins-ia32.cc
+++ b/src/ia32/builtins-ia32.cc
@@ -2247,10 +2247,6 @@ static void CompatibleReceiverCheck(MacroAssembler* masm, Register receiver,
Register function_template_info,
Register scratch0, Register scratch1,
Label* receiver_check_failed) {
- // If receiver is not an object, jump to receiver_check_failed.
- __ CmpObjectType(receiver, FIRST_JS_OBJECT_TYPE, scratch0);
- __ j(below, receiver_check_failed);
-
// If there is no signature, return the holder.
__ CompareRoot(FieldOperand(function_template_info,
FunctionTemplateInfo::kSignatureOffset),
@@ -2324,22 +2320,13 @@ void Builtins::Generate_HandleFastApiCall(MacroAssembler* masm) {
// -- esp[(eax + 1) * 4] : receiver
// -----------------------------------
- // Load the receiver.
- Operand receiver_operand(esp, eax, times_pointer_size, kPCOnStackSize);
- __ mov(ecx, receiver_operand);
-
- // Update the receiver if this is a contextual call.
- Label set_global_proxy, valid_receiver;
- __ CompareRoot(ecx, Heap::kUndefinedValueRootIndex);
- __ j(equal, &set_global_proxy);
- __ bind(&valid_receiver);
-
// Load the FunctionTemplateInfo.
__ mov(ebx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset));
__ mov(ebx, FieldOperand(ebx, SharedFunctionInfo::kFunctionDataOffset));
// Do the compatible receiver check.
Label receiver_check_failed;
+ __ mov(ecx, Operand(esp, eax, times_pointer_size, kPCOnStackSize));
__ Push(eax);
CompatibleReceiverCheck(masm, ecx, ebx, edx, eax, &receiver_check_failed);
__ Pop(eax);
@@ -2350,12 +2337,6 @@ void Builtins::Generate_HandleFastApiCall(MacroAssembler* masm) {
__ add(edx, Immediate(Code::kHeaderSize - kHeapObjectTag));
__ jmp(edx);
- __ bind(&set_global_proxy);
- __ mov(ecx, NativeContextOperand());
- __ mov(ecx, ContextOperand(ecx, Context::GLOBAL_PROXY_INDEX));
- __ mov(receiver_operand, ecx);
- __ 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/builtins.cc ('k') | src/mips/builtins-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698