Index: src/arm64/code-stubs-arm64.cc |
diff --git a/src/arm64/code-stubs-arm64.cc b/src/arm64/code-stubs-arm64.cc |
index 28cbf7cde647fcc1afb7737d6fdd92ddd4b815a8..3179972d4bdbdd3a91b5e401819654b3d227b559 100644 |
--- a/src/arm64/code-stubs-arm64.cc |
+++ b/src/arm64/code-stubs-arm64.cc |
@@ -2160,6 +2160,53 @@ void ArgumentsAccessStub::GenerateNewStrict(MacroAssembler* masm) { |
} |
+void RestParamAccessStub::GenerateNew(MacroAssembler* masm) { |
+ // Stack layout on entry. |
+ // jssp[0]: index of rest parameter (tagged) |
+ // jssp[8]: number of parameters (tagged) |
+ // jssp[16]: address of receiver argument |
+ // |
+ // Returns pointer to result object in x0. |
+ |
+ // Get the stub arguments from the frame, and make an untagged copy of the |
+ // parameter count. |
+ Register rest_index_smi = x1; |
+ Register param_count_smi = x2; |
+ Register params = x3; |
+ Register param_count = x13; |
+ __ Pop(rest_index_smi, param_count_smi, params); |
+ __ SmiUntag(param_count, param_count_smi); |
+ |
+ // Test if arguments adaptor needed. |
+ Register caller_fp = x11; |
+ Register caller_ctx = x12; |
+ Label runtime; |
+ __ Ldr(caller_fp, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); |
+ __ Ldr(caller_ctx, MemOperand(caller_fp, |
+ StandardFrameConstants::kContextOffset)); |
+ __ Cmp(caller_ctx, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)); |
+ __ B(ne, &runtime); |
+ |
+ // x1 rest_index_smi index of rest parameter |
+ // x2 param_count_smi number of parameters passed to function (smi) |
+ // x3 params pointer to parameters |
+ // x11 caller_fp caller's frame pointer |
+ // x13 param_count number of parameters passed to function |
+ |
+ // Patch the argument length and parameters pointer. |
+ __ Ldr(param_count_smi, |
+ MemOperand(caller_fp, |
+ ArgumentsAdaptorFrameConstants::kLengthOffset)); |
+ __ SmiUntag(param_count, param_count_smi); |
+ __ Add(x10, caller_fp, Operand(param_count, LSL, kPointerSizeLog2)); |
+ __ Add(params, x10, StandardFrameConstants::kCallerSPOffset); |
+ |
+ __ Bind(&runtime); |
+ __ Push(params, param_count_smi, rest_index_smi); |
+ __ TailCallRuntime(Runtime::kNewRestParam, 3, 1); |
+} |
+ |
+ |
void RegExpExecStub::Generate(MacroAssembler* masm) { |
#ifdef V8_INTERPRETED_REGEXP |
__ TailCallRuntime(Runtime::kRegExpExecRT, 4, 1); |