| 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 828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 839 __ sub(scratch1, Immediate(1)); | 839 __ sub(scratch1, Immediate(1)); |
| 840 __ bind(&loop_check); | 840 __ bind(&loop_check); |
| 841 __ cmp(scratch1, Immediate(0)); | 841 __ cmp(scratch1, Immediate(0)); |
| 842 __ j(greater, &loop_header, Label::kNear); | 842 __ j(greater, &loop_header, Label::kNear); |
| 843 } | 843 } |
| 844 | 844 |
| 845 } // end anonymous namespace | 845 } // end anonymous namespace |
| 846 | 846 |
| 847 // static | 847 // static |
| 848 void Builtins::Generate_InterpreterPushArgsAndConstructImpl( | 848 void Builtins::Generate_InterpreterPushArgsAndConstructImpl( |
| 849 MacroAssembler* masm, CallableType construct_type) { | 849 MacroAssembler* masm, PushArgsConstructMode mode) { |
| 850 // ----------- S t a t e ------------- | 850 // ----------- S t a t e ------------- |
| 851 // -- eax : the number of arguments (not including the receiver) | 851 // -- eax : the number of arguments (not including the receiver) |
| 852 // -- edx : the new target | 852 // -- edx : the new target |
| 853 // -- edi : the constructor | 853 // -- edi : the constructor |
| 854 // -- ebx : allocation site feedback (if available or undefined) | 854 // -- ebx : allocation site feedback (if available or undefined) |
| 855 // -- ecx : the address of the first argument to be pushed. Subsequent | 855 // -- ecx : the address of the first argument to be pushed. Subsequent |
| 856 // arguments should be consecutive above this, in the same order as | 856 // arguments should be consecutive above this, in the same order as |
| 857 // they are to be pushed onto the stack. | 857 // they are to be pushed onto the stack. |
| 858 // ----------------------------------- | 858 // ----------------------------------- |
| 859 Label stack_overflow; | 859 Label stack_overflow; |
| 860 // We need two scratch registers. Push edi and edx onto stack. | 860 // We need two scratch registers. Push edi and edx onto stack. |
| 861 __ Push(edi); | 861 __ Push(edi); |
| 862 __ Push(edx); | 862 __ Push(edx); |
| 863 | 863 |
| 864 // Push arguments and move return address to the top of stack. | 864 // Push arguments and move return address to the top of stack. |
| 865 // The eax register is readonly. The ecx register will be modified. The edx | 865 // The eax register is readonly. The ecx register will be modified. The edx |
| 866 // and edi registers will be modified but restored to their original values. | 866 // and edi registers will be modified but restored to their original values. |
| 867 Generate_InterpreterPushArgsAndReturnAddress(masm, eax, ecx, edx, edi, false, | 867 Generate_InterpreterPushArgsAndReturnAddress(masm, eax, ecx, edx, edi, false, |
| 868 2, &stack_overflow); | 868 2, &stack_overflow); |
| 869 | 869 |
| 870 // Restore edi and edx | 870 // Restore edi and edx |
| 871 __ Pop(edx); | 871 __ Pop(edx); |
| 872 __ Pop(edi); | 872 __ Pop(edi); |
| 873 | 873 |
| 874 __ AssertUndefinedOrAllocationSite(ebx); | 874 __ AssertUndefinedOrAllocationSite(ebx); |
| 875 if (construct_type == CallableType::kJSFunction) { | 875 if (mode == PushArgsConstructMode::kJSFunction) { |
| 876 // Tail call to the function-specific construct stub (still in the caller | 876 // Tail call to the function-specific construct stub (still in the caller |
| 877 // context at this point). | 877 // context at this point). |
| 878 __ AssertFunction(edi); | 878 __ AssertFunction(edi); |
| 879 | 879 |
| 880 __ mov(ecx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); | 880 __ mov(ecx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); |
| 881 __ mov(ecx, FieldOperand(ecx, SharedFunctionInfo::kConstructStubOffset)); | 881 __ mov(ecx, FieldOperand(ecx, SharedFunctionInfo::kConstructStubOffset)); |
| 882 __ lea(ecx, FieldOperand(ecx, Code::kHeaderSize)); | 882 __ lea(ecx, FieldOperand(ecx, Code::kHeaderSize)); |
| 883 __ jmp(ecx); | 883 __ jmp(ecx); |
| 884 } else if (mode == PushArgsConstructMode::kWithFinalSpread) { |
| 885 // Call the constructor with unmodified eax, edi, edx values. |
| 886 __ Jump(masm->isolate()->builtins()->ConstructWithSpread(), |
| 887 RelocInfo::CODE_TARGET); |
| 884 } else { | 888 } else { |
| 885 DCHECK_EQ(construct_type, CallableType::kAny); | 889 DCHECK_EQ(PushArgsConstructMode::kOther, mode); |
| 886 | |
| 887 // Call the constructor with unmodified eax, edi, edx values. | 890 // Call the constructor with unmodified eax, edi, edx values. |
| 888 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); | 891 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); |
| 889 } | 892 } |
| 890 | 893 |
| 891 __ bind(&stack_overflow); | 894 __ bind(&stack_overflow); |
| 892 { | 895 { |
| 893 // Pop the temporary registers, so that return address is on top of stack. | 896 // Pop the temporary registers, so that return address is on top of stack. |
| 894 __ Pop(edx); | 897 __ Pop(edx); |
| 895 __ Pop(edi); | 898 __ Pop(edi); |
| 896 | 899 |
| (...skipping 2240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3137 | 3140 |
| 3138 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) { | 3141 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) { |
| 3139 Generate_OnStackReplacementHelper(masm, true); | 3142 Generate_OnStackReplacementHelper(masm, true); |
| 3140 } | 3143 } |
| 3141 | 3144 |
| 3142 #undef __ | 3145 #undef __ |
| 3143 } // namespace internal | 3146 } // namespace internal |
| 3144 } // namespace v8 | 3147 } // namespace v8 |
| 3145 | 3148 |
| 3146 #endif // V8_TARGET_ARCH_X87 | 3149 #endif // V8_TARGET_ARCH_X87 |
| OLD | NEW |