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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 if (slots <= FastNewFunctionContextStub::kMaximumSlots) { | 192 if (slots <= FastNewFunctionContextStub::kMaximumSlots) { |
193 FastNewFunctionContextStub stub(isolate()); | 193 if (info->scope()->is_eval_scope()) { |
194 __ Set(FastNewFunctionContextDescriptor::SlotsRegister(), slots); | 194 FastNewEvalContextStub stub(isolate()); |
195 __ CallStub(&stub); | 195 __ Set(FastNewEvalContextDescriptor::SlotsRegister(), slots); |
| 196 __ CallStub(&stub); |
| 197 } else { |
| 198 FastNewFunctionContextStub stub(isolate()); |
| 199 __ Set(FastNewFunctionContextDescriptor::SlotsRegister(), slots); |
| 200 __ CallStub(&stub); |
| 201 } |
196 // Result of FastNewFunctionContextStub is always in new space. | 202 // Result of FastNewFunctionContextStub is always in new space. |
197 need_write_barrier = false; | 203 need_write_barrier = false; |
198 } else { | 204 } else { |
199 __ Push(rdi); | 205 __ Push(rdi); |
200 __ CallRuntime(Runtime::kNewFunctionContext); | 206 __ CallRuntime(info->scope()->is_eval_scope() |
| 207 ? Runtime::kNewEvalContext |
| 208 : Runtime::kNewFunctionContext); |
201 } | 209 } |
202 if (info->scope()->new_target_var() != nullptr) { | 210 if (info->scope()->new_target_var() != nullptr) { |
203 __ Pop(rdx); // Restore new target. | 211 __ Pop(rdx); // Restore new target. |
204 } | 212 } |
205 } | 213 } |
206 function_in_register = false; | 214 function_in_register = false; |
207 // Context is returned in rax. It replaces the context passed to us. | 215 // Context is returned in rax. It replaces the context passed to us. |
208 // It's saved in the stack and kept live in rsi. | 216 // It's saved in the stack and kept live in rsi. |
209 __ movp(rsi, rax); | 217 __ movp(rsi, rax); |
210 __ movp(Operand(rbp, StandardFrameConstants::kContextOffset), rax); | 218 __ movp(Operand(rbp, StandardFrameConstants::kContextOffset), rax); |
(...skipping 3302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3513 DCHECK_EQ( | 3521 DCHECK_EQ( |
3514 isolate->builtins()->OnStackReplacement()->entry(), | 3522 isolate->builtins()->OnStackReplacement()->entry(), |
3515 Assembler::target_address_at(call_target_address, unoptimized_code)); | 3523 Assembler::target_address_at(call_target_address, unoptimized_code)); |
3516 return ON_STACK_REPLACEMENT; | 3524 return ON_STACK_REPLACEMENT; |
3517 } | 3525 } |
3518 | 3526 |
3519 } // namespace internal | 3527 } // namespace internal |
3520 } // namespace v8 | 3528 } // namespace v8 |
3521 | 3529 |
3522 #endif // V8_TARGET_ARCH_X64 | 3530 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |