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 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 } | 234 } |
235 } | 235 } |
236 } | 236 } |
237 | 237 |
238 // Register holding this function and new target are both trashed in case we | 238 // Register holding this function and new target are both trashed in case we |
239 // bailout here. But since that can happen only when new target is not used | 239 // bailout here. But since that can happen only when new target is not used |
240 // and we allocate a context, the value of |function_in_register| is correct. | 240 // and we allocate a context, the value of |function_in_register| is correct. |
241 PrepareForBailoutForId(BailoutId::FunctionContext(), | 241 PrepareForBailoutForId(BailoutId::FunctionContext(), |
242 BailoutState::NO_REGISTERS); | 242 BailoutState::NO_REGISTERS); |
243 | 243 |
244 // Possibly set up a local binding to the this function which is used in | 244 // We don't support new.target and rest parameters here. |
245 // derived constructors with super calls. | 245 DCHECK_NULL(info->scope()->new_target_var()); |
246 Variable* this_function_var = info->scope()->this_function_var(); | 246 DCHECK_NULL(info->scope()->rest_parameter()); |
247 if (this_function_var != nullptr) { | 247 DCHECK_NULL(info->scope()->this_function_var()); |
248 Comment cmnt(masm_, "[ This function"); | |
249 if (!function_in_register) { | |
250 __ movp(rdi, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); | |
251 // The write barrier clobbers register again, keep it marked as such. | |
252 } | |
253 SetVar(this_function_var, rdi, rbx, rcx); | |
254 } | |
255 | |
256 // Possibly set up a local binding to the new target value. | |
257 Variable* new_target_var = info->scope()->new_target_var(); | |
258 if (new_target_var != nullptr) { | |
259 Comment cmnt(masm_, "[ new.target"); | |
260 SetVar(new_target_var, rdx, rbx, rcx); | |
261 } | |
262 | |
263 // Possibly allocate RestParameters | |
264 Variable* rest_param = info->scope()->rest_parameter(); | |
265 if (rest_param != nullptr) { | |
266 Comment cmnt(masm_, "[ Allocate rest parameter array"); | |
267 if (!function_in_register) { | |
268 __ movp(rdi, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); | |
269 } | |
270 FastNewRestParameterStub stub(isolate()); | |
271 __ CallStub(&stub); | |
272 function_in_register = false; | |
273 SetVar(rest_param, rax, rbx, rdx); | |
274 } | |
275 | 248 |
276 // Possibly allocate an arguments object. | 249 // Possibly allocate an arguments object. |
277 DCHECK_EQ(scope(), info->scope()); | 250 DCHECK_EQ(scope(), info->scope()); |
278 Variable* arguments = info->scope()->arguments(); | 251 Variable* arguments = info->scope()->arguments(); |
279 if (arguments != NULL) { | 252 if (arguments != NULL) { |
280 // Arguments object must be allocated after the context object, in | 253 // Arguments object must be allocated after the context object, in |
281 // case the "arguments" or ".arguments" variables are in the context. | 254 // case the "arguments" or ".arguments" variables are in the context. |
282 Comment cmnt(masm_, "[ Allocate arguments object"); | 255 Comment cmnt(masm_, "[ Allocate arguments object"); |
283 if (!function_in_register) { | 256 if (!function_in_register) { |
284 __ movp(rdi, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); | 257 __ movp(rdi, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); |
(...skipping 2831 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3116 DCHECK_EQ( | 3089 DCHECK_EQ( |
3117 isolate->builtins()->OnStackReplacement()->entry(), | 3090 isolate->builtins()->OnStackReplacement()->entry(), |
3118 Assembler::target_address_at(call_target_address, unoptimized_code)); | 3091 Assembler::target_address_at(call_target_address, unoptimized_code)); |
3119 return ON_STACK_REPLACEMENT; | 3092 return ON_STACK_REPLACEMENT; |
3120 } | 3093 } |
3121 | 3094 |
3122 } // namespace internal | 3095 } // namespace internal |
3123 } // namespace v8 | 3096 } // namespace v8 |
3124 | 3097 |
3125 #endif // V8_TARGET_ARCH_X64 | 3098 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |