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_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 690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
701 // Drop receiver + arguments and return. | 701 // Drop receiver + arguments and return. |
702 __ mov(ebx, FieldOperand(kInterpreterBytecodeArrayRegister, | 702 __ mov(ebx, FieldOperand(kInterpreterBytecodeArrayRegister, |
703 BytecodeArray::kParameterSizeOffset)); | 703 BytecodeArray::kParameterSizeOffset)); |
704 __ pop(ecx); | 704 __ pop(ecx); |
705 __ add(esp, ebx); | 705 __ add(esp, ebx); |
706 __ push(ecx); | 706 __ push(ecx); |
707 __ ret(0); | 707 __ ret(0); |
708 } | 708 } |
709 | 709 |
710 | 710 |
711 // static | |
712 void Builtins::Generate_InterpreterPushArgsAndCall(MacroAssembler* masm) { | |
713 // ----------- S t a t e ------------- | |
714 // -- eax : the number of arguments (not including the receiver) | |
715 // -- ebx : the address of the first argument to be pushed. Subsequent | |
716 // arguments should be consecutive above this, in the same order as | |
717 // they are to be pushed onto the stack. | |
718 // -- edi : the target to call (can be any Object). | |
719 | |
720 // Pop return address to allow tail-call after pushing arguments. | |
721 __ Pop(edx); | |
722 | |
723 // Find the address of the last argument. | |
724 __ mov(ecx, eax); | |
725 __ add(ecx, Immediate(1)); // Add one for receiver. | |
726 __ shl(ecx, kPointerSizeLog2); | |
727 __ neg(ecx); | |
728 __ add(ecx, ebx); | |
729 | |
730 // Push the arguments. | |
731 Label loop_header, loop_check; | |
732 __ jmp(&loop_check); | |
733 __ bind(&loop_header); | |
734 __ Push(Operand(ebx, 0)); | |
735 __ sub(ebx, Immediate(kPointerSize)); | |
736 __ bind(&loop_check); | |
737 __ cmp(ebx, ecx); | |
738 __ j(greater, &loop_header, Label::kNear); | |
739 | |
740 // Call the target. | |
741 __ Push(edx); // Re-push return address. | |
742 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); | |
743 } | |
744 | |
745 | |
746 void Builtins::Generate_CompileLazy(MacroAssembler* masm) { | 711 void Builtins::Generate_CompileLazy(MacroAssembler* masm) { |
747 CallRuntimePassFunction(masm, Runtime::kCompileLazy); | 712 CallRuntimePassFunction(masm, Runtime::kCompileLazy); |
748 GenerateTailCallToReturnedCode(masm); | 713 GenerateTailCallToReturnedCode(masm); |
749 } | 714 } |
750 | 715 |
751 | 716 |
752 | 717 |
753 static void CallCompileOptimized(MacroAssembler* masm, bool concurrent) { | 718 static void CallCompileOptimized(MacroAssembler* masm, bool concurrent) { |
754 FrameScope scope(masm, StackFrame::INTERNAL); | 719 FrameScope scope(masm, StackFrame::INTERNAL); |
755 // Push a copy of the function. | 720 // Push a copy of the function. |
(...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1654 // method. | 1619 // method. |
1655 __ bind(&non_constructor); | 1620 __ bind(&non_constructor); |
1656 { | 1621 { |
1657 FrameScope scope(masm, StackFrame::INTERNAL); | 1622 FrameScope scope(masm, StackFrame::INTERNAL); |
1658 __ Push(edi); | 1623 __ Push(edi); |
1659 __ CallRuntime(Runtime::kThrowCalledNonCallable, 1); | 1624 __ CallRuntime(Runtime::kThrowCalledNonCallable, 1); |
1660 } | 1625 } |
1661 } | 1626 } |
1662 | 1627 |
1663 | 1628 |
| 1629 // static |
| 1630 void Builtins::Generate_PushArgsAndCall(MacroAssembler* masm) { |
| 1631 // ----------- S t a t e ------------- |
| 1632 // -- eax : the number of arguments (not including the receiver) |
| 1633 // -- ebx : the address of the first argument to be pushed. Subsequent |
| 1634 // arguments should be consecutive above this, in the same order as |
| 1635 // they are to be pushed onto the stack. |
| 1636 // -- edi : the target to call (can be any Object). |
| 1637 |
| 1638 // Pop return address to allow tail-call after pushing arguments. |
| 1639 __ Pop(edx); |
| 1640 |
| 1641 // Find the address of the last argument. |
| 1642 __ mov(ecx, eax); |
| 1643 __ add(ecx, Immediate(1)); // Add one for receiver. |
| 1644 __ shl(ecx, kPointerSizeLog2); |
| 1645 __ neg(ecx); |
| 1646 __ add(ecx, ebx); |
| 1647 |
| 1648 // Push the arguments. |
| 1649 Label loop_header, loop_check; |
| 1650 __ jmp(&loop_check); |
| 1651 __ bind(&loop_header); |
| 1652 __ Push(Operand(ebx, 0)); |
| 1653 __ sub(ebx, Immediate(kPointerSize)); |
| 1654 __ bind(&loop_check); |
| 1655 __ cmp(ebx, ecx); |
| 1656 __ j(greater, &loop_header, Label::kNear); |
| 1657 |
| 1658 // Call the target. |
| 1659 __ Push(edx); // Re-push return address. |
| 1660 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); |
| 1661 } |
| 1662 |
| 1663 |
1664 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { | 1664 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { |
1665 // ----------- S t a t e ------------- | 1665 // ----------- S t a t e ------------- |
1666 // -- eax : actual number of arguments | 1666 // -- eax : actual number of arguments |
1667 // -- ebx : expected number of arguments | 1667 // -- ebx : expected number of arguments |
1668 // -- edi : function (passed through to callee) | 1668 // -- edi : function (passed through to callee) |
1669 // ----------------------------------- | 1669 // ----------------------------------- |
1670 | 1670 |
1671 Label invoke, dont_adapt_arguments; | 1671 Label invoke, dont_adapt_arguments; |
1672 __ IncrementCounter(masm->isolate()->counters()->arguments_adaptors(), 1); | 1672 __ IncrementCounter(masm->isolate()->counters()->arguments_adaptors(), 1); |
1673 | 1673 |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1842 | 1842 |
1843 __ bind(&ok); | 1843 __ bind(&ok); |
1844 __ ret(0); | 1844 __ ret(0); |
1845 } | 1845 } |
1846 | 1846 |
1847 #undef __ | 1847 #undef __ |
1848 } // namespace internal | 1848 } // namespace internal |
1849 } // namespace v8 | 1849 } // namespace v8 |
1850 | 1850 |
1851 #endif // V8_TARGET_ARCH_IA32 | 1851 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |