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 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 if (arguments != NULL) { | 261 if (arguments != NULL) { |
262 // Arguments object must be allocated after the context object, in | 262 // Arguments object must be allocated after the context object, in |
263 // case the "arguments" or ".arguments" variables are in the context. | 263 // case the "arguments" or ".arguments" variables are in the context. |
264 Comment cmnt(masm_, "[ Allocate arguments object"); | 264 Comment cmnt(masm_, "[ Allocate arguments object"); |
265 if (!function_in_register) { | 265 if (!function_in_register) { |
266 __ movp(rdi, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); | 266 __ movp(rdi, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); |
267 } | 267 } |
268 if (is_strict(language_mode()) || !has_simple_parameters()) { | 268 if (is_strict(language_mode()) || !has_simple_parameters()) { |
269 FastNewStrictArgumentsStub stub(isolate()); | 269 FastNewStrictArgumentsStub stub(isolate()); |
270 __ CallStub(&stub); | 270 __ CallStub(&stub); |
| 271 } else if (literal()->has_duplicate_parameters()) { |
| 272 __ Push(rdi); |
| 273 __ CallRuntime(Runtime::kNewSloppyArguments_Generic); |
271 } else { | 274 } else { |
272 DCHECK(rdi.is(ArgumentsAccessNewDescriptor::function())); | 275 FastNewSloppyArgumentsStub stub(isolate()); |
273 // The receiver is just before the parameters on the caller's stack. | |
274 int num_parameters = info->scope()->num_parameters(); | |
275 int offset = num_parameters * kPointerSize; | |
276 __ Move(ArgumentsAccessNewDescriptor::parameter_count(), | |
277 Smi::FromInt(num_parameters)); | |
278 __ leap(ArgumentsAccessNewDescriptor::parameter_pointer(), | |
279 Operand(rbp, StandardFrameConstants::kCallerSPOffset + offset)); | |
280 | |
281 // Arguments to ArgumentsAccessStub: | |
282 // function, parameter pointer, parameter count. | |
283 // The stub will rewrite parameter pointer and parameter count if the | |
284 // previous stack frame was an arguments adapter frame. | |
285 ArgumentsAccessStub::Type type = ArgumentsAccessStub::ComputeType( | |
286 literal()->has_duplicate_parameters()); | |
287 ArgumentsAccessStub stub(isolate(), type); | |
288 __ CallStub(&stub); | 276 __ CallStub(&stub); |
289 } | 277 } |
290 | 278 |
291 SetVar(arguments, rax, rbx, rdx); | 279 SetVar(arguments, rax, rbx, rdx); |
292 } | 280 } |
293 | 281 |
294 if (FLAG_trace) { | 282 if (FLAG_trace) { |
295 __ CallRuntime(Runtime::kTraceEnter); | 283 __ CallRuntime(Runtime::kTraceEnter); |
296 } | 284 } |
297 | 285 |
(...skipping 4221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4519 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), | 4507 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), |
4520 Assembler::target_address_at(call_target_address, | 4508 Assembler::target_address_at(call_target_address, |
4521 unoptimized_code)); | 4509 unoptimized_code)); |
4522 return OSR_AFTER_STACK_CHECK; | 4510 return OSR_AFTER_STACK_CHECK; |
4523 } | 4511 } |
4524 | 4512 |
4525 } // namespace internal | 4513 } // namespace internal |
4526 } // namespace v8 | 4514 } // namespace v8 |
4527 | 4515 |
4528 #endif // V8_TARGET_ARCH_X64 | 4516 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |