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_IA32 | 5 #if V8_TARGET_ARCH_IA32 |
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 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 } | 238 } |
239 } | 239 } |
240 } | 240 } |
241 | 241 |
242 // Register holding this function and new target are both trashed in case we | 242 // Register holding this function and new target are both trashed in case we |
243 // bailout here. But since that can happen only when new target is not used | 243 // bailout here. But since that can happen only when new target is not used |
244 // and we allocate a context, the value of |function_in_register| is correct. | 244 // and we allocate a context, the value of |function_in_register| is correct. |
245 PrepareForBailoutForId(BailoutId::FunctionContext(), | 245 PrepareForBailoutForId(BailoutId::FunctionContext(), |
246 BailoutState::NO_REGISTERS); | 246 BailoutState::NO_REGISTERS); |
247 | 247 |
248 // Possibly set up a local binding to the this function which is used in | 248 // We don't support new.target and rest parameters here. |
249 // derived constructors with super calls. | 249 DCHECK_NULL(info->scope()->new_target_var()); |
250 Variable* this_function_var = info->scope()->this_function_var(); | 250 DCHECK_NULL(info->scope()->rest_parameter()); |
251 if (this_function_var != nullptr) { | 251 DCHECK_NULL(info->scope()->this_function_var()); |
252 Comment cmnt(masm_, "[ This function"); | |
253 if (!function_in_register) { | |
254 __ mov(edi, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); | |
255 // The write barrier clobbers register again, keep it marked as such. | |
256 } | |
257 SetVar(this_function_var, edi, ebx, ecx); | |
258 } | |
259 | |
260 // Possibly set up a local binding to the new target value. | |
261 Variable* new_target_var = info->scope()->new_target_var(); | |
262 if (new_target_var != nullptr) { | |
263 Comment cmnt(masm_, "[ new.target"); | |
264 SetVar(new_target_var, edx, ebx, ecx); | |
265 } | |
266 | |
267 // Possibly allocate RestParameters | |
268 Variable* rest_param = info->scope()->rest_parameter(); | |
269 if (rest_param != nullptr) { | |
270 Comment cmnt(masm_, "[ Allocate rest parameter array"); | |
271 if (!function_in_register) { | |
272 __ mov(edi, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); | |
273 } | |
274 FastNewRestParameterStub stub(isolate()); | |
275 __ CallStub(&stub); | |
276 function_in_register = false; | |
277 SetVar(rest_param, eax, ebx, edx); | |
278 } | |
279 | 252 |
280 Variable* arguments = info->scope()->arguments(); | 253 Variable* arguments = info->scope()->arguments(); |
281 if (arguments != NULL) { | 254 if (arguments != NULL) { |
282 // Arguments object must be allocated after the context object, in | 255 // Arguments object must be allocated after the context object, in |
283 // case the "arguments" or ".arguments" variables are in the context. | 256 // case the "arguments" or ".arguments" variables are in the context. |
284 Comment cmnt(masm_, "[ Allocate arguments object"); | 257 Comment cmnt(masm_, "[ Allocate arguments object"); |
285 if (!function_in_register) { | 258 if (!function_in_register) { |
286 __ mov(edi, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); | 259 __ mov(edi, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); |
287 } | 260 } |
288 if (is_strict(language_mode()) || !has_simple_parameters()) { | 261 if (is_strict(language_mode()) || !has_simple_parameters()) { |
(...skipping 2841 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3130 isolate->builtins()->OnStackReplacement()->entry(), | 3103 isolate->builtins()->OnStackReplacement()->entry(), |
3131 Assembler::target_address_at(call_target_address, unoptimized_code)); | 3104 Assembler::target_address_at(call_target_address, unoptimized_code)); |
3132 return ON_STACK_REPLACEMENT; | 3105 return ON_STACK_REPLACEMENT; |
3133 } | 3106 } |
3134 | 3107 |
3135 | 3108 |
3136 } // namespace internal | 3109 } // namespace internal |
3137 } // namespace v8 | 3110 } // namespace v8 |
3138 | 3111 |
3139 #endif // V8_TARGET_ARCH_IA32 | 3112 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |