Index: src/full-codegen/arm64/full-codegen-arm64.cc |
diff --git a/src/full-codegen/arm64/full-codegen-arm64.cc b/src/full-codegen/arm64/full-codegen-arm64.cc |
index 0a82b86f9b4f53544eb03eaff4d0de4c0d4e8290..54378d006504fd752cfbcedb3218f58b86f998d0 100644 |
--- a/src/full-codegen/arm64/full-codegen-arm64.cc |
+++ b/src/full-codegen/arm64/full-codegen-arm64.cc |
@@ -281,11 +281,23 @@ |
if (is_strict(language_mode()) || !has_simple_parameters()) { |
FastNewStrictArgumentsStub stub(isolate()); |
__ CallStub(&stub); |
- } else if (literal()->has_duplicate_parameters()) { |
- __ Push(x1); |
- __ CallRuntime(Runtime::kNewSloppyArguments_Generic); |
} else { |
- FastNewSloppyArgumentsStub stub(isolate()); |
+ DCHECK(x1.is(ArgumentsAccessNewDescriptor::function())); |
+ // Receiver is just before the parameters on the caller's stack. |
+ int num_parameters = info->scope()->num_parameters(); |
+ int offset = num_parameters * kPointerSize; |
+ __ Mov(ArgumentsAccessNewDescriptor::parameter_count(), |
+ Smi::FromInt(num_parameters)); |
+ __ Add(ArgumentsAccessNewDescriptor::parameter_pointer(), fp, |
+ 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); |
} |