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

Side by Side Diff: src/ia32/builtins-ia32.cc

Issue 1750373002: [Interpreter] Fixes PushArgsAndConstruct builtin to not store any data outside esp. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 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 unified diff | Download patch
« no previous file with comments | « no previous file | test/cctest/cctest.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #if V8_TARGET_ARCH_IA32 5 #if V8_TARGET_ARCH_IA32
6 6
7 #include "src/code-factory.h" 7 #include "src/code-factory.h"
8 #include "src/codegen.h" 8 #include "src/codegen.h"
9 #include "src/deoptimizer.h" 9 #include "src/deoptimizer.h"
10 #include "src/full-codegen/full-codegen.h" 10 #include "src/full-codegen/full-codegen.h"
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) { 595 void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) {
596 // ----------- S t a t e ------------- 596 // ----------- S t a t e -------------
597 // -- eax : the number of arguments (not including the receiver) 597 // -- eax : the number of arguments (not including the receiver)
598 // -- edx : the new target 598 // -- edx : the new target
599 // -- edi : the constructor 599 // -- edi : the constructor
600 // -- ebx : the address of the first argument to be pushed. Subsequent 600 // -- ebx : the address of the first argument to be pushed. Subsequent
601 // arguments should be consecutive above this, in the same order as 601 // arguments should be consecutive above this, in the same order as
602 // they are to be pushed onto the stack. 602 // they are to be pushed onto the stack.
603 // ----------------------------------- 603 // -----------------------------------
604 604
605 // Save number of arguments on the stack below where arguments are going
606 // to be pushed.
607 __ mov(ecx, eax);
608 __ neg(ecx);
609 __ mov(Operand(esp, ecx, times_pointer_size, -kPointerSize), eax);
610 __ mov(eax, ecx);
611
612 // Pop return address to allow tail-call after pushing arguments. 605 // Pop return address to allow tail-call after pushing arguments.
613 __ Pop(ecx); 606 __ Pop(ecx);
614 607
608 // Push edi in the slot meant for receiver. We need an extra register
609 // so store edi temporarily on stack.
610 __ Push(edi);
611
615 // Find the address of the last argument. 612 // Find the address of the last argument.
616 __ shl(eax, kPointerSizeLog2); 613 __ mov(edi, eax);
617 __ add(eax, ebx); 614 __ neg(edi);
615 __ shl(edi, kPointerSizeLog2);
616 __ add(edi, ebx);
618 617
619 // Push padding for receiver. 618 Generate_InterpreterPushArgs(masm, edi);
620 __ Push(Immediate(0));
621 619
622 Generate_InterpreterPushArgs(masm, eax); 620 // Restore the constructor from slot on stack. It was pushed at the slot
623 621 // meant for receiver.
624 // Restore number of arguments from slot on stack. 622 __ mov(edi, Operand(esp, eax, times_pointer_size, 0));
625 __ mov(eax, Operand(esp, -kPointerSize));
626 623
627 // Re-push return address. 624 // Re-push return address.
628 __ Push(ecx); 625 __ Push(ecx);
629 626
630 // Call the constructor with unmodified eax, edi, ebi values. 627 // Call the constructor with unmodified eax, edi, ebi values.
631 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); 628 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET);
632 } 629 }
633 630
634 631
635 static void Generate_EnterBytecodeDispatch(MacroAssembler* masm) { 632 static void Generate_EnterBytecodeDispatch(MacroAssembler* masm) {
(...skipping 2027 matching lines...) Expand 10 before | Expand all | Expand 10 after
2663 2660
2664 __ bind(&ok); 2661 __ bind(&ok);
2665 __ ret(0); 2662 __ ret(0);
2666 } 2663 }
2667 2664
2668 #undef __ 2665 #undef __
2669 } // namespace internal 2666 } // namespace internal
2670 } // namespace v8 2667 } // namespace v8
2671 2668
2672 #endif // V8_TARGET_ARCH_IA32 2669 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « no previous file | test/cctest/cctest.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698