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 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_X64 | 7 #if V8_TARGET_ARCH_X64 |
8 | 8 |
9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
10 #include "src/deoptimizer.h" | 10 #include "src/deoptimizer.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 // ----------------------------------- | 34 // ----------------------------------- |
35 | 35 |
36 // Insert extra arguments. | 36 // Insert extra arguments. |
37 int num_extra_args = 0; | 37 int num_extra_args = 0; |
38 if (extra_args == NEEDS_CALLED_FUNCTION) { | 38 if (extra_args == NEEDS_CALLED_FUNCTION) { |
39 num_extra_args = 1; | 39 num_extra_args = 1; |
40 __ PopReturnAddressTo(kScratchRegister); | 40 __ PopReturnAddressTo(kScratchRegister); |
41 __ Push(rdi); | 41 __ Push(rdi); |
42 __ PushReturnAddressFrom(kScratchRegister); | 42 __ PushReturnAddressFrom(kScratchRegister); |
43 } else { | 43 } else { |
44 ASSERT(extra_args == NO_EXTRA_ARGUMENTS); | 44 DCHECK(extra_args == NO_EXTRA_ARGUMENTS); |
45 } | 45 } |
46 | 46 |
47 // JumpToExternalReference expects rax to contain the number of arguments | 47 // JumpToExternalReference expects rax to contain the number of arguments |
48 // including the receiver and the extra arguments. | 48 // including the receiver and the extra arguments. |
49 __ addp(rax, Immediate(num_extra_args + 1)); | 49 __ addp(rax, Immediate(num_extra_args + 1)); |
50 __ JumpToExternalReference(ExternalReference(id, masm->isolate()), 1); | 50 __ JumpToExternalReference(ExternalReference(id, masm->isolate()), 1); |
51 } | 51 } |
52 | 52 |
53 | 53 |
54 static void CallRuntimePassFunction( | 54 static void CallRuntimePassFunction( |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 static void Generate_JSConstructStubHelper(MacroAssembler* masm, | 102 static void Generate_JSConstructStubHelper(MacroAssembler* masm, |
103 bool is_api_function, | 103 bool is_api_function, |
104 bool create_memento) { | 104 bool create_memento) { |
105 // ----------- S t a t e ------------- | 105 // ----------- S t a t e ------------- |
106 // -- rax: number of arguments | 106 // -- rax: number of arguments |
107 // -- rdi: constructor function | 107 // -- rdi: constructor function |
108 // -- rbx: allocation site or undefined | 108 // -- rbx: allocation site or undefined |
109 // ----------------------------------- | 109 // ----------------------------------- |
110 | 110 |
111 // Should never create mementos for api functions. | 111 // Should never create mementos for api functions. |
112 ASSERT(!is_api_function || !create_memento); | 112 DCHECK(!is_api_function || !create_memento); |
113 | 113 |
114 // Enter a construct frame. | 114 // Enter a construct frame. |
115 { | 115 { |
116 FrameScope scope(masm, StackFrame::CONSTRUCT); | 116 FrameScope scope(masm, StackFrame::CONSTRUCT); |
117 | 117 |
118 if (create_memento) { | 118 if (create_memento) { |
119 __ AssertUndefinedOrAllocationSite(rbx); | 119 __ AssertUndefinedOrAllocationSite(rbx); |
120 __ Push(rbx); | 120 __ Push(rbx); |
121 } | 121 } |
122 | 122 |
(...skipping 14 matching lines...) Expand all Loading... |
137 ExternalReference::debug_step_in_fp_address(masm->isolate()); | 137 ExternalReference::debug_step_in_fp_address(masm->isolate()); |
138 __ Move(kScratchRegister, debug_step_in_fp); | 138 __ Move(kScratchRegister, debug_step_in_fp); |
139 __ cmpp(Operand(kScratchRegister, 0), Immediate(0)); | 139 __ cmpp(Operand(kScratchRegister, 0), Immediate(0)); |
140 __ j(not_equal, &rt_call); | 140 __ j(not_equal, &rt_call); |
141 | 141 |
142 // Verified that the constructor is a JSFunction. | 142 // Verified that the constructor is a JSFunction. |
143 // Load the initial map and verify that it is in fact a map. | 143 // Load the initial map and verify that it is in fact a map. |
144 // rdi: constructor | 144 // rdi: constructor |
145 __ movp(rax, FieldOperand(rdi, JSFunction::kPrototypeOrInitialMapOffset)); | 145 __ movp(rax, FieldOperand(rdi, JSFunction::kPrototypeOrInitialMapOffset)); |
146 // Will both indicate a NULL and a Smi | 146 // Will both indicate a NULL and a Smi |
147 ASSERT(kSmiTag == 0); | 147 DCHECK(kSmiTag == 0); |
148 __ JumpIfSmi(rax, &rt_call); | 148 __ JumpIfSmi(rax, &rt_call); |
149 // rdi: constructor | 149 // rdi: constructor |
150 // rax: initial map (if proven valid below) | 150 // rax: initial map (if proven valid below) |
151 __ CmpObjectType(rax, MAP_TYPE, rbx); | 151 __ CmpObjectType(rax, MAP_TYPE, rbx); |
152 __ j(not_equal, &rt_call); | 152 __ j(not_equal, &rt_call); |
153 | 153 |
154 // Check that the constructor is not constructing a JSFunction (see | 154 // Check that the constructor is not constructing a JSFunction (see |
155 // comments in Runtime_NewObject in runtime.cc). In which case the | 155 // comments in Runtime_NewObject in runtime.cc). In which case the |
156 // initial map's instance type would be JS_FUNCTION_TYPE. | 156 // initial map's instance type would be JS_FUNCTION_TYPE. |
157 // rdi: constructor | 157 // rdi: constructor |
(...skipping 1360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1518 __ bind(&ok); | 1518 __ bind(&ok); |
1519 __ ret(0); | 1519 __ ret(0); |
1520 } | 1520 } |
1521 | 1521 |
1522 | 1522 |
1523 #undef __ | 1523 #undef __ |
1524 | 1524 |
1525 } } // namespace v8::internal | 1525 } } // namespace v8::internal |
1526 | 1526 |
1527 #endif // V8_TARGET_ARCH_X64 | 1527 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |