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/full-codegen/full-codegen.h" | 7 #include "src/full-codegen/full-codegen.h" |
8 #include "src/ast/compile-time-value.h" | 8 #include "src/ast/compile-time-value.h" |
9 #include "src/ast/scopes.h" | 9 #include "src/ast/scopes.h" |
10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 __ Push(info->scope()->scope_info()); | 182 __ Push(info->scope()->scope_info()); |
183 __ CallRuntime(Runtime::kNewScriptContext); | 183 __ CallRuntime(Runtime::kNewScriptContext); |
184 PrepareForBailoutForId(BailoutId::ScriptContext(), | 184 PrepareForBailoutForId(BailoutId::ScriptContext(), |
185 BailoutState::TOS_REGISTER); | 185 BailoutState::TOS_REGISTER); |
186 // The new target value is not used, clobbering is safe. | 186 // The new target value is not used, clobbering is safe. |
187 DCHECK_NULL(info->scope()->new_target_var()); | 187 DCHECK_NULL(info->scope()->new_target_var()); |
188 } else { | 188 } else { |
189 if (info->scope()->new_target_var() != nullptr) { | 189 if (info->scope()->new_target_var() != nullptr) { |
190 __ Push(rdx); // Preserve new target. | 190 __ Push(rdx); // Preserve new target. |
191 } | 191 } |
192 FastNewFunctionContextStub stub(isolate()); | 192 if (slots <= FastNewFunctionContextStub::kMaximumSlots) { |
193 __ Set(FastNewFunctionContextDescriptor::SlotsRegister(), slots); | 193 FastNewFunctionContextStub stub(isolate()); |
194 __ CallStub(&stub); | 194 __ Set(FastNewFunctionContextDescriptor::SlotsRegister(), slots); |
195 // Result of FastNewFunctionContextStub is always in new space. | 195 __ CallStub(&stub); |
196 need_write_barrier = false; | 196 // Result of FastNewFunctionContextStub is always in new space. |
| 197 need_write_barrier = false; |
| 198 } else { |
| 199 __ Push(rdi); |
| 200 __ CallRuntime(Runtime::kNewFunctionContext); |
| 201 } |
197 if (info->scope()->new_target_var() != nullptr) { | 202 if (info->scope()->new_target_var() != nullptr) { |
198 __ Pop(rdx); // Restore new target. | 203 __ Pop(rdx); // Restore new target. |
199 } | 204 } |
200 } | 205 } |
201 function_in_register = false; | 206 function_in_register = false; |
202 // Context is returned in rax. It replaces the context passed to us. | 207 // Context is returned in rax. It replaces the context passed to us. |
203 // It's saved in the stack and kept live in rsi. | 208 // It's saved in the stack and kept live in rsi. |
204 __ movp(rsi, rax); | 209 __ movp(rsi, rax); |
205 __ movp(Operand(rbp, StandardFrameConstants::kContextOffset), rax); | 210 __ movp(Operand(rbp, StandardFrameConstants::kContextOffset), rax); |
206 | 211 |
(...skipping 3309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3516 DCHECK_EQ( | 3521 DCHECK_EQ( |
3517 isolate->builtins()->OnStackReplacement()->entry(), | 3522 isolate->builtins()->OnStackReplacement()->entry(), |
3518 Assembler::target_address_at(call_target_address, unoptimized_code)); | 3523 Assembler::target_address_at(call_target_address, unoptimized_code)); |
3519 return ON_STACK_REPLACEMENT; | 3524 return ON_STACK_REPLACEMENT; |
3520 } | 3525 } |
3521 | 3526 |
3522 } // namespace internal | 3527 } // namespace internal |
3523 } // namespace v8 | 3528 } // namespace v8 |
3524 | 3529 |
3525 #endif // V8_TARGET_ARCH_X64 | 3530 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |