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/ast/scopes.h" | 7 #include "src/ast/scopes.h" |
8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 SetVar(this_function_var, edi, ebx, ecx); | 247 SetVar(this_function_var, edi, ebx, ecx); |
248 } | 248 } |
249 | 249 |
250 // Possibly set up a local binding to the new target value. | 250 // Possibly set up a local binding to the new target value. |
251 Variable* new_target_var = scope()->new_target_var(); | 251 Variable* new_target_var = scope()->new_target_var(); |
252 if (new_target_var != nullptr) { | 252 if (new_target_var != nullptr) { |
253 Comment cmnt(masm_, "[ new.target"); | 253 Comment cmnt(masm_, "[ new.target"); |
254 SetVar(new_target_var, edx, ebx, ecx); | 254 SetVar(new_target_var, edx, ebx, ecx); |
255 } | 255 } |
256 | 256 |
| 257 // Possibly allocate RestParameters |
| 258 int rest_index; |
| 259 Variable* rest_param = scope()->rest_parameter(&rest_index); |
| 260 if (rest_param) { |
| 261 Comment cmnt(masm_, "[ Allocate rest parameter array"); |
| 262 |
| 263 int num_parameters = info->scope()->num_parameters(); |
| 264 int offset = num_parameters * kPointerSize; |
| 265 |
| 266 __ lea(edx, Operand(ebp, StandardFrameConstants::kCallerSPOffset + offset)); |
| 267 __ push(edx); |
| 268 __ push(Immediate(Smi::FromInt(num_parameters))); |
| 269 __ push(Immediate(Smi::FromInt(rest_index))); |
| 270 __ push(Immediate(Smi::FromInt(language_mode()))); |
| 271 function_in_register = false; |
| 272 |
| 273 RestParamAccessStub stub(isolate()); |
| 274 __ CallStub(&stub); |
| 275 SetVar(rest_param, eax, ebx, edx); |
| 276 } |
| 277 |
257 Variable* arguments = scope()->arguments(); | 278 Variable* arguments = scope()->arguments(); |
258 if (arguments != NULL) { | 279 if (arguments != NULL) { |
259 // Function uses arguments object. | 280 // Function uses arguments object. |
260 Comment cmnt(masm_, "[ Allocate arguments object"); | 281 Comment cmnt(masm_, "[ Allocate arguments object"); |
261 DCHECK(edi.is(ArgumentsAccessNewDescriptor::function())); | 282 DCHECK(edi.is(ArgumentsAccessNewDescriptor::function())); |
262 if (!function_in_register) { | 283 if (!function_in_register) { |
263 __ mov(edi, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); | 284 __ mov(edi, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); |
264 } | 285 } |
265 // Receiver is just before the parameters on the caller's stack. | 286 // Receiver is just before the parameters on the caller's stack. |
266 int num_parameters = info->scope()->num_parameters(); | 287 int num_parameters = info->scope()->num_parameters(); |
(...skipping 4494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4761 Assembler::target_address_at(call_target_address, | 4782 Assembler::target_address_at(call_target_address, |
4762 unoptimized_code)); | 4783 unoptimized_code)); |
4763 return OSR_AFTER_STACK_CHECK; | 4784 return OSR_AFTER_STACK_CHECK; |
4764 } | 4785 } |
4765 | 4786 |
4766 | 4787 |
4767 } // namespace internal | 4788 } // namespace internal |
4768 } // namespace v8 | 4789 } // namespace v8 |
4769 | 4790 |
4770 #endif // V8_TARGET_ARCH_IA32 | 4791 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |