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_X64 | 5 #if V8_TARGET_ARCH_X64 |
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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 | 130 |
131 // Preserve the incoming parameters on the stack. | 131 // Preserve the incoming parameters on the stack. |
132 __ Integer32ToSmi(rcx, rax); | 132 __ Integer32ToSmi(rcx, rax); |
133 __ Push(rsi); | 133 __ Push(rsi); |
134 __ Push(rcx); | 134 __ Push(rcx); |
135 | 135 |
136 if (create_implicit_receiver) { | 136 if (create_implicit_receiver) { |
137 // Allocate the new receiver object. | 137 // Allocate the new receiver object. |
138 __ Push(rdi); | 138 __ Push(rdi); |
139 __ Push(rdx); | 139 __ Push(rdx); |
140 FastNewObjectStub stub(masm->isolate()); | 140 __ Call(masm->isolate()->builtins()->FastNewObject(), |
141 __ CallStub(&stub); | 141 RelocInfo::CODE_TARGET); |
142 __ movp(rbx, rax); | 142 __ movp(rbx, rax); |
143 __ Pop(rdx); | 143 __ Pop(rdx); |
144 __ Pop(rdi); | 144 __ Pop(rdi); |
145 | 145 |
146 // ----------- S t a t e ------------- | 146 // ----------- S t a t e ------------- |
147 // -- rdi: constructor function | 147 // -- rdi: constructor function |
148 // -- rbx: newly allocated object | 148 // -- rbx: newly allocated object |
149 // -- rdx: new target | 149 // -- rdx: new target |
150 // ----------------------------------- | 150 // ----------------------------------- |
151 | 151 |
(...skipping 1719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1871 // 5. Allocate a JSValue wrapper for the number. | 1871 // 5. Allocate a JSValue wrapper for the number. |
1872 __ AllocateJSValue(rax, rdi, rbx, rcx, &new_object); | 1872 __ AllocateJSValue(rax, rdi, rbx, rcx, &new_object); |
1873 __ jmp(&drop_frame_and_ret, Label::kNear); | 1873 __ jmp(&drop_frame_and_ret, Label::kNear); |
1874 | 1874 |
1875 // 6. Fallback to the runtime to create new object. | 1875 // 6. Fallback to the runtime to create new object. |
1876 __ bind(&new_object); | 1876 __ bind(&new_object); |
1877 { | 1877 { |
1878 FrameScope scope(masm, StackFrame::MANUAL); | 1878 FrameScope scope(masm, StackFrame::MANUAL); |
1879 __ EnterBuiltinFrame(rsi, rdi, r8); | 1879 __ EnterBuiltinFrame(rsi, rdi, r8); |
1880 __ Push(rbx); // the first argument | 1880 __ Push(rbx); // the first argument |
1881 FastNewObjectStub stub(masm->isolate()); | 1881 __ Call(masm->isolate()->builtins()->FastNewObject(), |
1882 __ CallStub(&stub); | 1882 RelocInfo::CODE_TARGET); |
1883 __ Pop(FieldOperand(rax, JSValue::kValueOffset)); | 1883 __ Pop(FieldOperand(rax, JSValue::kValueOffset)); |
1884 __ LeaveBuiltinFrame(rsi, rdi, r8); | 1884 __ LeaveBuiltinFrame(rsi, rdi, r8); |
1885 } | 1885 } |
1886 | 1886 |
1887 __ bind(&drop_frame_and_ret); | 1887 __ bind(&drop_frame_and_ret); |
1888 { | 1888 { |
1889 // Drop all arguments including the receiver. | 1889 // Drop all arguments including the receiver. |
1890 __ PopReturnAddressTo(rcx); | 1890 __ PopReturnAddressTo(rcx); |
1891 __ SmiToInteger32(r8, r8); | 1891 __ SmiToInteger32(r8, r8); |
1892 __ leap(rsp, Operand(rsp, r8, times_pointer_size, kPointerSize)); | 1892 __ leap(rsp, Operand(rsp, r8, times_pointer_size, kPointerSize)); |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2026 // 5. Allocate a JSValue wrapper for the string. | 2026 // 5. Allocate a JSValue wrapper for the string. |
2027 __ AllocateJSValue(rax, rdi, rbx, rcx, &new_object); | 2027 __ AllocateJSValue(rax, rdi, rbx, rcx, &new_object); |
2028 __ jmp(&drop_frame_and_ret, Label::kNear); | 2028 __ jmp(&drop_frame_and_ret, Label::kNear); |
2029 | 2029 |
2030 // 6. Fallback to the runtime to create new object. | 2030 // 6. Fallback to the runtime to create new object. |
2031 __ bind(&new_object); | 2031 __ bind(&new_object); |
2032 { | 2032 { |
2033 FrameScope scope(masm, StackFrame::MANUAL); | 2033 FrameScope scope(masm, StackFrame::MANUAL); |
2034 __ EnterBuiltinFrame(rsi, rdi, r8); | 2034 __ EnterBuiltinFrame(rsi, rdi, r8); |
2035 __ Push(rbx); // the first argument | 2035 __ Push(rbx); // the first argument |
2036 FastNewObjectStub stub(masm->isolate()); | 2036 __ Call(masm->isolate()->builtins()->FastNewObject(), |
2037 __ CallStub(&stub); | 2037 RelocInfo::CODE_TARGET); |
2038 __ Pop(FieldOperand(rax, JSValue::kValueOffset)); | 2038 __ Pop(FieldOperand(rax, JSValue::kValueOffset)); |
2039 __ LeaveBuiltinFrame(rsi, rdi, r8); | 2039 __ LeaveBuiltinFrame(rsi, rdi, r8); |
2040 } | 2040 } |
2041 | 2041 |
2042 __ bind(&drop_frame_and_ret); | 2042 __ bind(&drop_frame_and_ret); |
2043 { | 2043 { |
2044 // Drop all arguments including the receiver. | 2044 // Drop all arguments including the receiver. |
2045 __ PopReturnAddressTo(rcx); | 2045 __ PopReturnAddressTo(rcx); |
2046 __ SmiToInteger32(r8, r8); | 2046 __ SmiToInteger32(r8, r8); |
2047 __ leap(rsp, Operand(rsp, r8, times_pointer_size, kPointerSize)); | 2047 __ leap(rsp, Operand(rsp, r8, times_pointer_size, kPointerSize)); |
(...skipping 1000 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3048 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) { | 3048 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) { |
3049 Generate_OnStackReplacementHelper(masm, true); | 3049 Generate_OnStackReplacementHelper(masm, true); |
3050 } | 3050 } |
3051 | 3051 |
3052 #undef __ | 3052 #undef __ |
3053 | 3053 |
3054 } // namespace internal | 3054 } // namespace internal |
3055 } // namespace v8 | 3055 } // namespace v8 |
3056 | 3056 |
3057 #endif // V8_TARGET_ARCH_X64 | 3057 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |