Index: src/full-codegen/x64/full-codegen-x64.cc |
diff --git a/src/full-codegen/x64/full-codegen-x64.cc b/src/full-codegen/x64/full-codegen-x64.cc |
index 5ad78bd30040ef37ca291ed8eedd45c63328617a..f2b59df585bc646e75389c7d2cf681d9b1d932c4 100644 |
--- a/src/full-codegen/x64/full-codegen-x64.cc |
+++ b/src/full-codegen/x64/full-codegen-x64.cc |
@@ -268,11 +268,23 @@ |
if (is_strict(language_mode()) || !has_simple_parameters()) { |
FastNewStrictArgumentsStub stub(isolate()); |
__ CallStub(&stub); |
- } else if (literal()->has_duplicate_parameters()) { |
- __ Push(rdi); |
- __ CallRuntime(Runtime::kNewSloppyArguments_Generic); |
} else { |
- FastNewSloppyArgumentsStub stub(isolate()); |
+ DCHECK(rdi.is(ArgumentsAccessNewDescriptor::function())); |
+ // The receiver is just before the parameters on the caller's stack. |
+ int num_parameters = info->scope()->num_parameters(); |
+ int offset = num_parameters * kPointerSize; |
+ __ Move(ArgumentsAccessNewDescriptor::parameter_count(), |
+ Smi::FromInt(num_parameters)); |
+ __ leap(ArgumentsAccessNewDescriptor::parameter_pointer(), |
+ Operand(rbp, StandardFrameConstants::kCallerSPOffset + offset)); |
+ |
+ // Arguments to ArgumentsAccessStub: |
+ // function, parameter pointer, parameter count. |
+ // The stub will rewrite parameter pointer and parameter count if the |
+ // previous stack frame was an arguments adapter frame. |
+ ArgumentsAccessStub::Type type = ArgumentsAccessStub::ComputeType( |
+ literal()->has_duplicate_parameters()); |
+ ArgumentsAccessStub stub(isolate(), type); |
__ CallStub(&stub); |
} |