| 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 680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 691 // Drop receiver + arguments and return. | 691 // Drop receiver + arguments and return. |
| 692 __ mov(ebx, FieldOperand(kInterpreterBytecodeArrayRegister, | 692 __ mov(ebx, FieldOperand(kInterpreterBytecodeArrayRegister, |
| 693 BytecodeArray::kParameterSizeOffset)); | 693 BytecodeArray::kParameterSizeOffset)); |
| 694 __ pop(ecx); | 694 __ pop(ecx); |
| 695 __ add(esp, ebx); | 695 __ add(esp, ebx); |
| 696 __ push(ecx); | 696 __ push(ecx); |
| 697 __ ret(0); | 697 __ ret(0); |
| 698 } | 698 } |
| 699 | 699 |
| 700 | 700 |
| 701 // static |
| 702 void Builtins::Generate_InterpreterPushArgsAndCall(MacroAssembler* masm) { |
| 703 // ----------- S t a t e ------------- |
| 704 // -- eax : the number of arguments (not including the receiver) |
| 705 // -- ebx : the address of the first argument to be pushed. Subsequent |
| 706 // arguments should be consecutive above this, in the same order as |
| 707 // they are to be pushed onto the stack. |
| 708 // -- edi : the target to call (can be any Object). |
| 709 |
| 710 // Pop return address to allow tail-call after pushing arguments. |
| 711 __ Pop(edx); |
| 712 |
| 713 // Find the address of the last argument. |
| 714 __ mov(ecx, eax); |
| 715 __ add(ecx, Immediate(1)); // Add one for receiver. |
| 716 __ shl(ecx, kPointerSizeLog2); |
| 717 __ neg(ecx); |
| 718 __ add(ecx, ebx); |
| 719 |
| 720 // Push the arguments. |
| 721 Label loop_header, loop_check; |
| 722 __ jmp(&loop_check); |
| 723 __ bind(&loop_header); |
| 724 __ Push(Operand(ebx, 0)); |
| 725 __ sub(ebx, Immediate(kPointerSize)); |
| 726 __ bind(&loop_check); |
| 727 __ cmp(ebx, ecx); |
| 728 __ j(greater, &loop_header, Label::kNear); |
| 729 |
| 730 // Call the target. |
| 731 __ Push(edx); // Re-push return address. |
| 732 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); |
| 733 } |
| 734 |
| 735 |
| 701 void Builtins::Generate_CompileLazy(MacroAssembler* masm) { | 736 void Builtins::Generate_CompileLazy(MacroAssembler* masm) { |
| 702 CallRuntimePassFunction(masm, Runtime::kCompileLazy); | 737 CallRuntimePassFunction(masm, Runtime::kCompileLazy); |
| 703 GenerateTailCallToReturnedCode(masm); | 738 GenerateTailCallToReturnedCode(masm); |
| 704 } | 739 } |
| 705 | 740 |
| 706 | 741 |
| 707 | 742 |
| 708 static void CallCompileOptimized(MacroAssembler* masm, bool concurrent) { | 743 static void CallCompileOptimized(MacroAssembler* masm, bool concurrent) { |
| 709 FrameScope scope(masm, StackFrame::INTERNAL); | 744 FrameScope scope(masm, StackFrame::INTERNAL); |
| 710 // Push a copy of the function. | 745 // Push a copy of the function. |
| (...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1609 // method. | 1644 // method. |
| 1610 __ bind(&non_constructor); | 1645 __ bind(&non_constructor); |
| 1611 { | 1646 { |
| 1612 FrameScope scope(masm, StackFrame::INTERNAL); | 1647 FrameScope scope(masm, StackFrame::INTERNAL); |
| 1613 __ Push(edi); | 1648 __ Push(edi); |
| 1614 __ CallRuntime(Runtime::kThrowCalledNonCallable, 1); | 1649 __ CallRuntime(Runtime::kThrowCalledNonCallable, 1); |
| 1615 } | 1650 } |
| 1616 } | 1651 } |
| 1617 | 1652 |
| 1618 | 1653 |
| 1619 // static | |
| 1620 void Builtins::Generate_PushArgsAndCall(MacroAssembler* masm) { | |
| 1621 // ----------- S t a t e ------------- | |
| 1622 // -- eax : the number of arguments (not including the receiver) | |
| 1623 // -- ebx : the address of the first argument to be pushed. Subsequent | |
| 1624 // arguments should be consecutive above this, in the same order as | |
| 1625 // they are to be pushed onto the stack. | |
| 1626 // -- edi : the target to call (can be any Object). | |
| 1627 | |
| 1628 // Pop return address to allow tail-call after pushing arguments. | |
| 1629 __ Pop(edx); | |
| 1630 | |
| 1631 // Find the address of the last argument. | |
| 1632 __ mov(ecx, eax); | |
| 1633 __ add(ecx, Immediate(1)); // Add one for receiver. | |
| 1634 __ shl(ecx, kPointerSizeLog2); | |
| 1635 __ neg(ecx); | |
| 1636 __ add(ecx, ebx); | |
| 1637 | |
| 1638 // Push the arguments. | |
| 1639 Label loop_header, loop_check; | |
| 1640 __ jmp(&loop_check); | |
| 1641 __ bind(&loop_header); | |
| 1642 __ Push(Operand(ebx, 0)); | |
| 1643 __ sub(ebx, Immediate(kPointerSize)); | |
| 1644 __ bind(&loop_check); | |
| 1645 __ cmp(ebx, ecx); | |
| 1646 __ j(greater, &loop_header, Label::kNear); | |
| 1647 | |
| 1648 // Call the target. | |
| 1649 __ Push(edx); // Re-push return address. | |
| 1650 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); | |
| 1651 } | |
| 1652 | |
| 1653 | |
| 1654 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { | 1654 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { |
| 1655 // ----------- S t a t e ------------- | 1655 // ----------- S t a t e ------------- |
| 1656 // -- eax : actual number of arguments | 1656 // -- eax : actual number of arguments |
| 1657 // -- ebx : expected number of arguments | 1657 // -- ebx : expected number of arguments |
| 1658 // -- edi : function (passed through to callee) | 1658 // -- edi : function (passed through to callee) |
| 1659 // ----------------------------------- | 1659 // ----------------------------------- |
| 1660 | 1660 |
| 1661 Label invoke, dont_adapt_arguments; | 1661 Label invoke, dont_adapt_arguments; |
| 1662 __ IncrementCounter(masm->isolate()->counters()->arguments_adaptors(), 1); | 1662 __ IncrementCounter(masm->isolate()->counters()->arguments_adaptors(), 1); |
| 1663 | 1663 |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1832 | 1832 |
| 1833 __ bind(&ok); | 1833 __ bind(&ok); |
| 1834 __ ret(0); | 1834 __ ret(0); |
| 1835 } | 1835 } |
| 1836 | 1836 |
| 1837 #undef __ | 1837 #undef __ |
| 1838 } // namespace internal | 1838 } // namespace internal |
| 1839 } // namespace v8 | 1839 } // namespace v8 |
| 1840 | 1840 |
| 1841 #endif // V8_TARGET_ARCH_X87 | 1841 #endif // V8_TARGET_ARCH_X87 |
| OLD | NEW |