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

Side by Side Diff: src/builtins/arm/builtins-arm.cc

Issue 2890023004: [turbofan] Avoid allocating rest parameters for spread calls. (Closed)
Patch Set: Created 3 years, 7 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
« no previous file with comments | « src/arm64/interface-descriptors-arm64.cc ('k') | src/builtins/arm64/builtins-arm64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_ARM 5 #if V8_TARGET_ARCH_ARM
6 6
7 #include "src/assembler-inl.h" 7 #include "src/assembler-inl.h"
8 #include "src/codegen.h" 8 #include "src/codegen.h"
9 #include "src/counters.h" 9 #include "src/counters.h"
10 #include "src/debug/debug.h" 10 #include "src/debug/debug.h"
(...skipping 2135 matching lines...) Expand 10 before | Expand all | Expand 10 after
2146 2146
2147 // Dispatch to Call or Construct depending on whether new.target is undefined. 2147 // Dispatch to Call or Construct depending on whether new.target is undefined.
2148 { 2148 {
2149 __ CompareRoot(r3, Heap::kUndefinedValueRootIndex); 2149 __ CompareRoot(r3, Heap::kUndefinedValueRootIndex);
2150 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET, eq); 2150 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET, eq);
2151 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); 2151 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET);
2152 } 2152 }
2153 } 2153 }
2154 2154
2155 // static 2155 // static
2156 void Builtins::Generate_CallForwardVarargs(MacroAssembler* masm, 2156 void Builtins::Generate_ForwardVarargs(MacroAssembler* masm,
2157 Handle<Code> code) { 2157 Handle<Code> code) {
2158 // ----------- S t a t e ------------- 2158 // ----------- S t a t e -------------
2159 // -- r1 : the target to call (can be any Object) 2159 // -- r0 : the number of arguments (not including the receiver)
2160 // -- r2 : start index (to support rest parameters) 2160 // -- r3 : the new.target (for [[Construct]] calls)
2161 // -- lr : return address. 2161 // -- r1 : the target to call (can be any Object)
2162 // -- sp[0] : thisArgument 2162 // -- r2 : start index (to support rest parameters)
2163 // ----------------------------------- 2163 // -----------------------------------
2164 2164
2165 // Check if we have an arguments adaptor frame below the function frame. 2165 // Check if we have an arguments adaptor frame below the function frame.
2166 Label arguments_adaptor, arguments_done; 2166 Label arguments_adaptor, arguments_done;
2167 __ ldr(r3, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); 2167 __ ldr(r4, MemOperand(fp, StandardFrameConstants::kCallerFPOffset));
2168 __ ldr(ip, MemOperand(r3, CommonFrameConstants::kContextOrFrameTypeOffset)); 2168 __ ldr(ip, MemOperand(r4, CommonFrameConstants::kContextOrFrameTypeOffset));
2169 __ cmp(ip, Operand(StackFrame::TypeToMarker(StackFrame::ARGUMENTS_ADAPTOR))); 2169 __ cmp(ip, Operand(StackFrame::TypeToMarker(StackFrame::ARGUMENTS_ADAPTOR)));
2170 __ b(eq, &arguments_adaptor); 2170 __ b(eq, &arguments_adaptor);
2171 { 2171 {
2172 __ ldr(r0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); 2172 __ ldr(r5, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
2173 __ ldr(r0, FieldMemOperand(r0, JSFunction::kSharedFunctionInfoOffset)); 2173 __ ldr(r5, FieldMemOperand(r5, JSFunction::kSharedFunctionInfoOffset));
2174 __ ldr(r0, FieldMemOperand( 2174 __ ldr(r5, FieldMemOperand(
2175 r0, SharedFunctionInfo::kFormalParameterCountOffset)); 2175 r5, SharedFunctionInfo::kFormalParameterCountOffset));
2176 __ mov(r3, fp); 2176 __ mov(r4, fp);
2177 } 2177 }
2178 __ b(&arguments_done); 2178 __ b(&arguments_done);
2179 __ bind(&arguments_adaptor); 2179 __ bind(&arguments_adaptor);
2180 { 2180 {
2181 // Load the length from the ArgumentsAdaptorFrame. 2181 // Load the length from the ArgumentsAdaptorFrame.
2182 __ ldr(r0, MemOperand(r3, ArgumentsAdaptorFrameConstants::kLengthOffset)); 2182 __ ldr(r5, MemOperand(r4, ArgumentsAdaptorFrameConstants::kLengthOffset));
2183 } 2183 }
2184 __ bind(&arguments_done); 2184 __ bind(&arguments_done);
2185 2185
2186 Label stack_empty, stack_done, stack_overflow; 2186 Label stack_done, stack_overflow;
2187 __ SmiUntag(r0); 2187 __ SmiUntag(r5);
2188 __ sub(r0, r0, r2, SetCC); 2188 __ sub(r5, r5, r2, SetCC);
2189 __ b(le, &stack_empty); 2189 __ b(le, &stack_done);
2190 { 2190 {
2191 // Check for stack overflow. 2191 // Check for stack overflow.
2192 Generate_StackOverflowCheck(masm, r0, r2, &stack_overflow); 2192 Generate_StackOverflowCheck(masm, r5, r2, &stack_overflow);
2193 2193
2194 // Forward the arguments from the caller frame. 2194 // Forward the arguments from the caller frame.
2195 { 2195 {
2196 Label loop; 2196 Label loop;
2197 __ add(r3, r3, Operand(kPointerSize)); 2197 __ add(r4, r4, Operand(kPointerSize));
2198 __ mov(r2, r0); 2198 __ add(r0, r0, r5);
2199 __ bind(&loop); 2199 __ bind(&loop);
2200 { 2200 {
2201 __ ldr(ip, MemOperand(r3, r2, LSL, kPointerSizeLog2)); 2201 __ ldr(ip, MemOperand(r4, r5, LSL, kPointerSizeLog2));
2202 __ push(ip); 2202 __ push(ip);
2203 __ sub(r2, r2, Operand(1), SetCC); 2203 __ sub(r5, r5, Operand(1), SetCC);
2204 __ b(ne, &loop); 2204 __ b(ne, &loop);
2205 } 2205 }
2206 } 2206 }
2207 } 2207 }
2208 __ b(&stack_done); 2208 __ b(&stack_done);
2209 __ bind(&stack_overflow); 2209 __ bind(&stack_overflow);
2210 __ TailCallRuntime(Runtime::kThrowStackOverflow); 2210 __ TailCallRuntime(Runtime::kThrowStackOverflow);
2211 __ bind(&stack_empty);
2212 {
2213 // We just pass the receiver, which is already on the stack.
2214 __ mov(r0, Operand(0));
2215 }
2216 __ bind(&stack_done); 2211 __ bind(&stack_done);
2217 2212
2213 // Tail-call to the {code} handler.
2218 __ Jump(code, RelocInfo::CODE_TARGET); 2214 __ Jump(code, RelocInfo::CODE_TARGET);
2219 } 2215 }
2220 2216
2221 namespace { 2217 namespace {
2222 2218
2223 // Drops top JavaScript frame and an arguments adaptor frame below it (if 2219 // Drops top JavaScript frame and an arguments adaptor frame below it (if
2224 // present) preserving all the arguments prepared for current call. 2220 // present) preserving all the arguments prepared for current call.
2225 // Does nothing if debugger is currently active. 2221 // Does nothing if debugger is currently active.
2226 // ES6 14.6.3. PrepareForTailCall 2222 // ES6 14.6.3. PrepareForTailCall
2227 // 2223 //
(...skipping 829 matching lines...) Expand 10 before | Expand all | Expand 10 after
3057 } 3053 }
3058 // Now jump to the instructions of the returned code object. 3054 // Now jump to the instructions of the returned code object.
3059 __ Jump(r8); 3055 __ Jump(r8);
3060 } 3056 }
3061 #undef __ 3057 #undef __
3062 3058
3063 } // namespace internal 3059 } // namespace internal
3064 } // namespace v8 3060 } // namespace v8
3065 3061
3066 #endif // V8_TARGET_ARCH_ARM 3062 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm64/interface-descriptors-arm64.cc ('k') | src/builtins/arm64/builtins-arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698