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/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
10 #include "src/debug/debug.h" | 10 #include "src/debug/debug.h" |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 // Possibly allocate a local context. | 176 // Possibly allocate a local context. |
177 if (info->scope()->num_heap_slots() > 0) { | 177 if (info->scope()->num_heap_slots() > 0) { |
178 Comment cmnt(masm_, "[ Allocate context"); | 178 Comment cmnt(masm_, "[ Allocate context"); |
179 bool need_write_barrier = true; | 179 bool need_write_barrier = true; |
180 int slots = info->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; | 180 int slots = info->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; |
181 // Argument to NewContext is the function, which is still in rdi. | 181 // Argument to NewContext is the function, which is still in rdi. |
182 if (info->scope()->is_script_scope()) { | 182 if (info->scope()->is_script_scope()) { |
183 __ Push(rdi); | 183 __ Push(rdi); |
184 __ Push(info->scope()->GetScopeInfo(info->isolate())); | 184 __ Push(info->scope()->GetScopeInfo(info->isolate())); |
185 __ CallRuntime(Runtime::kNewScriptContext, 2); | 185 __ CallRuntime(Runtime::kNewScriptContext, 2); |
| 186 PrepareForBailoutForId(BailoutId::ScriptContext(), TOS_REG); |
186 } else if (slots <= FastNewContextStub::kMaximumSlots) { | 187 } else if (slots <= FastNewContextStub::kMaximumSlots) { |
187 FastNewContextStub stub(isolate(), slots); | 188 FastNewContextStub stub(isolate(), slots); |
188 __ CallStub(&stub); | 189 __ CallStub(&stub); |
189 // Result of FastNewContextStub is always in new space. | 190 // Result of FastNewContextStub is always in new space. |
190 need_write_barrier = false; | 191 need_write_barrier = false; |
191 } else { | 192 } else { |
192 __ Push(rdi); | 193 __ Push(rdi); |
193 __ CallRuntime(Runtime::kNewFunctionContext, 1); | 194 __ CallRuntime(Runtime::kNewFunctionContext, 1); |
194 } | 195 } |
195 function_in_register = false; | 196 function_in_register = false; |
(...skipping 21 matching lines...) Expand all Loading... |
217 rsi, context_offset, rax, rbx, kDontSaveFPRegs); | 218 rsi, context_offset, rax, rbx, kDontSaveFPRegs); |
218 } else if (FLAG_debug_code) { | 219 } else if (FLAG_debug_code) { |
219 Label done; | 220 Label done; |
220 __ JumpIfInNewSpace(rsi, rax, &done, Label::kNear); | 221 __ JumpIfInNewSpace(rsi, rax, &done, Label::kNear); |
221 __ Abort(kExpectedNewSpaceObject); | 222 __ Abort(kExpectedNewSpaceObject); |
222 __ bind(&done); | 223 __ bind(&done); |
223 } | 224 } |
224 } | 225 } |
225 } | 226 } |
226 } | 227 } |
| 228 PrepareForBailoutForId(BailoutId::FunctionContext(), NO_REGISTERS); |
227 | 229 |
228 PrepareForBailoutForId(BailoutId::Prologue(), NO_REGISTERS); | |
229 // Function register is trashed in case we bailout here. But since that | 230 // Function register is trashed in case we bailout here. But since that |
230 // could happen only when we allocate a context the value of | 231 // could happen only when we allocate a context the value of |
231 // |function_in_register| is correct. | 232 // |function_in_register| is correct. |
232 | 233 |
233 // Possibly set up a local binding to the this function which is used in | 234 // Possibly set up a local binding to the this function which is used in |
234 // derived constructors with super calls. | 235 // derived constructors with super calls. |
235 Variable* this_function_var = scope()->this_function_var(); | 236 Variable* this_function_var = scope()->this_function_var(); |
236 if (this_function_var != nullptr) { | 237 if (this_function_var != nullptr) { |
237 Comment cmnt(masm_, "[ This function"); | 238 Comment cmnt(masm_, "[ This function"); |
238 if (!function_in_register) { | 239 if (!function_in_register) { |
(...skipping 4872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5111 Assembler::target_address_at(call_target_address, | 5112 Assembler::target_address_at(call_target_address, |
5112 unoptimized_code)); | 5113 unoptimized_code)); |
5113 return OSR_AFTER_STACK_CHECK; | 5114 return OSR_AFTER_STACK_CHECK; |
5114 } | 5115 } |
5115 | 5116 |
5116 | 5117 |
5117 } // namespace internal | 5118 } // namespace internal |
5118 } // namespace v8 | 5119 } // namespace v8 |
5119 | 5120 |
5120 #endif // V8_TARGET_ARCH_X64 | 5121 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |