OLD | NEW |
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_X87 | 5 #if V8_TARGET_ARCH_X87 |
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 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
596 void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) { | 596 void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) { |
597 // ----------- S t a t e ------------- | 597 // ----------- S t a t e ------------- |
598 // -- eax : the number of arguments (not including the receiver) | 598 // -- eax : the number of arguments (not including the receiver) |
599 // -- edx : the new target | 599 // -- edx : the new target |
600 // -- edi : the constructor | 600 // -- edi : the constructor |
601 // -- ebx : the address of the first argument to be pushed. Subsequent | 601 // -- ebx : the address of the first argument to be pushed. Subsequent |
602 // arguments should be consecutive above this, in the same order as | 602 // arguments should be consecutive above this, in the same order as |
603 // they are to be pushed onto the stack. | 603 // they are to be pushed onto the stack. |
604 // ----------------------------------- | 604 // ----------------------------------- |
605 | 605 |
606 // Save number of arguments on the stack below where arguments are going | |
607 // to be pushed. | |
608 __ mov(ecx, eax); | |
609 __ neg(ecx); | |
610 __ mov(Operand(esp, ecx, times_pointer_size, -kPointerSize), eax); | |
611 __ mov(eax, ecx); | |
612 | |
613 // Pop return address to allow tail-call after pushing arguments. | 606 // Pop return address to allow tail-call after pushing arguments. |
614 __ Pop(ecx); | 607 __ Pop(ecx); |
615 | 608 |
| 609 // Push edi in the slot meant for receiver. We need an extra register |
| 610 // so store edi temporarily on stack. |
| 611 __ Push(edi); |
| 612 |
616 // Find the address of the last argument. | 613 // Find the address of the last argument. |
617 __ shl(eax, kPointerSizeLog2); | 614 __ mov(edi, eax); |
618 __ add(eax, ebx); | 615 __ neg(edi); |
| 616 __ shl(edi, kPointerSizeLog2); |
| 617 __ add(edi, ebx); |
619 | 618 |
620 // Push padding for receiver. | 619 Generate_InterpreterPushArgs(masm, edi); |
621 __ Push(Immediate(0)); | |
622 | 620 |
623 Generate_InterpreterPushArgs(masm, eax); | 621 // Restore the constructor from slot on stack. It was pushed at the slot |
624 | 622 // meant for receiver. |
625 // Restore number of arguments from slot on stack. | 623 __ mov(edi, Operand(esp, eax, times_pointer_size, 0)); |
626 __ mov(eax, Operand(esp, -kPointerSize)); | |
627 | 624 |
628 // Re-push return address. | 625 // Re-push return address. |
629 __ Push(ecx); | 626 __ Push(ecx); |
630 | 627 |
631 // Call the constructor with unmodified eax, edi, ebi values. | 628 // Call the constructor with unmodified eax, edi, ebi values. |
632 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); | 629 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); |
633 } | 630 } |
634 | 631 |
635 | 632 |
636 static void Generate_EnterBytecodeDispatch(MacroAssembler* masm) { | 633 static void Generate_EnterBytecodeDispatch(MacroAssembler* masm) { |
(...skipping 2052 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2689 | 2686 |
2690 __ bind(&ok); | 2687 __ bind(&ok); |
2691 __ ret(0); | 2688 __ ret(0); |
2692 } | 2689 } |
2693 | 2690 |
2694 #undef __ | 2691 #undef __ |
2695 } // namespace internal | 2692 } // namespace internal |
2696 } // namespace v8 | 2693 } // namespace v8 |
2697 | 2694 |
2698 #endif // V8_TARGET_ARCH_X87 | 2695 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |