Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(513)

Side by Side Diff: src/arm64/code-stubs-arm64.cc

Issue 816913003: Implement ES6 rest parameters (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Disable optimization of functions with rest parameters in parser Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #if V8_TARGET_ARCH_ARM64 7 #if V8_TARGET_ARCH_ARM64
8 8
9 #include "src/bootstrapper.h" 9 #include "src/bootstrapper.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 2132 matching lines...) Expand 10 before | Expand all | Expand 10 after
2143 __ Bind(&done); 2143 __ Bind(&done);
2144 __ Ret(); 2144 __ Ret();
2145 2145
2146 // Do the runtime call to allocate the arguments object. 2146 // Do the runtime call to allocate the arguments object.
2147 __ Bind(&runtime); 2147 __ Bind(&runtime);
2148 __ Push(function, params, param_count_smi); 2148 __ Push(function, params, param_count_smi);
2149 __ TailCallRuntime(Runtime::kNewStrictArguments, 3, 1); 2149 __ TailCallRuntime(Runtime::kNewStrictArguments, 3, 1);
2150 } 2150 }
2151 2151
2152 2152
2153 void RestParamAccessStub::GenerateNew(MacroAssembler* masm) {
2154 // Stack layout on entry.
2155 // jssp[0]: index of rest parameter (tagged)
2156 // jssp[8]: number of parameters (tagged)
2157 // jssp[16]: address of receiver argument
2158 //
2159 // Returns pointer to result object in x0.
2160
2161 // Get the stub arguments from the frame, and make an untagged copy of the
2162 // parameter count.
2163 Register rest_index_smi = x1;
2164 Register param_count_smi = x2;
2165 Register params = x3;
2166 Register param_count = x13;
2167 __ Pop(rest_index_smi, param_count_smi, params);
2168 __ SmiUntag(param_count, param_count_smi);
2169
2170 // Test if arguments adaptor needed.
2171 Register caller_fp = x11;
2172 Register caller_ctx = x12;
2173 Label runtime;
2174 __ Ldr(caller_fp, MemOperand(fp, StandardFrameConstants::kCallerFPOffset));
2175 __ Ldr(caller_ctx, MemOperand(caller_fp,
2176 StandardFrameConstants::kContextOffset));
2177 __ Cmp(caller_ctx, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR));
2178 __ B(ne, &runtime);
2179
2180 // x1 rest_index_smi index of rest parameter
2181 // x2 param_count_smi number of parameters passed to function (smi)
2182 // x3 params pointer to parameters
2183 // x11 caller_fp caller's frame pointer
2184 // x13 param_count number of parameters passed to function
2185
2186 // Patch the argument length and parameters pointer.
2187 __ Ldr(param_count_smi,
2188 MemOperand(caller_fp,
2189 ArgumentsAdaptorFrameConstants::kLengthOffset));
2190 __ SmiUntag(param_count, param_count_smi);
2191 __ Add(x10, caller_fp, Operand(param_count, LSL, kPointerSizeLog2));
2192 __ Add(params, x10, StandardFrameConstants::kCallerSPOffset);
2193
2194 __ Bind(&runtime);
2195 __ Push(params, param_count_smi, rest_index_smi);
2196 __ TailCallRuntime(Runtime::kNewRestParam, 3, 1);
2197 }
2198
2199
2153 void RegExpExecStub::Generate(MacroAssembler* masm) { 2200 void RegExpExecStub::Generate(MacroAssembler* masm) {
2154 #ifdef V8_INTERPRETED_REGEXP 2201 #ifdef V8_INTERPRETED_REGEXP
2155 __ TailCallRuntime(Runtime::kRegExpExecRT, 4, 1); 2202 __ TailCallRuntime(Runtime::kRegExpExecRT, 4, 1);
2156 #else // V8_INTERPRETED_REGEXP 2203 #else // V8_INTERPRETED_REGEXP
2157 2204
2158 // Stack frame on entry. 2205 // Stack frame on entry.
2159 // jssp[0]: last_match_info (expected JSArray) 2206 // jssp[0]: last_match_info (expected JSArray)
2160 // jssp[8]: previous index 2207 // jssp[8]: previous index
2161 // jssp[16]: subject string 2208 // jssp[16]: subject string
2162 // jssp[24]: JSRegExp object 2209 // jssp[24]: JSRegExp object
(...skipping 3255 matching lines...) Expand 10 before | Expand all | Expand 10 after
5418 kStackUnwindSpace, NULL, spill_offset, 5465 kStackUnwindSpace, NULL, spill_offset,
5419 MemOperand(fp, 6 * kPointerSize), NULL); 5466 MemOperand(fp, 6 * kPointerSize), NULL);
5420 } 5467 }
5421 5468
5422 5469
5423 #undef __ 5470 #undef __
5424 5471
5425 } } // namespace v8::internal 5472 } } // namespace v8::internal
5426 5473
5427 #endif // V8_TARGET_ARCH_ARM64 5474 #endif // V8_TARGET_ARCH_ARM64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698