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_X87 | 5 #if V8_TARGET_ARCH_X87 |
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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 SetVar(this_function_var, edi, ebx, ecx); | 244 SetVar(this_function_var, edi, ebx, ecx); |
245 } | 245 } |
246 | 246 |
247 // Possibly set up a local binding to the new target value. | 247 // Possibly set up a local binding to the new target value. |
248 Variable* new_target_var = scope()->new_target_var(); | 248 Variable* new_target_var = scope()->new_target_var(); |
249 if (new_target_var != nullptr) { | 249 if (new_target_var != nullptr) { |
250 Comment cmnt(masm_, "[ new.target"); | 250 Comment cmnt(masm_, "[ new.target"); |
251 SetVar(new_target_var, edx, ebx, ecx); | 251 SetVar(new_target_var, edx, ebx, ecx); |
252 } | 252 } |
253 | 253 |
| 254 // Possibly allocate RestParameters |
| 255 int rest_index; |
| 256 Variable* rest_param = scope()->rest_parameter(&rest_index); |
| 257 if (rest_param) { |
| 258 Comment cmnt(masm_, "[ Allocate rest parameter array"); |
| 259 |
| 260 int num_parameters = info->scope()->num_parameters(); |
| 261 int offset = num_parameters * kPointerSize; |
| 262 |
| 263 __ lea(edx, Operand(ebp, StandardFrameConstants::kCallerSPOffset + offset)); |
| 264 __ push(edx); |
| 265 __ push(Immediate(Smi::FromInt(num_parameters))); |
| 266 __ push(Immediate(Smi::FromInt(rest_index))); |
| 267 __ push(Immediate(Smi::FromInt(language_mode()))); |
| 268 function_in_register = false; |
| 269 |
| 270 RestParamAccessStub stub(isolate()); |
| 271 __ CallStub(&stub); |
| 272 SetVar(rest_param, eax, ebx, edx); |
| 273 } |
| 274 |
254 Variable* arguments = scope()->arguments(); | 275 Variable* arguments = scope()->arguments(); |
255 if (arguments != NULL) { | 276 if (arguments != NULL) { |
256 // Function uses arguments object. | 277 // Function uses arguments object. |
257 Comment cmnt(masm_, "[ Allocate arguments object"); | 278 Comment cmnt(masm_, "[ Allocate arguments object"); |
258 DCHECK(edi.is(ArgumentsAccessNewDescriptor::function())); | 279 DCHECK(edi.is(ArgumentsAccessNewDescriptor::function())); |
259 if (!function_in_register) { | 280 if (!function_in_register) { |
260 __ mov(edi, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); | 281 __ mov(edi, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); |
261 } | 282 } |
262 // Receiver is just before the parameters on the caller's stack. | 283 // Receiver is just before the parameters on the caller's stack. |
263 int num_parameters = info->scope()->num_parameters(); | 284 int num_parameters = info->scope()->num_parameters(); |
(...skipping 4489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4753 Assembler::target_address_at(call_target_address, | 4774 Assembler::target_address_at(call_target_address, |
4754 unoptimized_code)); | 4775 unoptimized_code)); |
4755 return OSR_AFTER_STACK_CHECK; | 4776 return OSR_AFTER_STACK_CHECK; |
4756 } | 4777 } |
4757 | 4778 |
4758 | 4779 |
4759 } // namespace internal | 4780 } // namespace internal |
4760 } // namespace v8 | 4781 } // namespace v8 |
4761 | 4782 |
4762 #endif // V8_TARGET_ARCH_X87 | 4783 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |