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

Side by Side Diff: src/builtins/arm64/builtins-arm64.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/builtins/arm/builtins-arm.cc ('k') | src/builtins/builtins.h » ('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 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 #if V8_TARGET_ARCH_ARM64 5 #if V8_TARGET_ARCH_ARM64
6 6
7 #include "src/arm64/frames-arm64.h" 7 #include "src/arm64/frames-arm64.h"
8 #include "src/arm64/macro-assembler-arm64-inl.h" 8 #include "src/arm64/macro-assembler-arm64-inl.h"
9 #include "src/codegen.h" 9 #include "src/codegen.h"
10 #include "src/counters.h" 10 #include "src/counters.h"
(...skipping 2268 matching lines...) Expand 10 before | Expand all | Expand 10 after
2279 2279
2280 // Dispatch to Call or Construct depending on whether new.target is undefined. 2280 // Dispatch to Call or Construct depending on whether new.target is undefined.
2281 { 2281 {
2282 __ CompareRoot(new_target, Heap::kUndefinedValueRootIndex); 2282 __ CompareRoot(new_target, Heap::kUndefinedValueRootIndex);
2283 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET, eq); 2283 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET, eq);
2284 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); 2284 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET);
2285 } 2285 }
2286 } 2286 }
2287 2287
2288 // static 2288 // static
2289 void Builtins::Generate_CallForwardVarargs(MacroAssembler* masm, 2289 void Builtins::Generate_ForwardVarargs(MacroAssembler* masm,
2290 Handle<Code> code) { 2290 Handle<Code> code) {
2291 // ----------- S t a t e ------------- 2291 // ----------- S t a t e -------------
2292 // -- x1 : the target to call (can be any Object) 2292 // -- x0 : the number of arguments (not including the receiver)
2293 // -- x2 : start index (to support rest parameters) 2293 // -- x3 : the new.target (for [[Construct]] calls)
2294 // -- lr : return address. 2294 // -- x1 : the target to call (can be any Object)
2295 // -- sp[0] : thisArgument 2295 // -- x2 : start index (to support rest parameters)
2296 // ----------------------------------- 2296 // -----------------------------------
2297 2297
2298 // Check if we have an arguments adaptor frame below the function frame. 2298 // Check if we have an arguments adaptor frame below the function frame.
2299 Label arguments_adaptor, arguments_done; 2299 Label arguments_adaptor, arguments_done;
2300 __ Ldr(x3, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); 2300 __ Ldr(x5, MemOperand(fp, StandardFrameConstants::kCallerFPOffset));
2301 __ Ldr(x4, MemOperand(x3, CommonFrameConstants::kContextOrFrameTypeOffset)); 2301 __ Ldr(x4, MemOperand(x5, CommonFrameConstants::kContextOrFrameTypeOffset));
2302 __ Cmp(x4, StackFrame::TypeToMarker(StackFrame::ARGUMENTS_ADAPTOR)); 2302 __ Cmp(x4, StackFrame::TypeToMarker(StackFrame::ARGUMENTS_ADAPTOR));
2303 __ B(eq, &arguments_adaptor); 2303 __ B(eq, &arguments_adaptor);
2304 { 2304 {
2305 __ Ldr(x0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); 2305 __ Ldr(x6, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
2306 __ Ldr(x0, FieldMemOperand(x0, JSFunction::kSharedFunctionInfoOffset)); 2306 __ Ldr(x6, FieldMemOperand(x6, JSFunction::kSharedFunctionInfoOffset));
2307 __ Ldrsw(x0, FieldMemOperand( 2307 __ Ldrsw(x6, FieldMemOperand(
2308 x0, SharedFunctionInfo::kFormalParameterCountOffset)); 2308 x6, SharedFunctionInfo::kFormalParameterCountOffset));
2309 __ Mov(x3, fp); 2309 __ Mov(x5, fp);
2310 } 2310 }
2311 __ B(&arguments_done); 2311 __ B(&arguments_done);
2312 __ Bind(&arguments_adaptor); 2312 __ Bind(&arguments_adaptor);
2313 { 2313 {
2314 // Just load the length from ArgumentsAdaptorFrame. 2314 // Just load the length from ArgumentsAdaptorFrame.
2315 __ Ldrsw(x0, UntagSmiMemOperand( 2315 __ Ldrsw(x6, UntagSmiMemOperand(
2316 x3, ArgumentsAdaptorFrameConstants::kLengthOffset)); 2316 x5, ArgumentsAdaptorFrameConstants::kLengthOffset));
2317 } 2317 }
2318 __ Bind(&arguments_done); 2318 __ Bind(&arguments_done);
2319 2319
2320 Label stack_empty, stack_done, stack_overflow; 2320 Label stack_done, stack_overflow;
2321 __ Subs(x0, x0, x2); 2321 __ Subs(x6, x6, x2);
2322 __ B(le, &stack_empty); 2322 __ B(le, &stack_done);
2323 { 2323 {
2324 // Check for stack overflow. 2324 // Check for stack overflow.
2325 Generate_StackOverflowCheck(masm, x0, x2, &stack_overflow); 2325 Generate_StackOverflowCheck(masm, x6, x2, &stack_overflow);
2326 2326
2327 // Forward the arguments from the caller frame. 2327 // Forward the arguments from the caller frame.
2328 { 2328 {
2329 Label loop; 2329 Label loop;
2330 __ Add(x3, x3, kPointerSize); 2330 __ Add(x5, x5, kPointerSize);
2331 __ Mov(x2, x0); 2331 __ Add(x0, x0, x6);
2332 __ bind(&loop); 2332 __ bind(&loop);
2333 { 2333 {
2334 __ Ldr(x4, MemOperand(x3, x2, LSL, kPointerSizeLog2)); 2334 __ Ldr(x4, MemOperand(x5, x6, LSL, kPointerSizeLog2));
2335 __ Push(x4); 2335 __ Push(x4);
2336 __ Subs(x2, x2, 1); 2336 __ Subs(x6, x6, 1);
2337 __ B(ne, &loop); 2337 __ B(ne, &loop);
2338 } 2338 }
2339 } 2339 }
2340 } 2340 }
2341 __ B(&stack_done); 2341 __ B(&stack_done);
2342 __ Bind(&stack_overflow); 2342 __ Bind(&stack_overflow);
2343 __ TailCallRuntime(Runtime::kThrowStackOverflow); 2343 __ TailCallRuntime(Runtime::kThrowStackOverflow);
2344 __ Bind(&stack_empty);
2345 {
2346 // We just pass the receiver, which is already on the stack.
2347 __ Mov(x0, 0);
2348 }
2349 __ Bind(&stack_done); 2344 __ Bind(&stack_done);
2350 2345
2351 __ Jump(code, RelocInfo::CODE_TARGET); 2346 __ Jump(code, RelocInfo::CODE_TARGET);
2352 } 2347 }
2353 2348
2354 namespace { 2349 namespace {
2355 2350
2356 // Drops top JavaScript frame and an arguments adaptor frame below it (if 2351 // Drops top JavaScript frame and an arguments adaptor frame below it (if
2357 // present) preserving all the arguments prepared for current call. 2352 // present) preserving all the arguments prepared for current call.
2358 // Does nothing if debugger is currently active. 2353 // Does nothing if debugger is currently active.
(...skipping 860 matching lines...) Expand 10 before | Expand all | Expand 10 after
3219 // Now jump to the instructions of the returned code object. 3214 // Now jump to the instructions of the returned code object.
3220 __ Jump(x8); 3215 __ Jump(x8);
3221 } 3216 }
3222 3217
3223 #undef __ 3218 #undef __
3224 3219
3225 } // namespace internal 3220 } // namespace internal
3226 } // namespace v8 3221 } // namespace v8
3227 3222
3228 #endif // V8_TARGET_ARCH_ARM 3223 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/builtins/arm/builtins-arm.cc ('k') | src/builtins/builtins.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698