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/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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 SetVar(this_function_var, rdi, rbx, rcx); | 242 SetVar(this_function_var, rdi, rbx, rcx); |
243 } | 243 } |
244 | 244 |
245 // Possibly set up a local binding to the new target value. | 245 // Possibly set up a local binding to the new target value. |
246 Variable* new_target_var = scope()->new_target_var(); | 246 Variable* new_target_var = scope()->new_target_var(); |
247 if (new_target_var != nullptr) { | 247 if (new_target_var != nullptr) { |
248 Comment cmnt(masm_, "[ new.target"); | 248 Comment cmnt(masm_, "[ new.target"); |
249 SetVar(new_target_var, rdx, rbx, rcx); | 249 SetVar(new_target_var, rdx, rbx, rcx); |
250 } | 250 } |
251 | 251 |
| 252 // Possibly allocate RestParameters |
| 253 int rest_index; |
| 254 Variable* rest_param = scope()->rest_parameter(&rest_index); |
| 255 if (rest_param) { |
| 256 Comment cmnt(masm_, "[ Allocate rest parameter array"); |
| 257 |
| 258 int num_parameters = info->scope()->num_parameters(); |
| 259 int offset = num_parameters * kPointerSize; |
| 260 |
| 261 __ leap(rdx, |
| 262 Operand(rbp, StandardFrameConstants::kCallerSPOffset + offset)); |
| 263 __ Push(rdx); |
| 264 __ Push(Smi::FromInt(num_parameters)); |
| 265 __ Push(Smi::FromInt(rest_index)); |
| 266 __ Push(Smi::FromInt(language_mode())); |
| 267 function_in_register = false; |
| 268 |
| 269 RestParamAccessStub stub(isolate()); |
| 270 __ CallStub(&stub); |
| 271 |
| 272 SetVar(rest_param, rax, rbx, rdx); |
| 273 } |
| 274 |
252 // Possibly allocate an arguments object. | 275 // Possibly allocate an arguments object. |
253 Variable* arguments = scope()->arguments(); | 276 Variable* arguments = scope()->arguments(); |
254 if (arguments != NULL) { | 277 if (arguments != NULL) { |
255 // Arguments object must be allocated after the context object, in | 278 // Arguments object must be allocated after the context object, in |
256 // case the "arguments" or ".arguments" variables are in the context. | 279 // case the "arguments" or ".arguments" variables are in the context. |
257 Comment cmnt(masm_, "[ Allocate arguments object"); | 280 Comment cmnt(masm_, "[ Allocate arguments object"); |
258 DCHECK(rdi.is(ArgumentsAccessNewDescriptor::function())); | 281 DCHECK(rdi.is(ArgumentsAccessNewDescriptor::function())); |
259 if (!function_in_register) { | 282 if (!function_in_register) { |
260 __ movp(rdi, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); | 283 __ movp(rdi, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); |
261 } | 284 } |
(...skipping 4510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4772 Assembler::target_address_at(call_target_address, | 4795 Assembler::target_address_at(call_target_address, |
4773 unoptimized_code)); | 4796 unoptimized_code)); |
4774 return OSR_AFTER_STACK_CHECK; | 4797 return OSR_AFTER_STACK_CHECK; |
4775 } | 4798 } |
4776 | 4799 |
4777 | 4800 |
4778 } // namespace internal | 4801 } // namespace internal |
4779 } // namespace v8 | 4802 } // namespace v8 |
4780 | 4803 |
4781 #endif // V8_TARGET_ARCH_X64 | 4804 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |