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

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

Issue 2656363002: PPC/s390: [turbofan] Introduce JSCallForwardVarargs operator. (Closed)
Patch Set: Created 3 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
« no previous file with comments | « src/builtins/ppc/builtins-ppc.cc ('k') | src/ppc/interface-descriptors-ppc.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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_S390 5 #if V8_TARGET_ARCH_S390
6 6
7 #include "src/codegen.h" 7 #include "src/codegen.h"
8 #include "src/debug/debug.h" 8 #include "src/debug/debug.h"
9 #include "src/deoptimizer.h" 9 #include "src/deoptimizer.h"
10 #include "src/full-codegen/full-codegen.h" 10 #include "src/full-codegen/full-codegen.h"
(...skipping 2297 matching lines...) Expand 10 before | Expand all | Expand 10 after
2308 } 2308 }
2309 2309
2310 // Dispatch to Call or Construct depending on whether new.target is undefined. 2310 // Dispatch to Call or Construct depending on whether new.target is undefined.
2311 { 2311 {
2312 __ CompareRoot(r5, Heap::kUndefinedValueRootIndex); 2312 __ CompareRoot(r5, Heap::kUndefinedValueRootIndex);
2313 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET, eq); 2313 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET, eq);
2314 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); 2314 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET);
2315 } 2315 }
2316 } 2316 }
2317 2317
2318 // static
2319 void Builtins::Generate_CallForwardVarargs(MacroAssembler* masm,
2320 Handle<Code> code) {
2321 // ----------- S t a t e -------------
2322 // -- r3 : the target to call (can be any Object)
2323 // -- r4 : start index (to support rest parameters)
2324 // -- lr : return address.
2325 // -- sp[0] : thisArgument
2326 // -----------------------------------
2327
2328 // Check if we have an arguments adaptor frame below the function frame.
2329 Label arguments_adaptor, arguments_done;
2330 __ LoadP(r5, MemOperand(fp, StandardFrameConstants::kCallerFPOffset));
2331 __ LoadP(ip, MemOperand(r5, CommonFrameConstants::kContextOrFrameTypeOffset));
2332 __ CmpSmiLiteral(ip, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR), r0);
john.yan 2017/04/26 16:48:19 ip was pointer size (LoadP) here. Maybe try to use
2333 __ beq(&arguments_adaptor);
2334 {
2335 __ LoadP(r2, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
2336 __ LoadP(r2, FieldMemOperand(r2, JSFunction::kSharedFunctionInfoOffset));
2337 __ LoadW(r2, FieldMemOperand(
2338 r2, SharedFunctionInfo::kFormalParameterCountOffset));
2339 __ LoadRR(r5, fp);
2340 }
2341 __ b(&arguments_done);
2342 __ bind(&arguments_adaptor);
2343 {
2344 // Load the length from the ArgumentsAdaptorFrame.
2345 __ LoadP(r2, MemOperand(r5, ArgumentsAdaptorFrameConstants::kLengthOffset));
2346 }
2347 __ bind(&arguments_done);
2348
2349 Label stack_empty, stack_done, stack_overflow;
2350 __ SmiUntag(r2);
2351 __ SubP(r2, r2, r4);
2352 __ CmpP(r2, Operand::Zero());
john.yan 2017/04/26 16:48:19 CmpP isn't necessary here since SubP sets CC impli
2353 __ ble(&stack_empty);
2354 {
2355 // Check for stack overflow.
2356 Generate_StackOverflowCheck(masm, r2, r4, &stack_overflow);
2357
2358 // Forward the arguments from the caller frame.
2359 {
2360 Label loop;
2361 __ AddP(r5, r5, Operand(kPointerSize));
2362 __ LoadRR(r4, r2);
2363 __ bind(&loop);
2364 {
2365 __ ShiftLeftP(ip, r4, Operand(kPointerSizeLog2));
2366 __ LoadP(ip, MemOperand(r5, ip));
2367 __ push(ip);
2368 __ SubP(r4, r4, Operand(1));
2369 __ CmpP(r4, Operand::Zero());
john.yan 2017/04/26 16:48:19 Same as above.
2370 __ bne(&loop);
2371 }
2372 }
2373 }
2374 __ b(&stack_done);
2375 __ bind(&stack_overflow);
2376 __ TailCallRuntime(Runtime::kThrowStackOverflow);
2377 __ bind(&stack_empty);
2378 {
2379 // We just pass the receiver, which is already on the stack.
2380 __ mov(r2, Operand::Zero());
2381 }
2382 __ bind(&stack_done);
2383
2384 __ Jump(code, RelocInfo::CODE_TARGET);
2385 }
2386
2318 namespace { 2387 namespace {
2319 2388
2320 // Drops top JavaScript frame and an arguments adaptor frame below it (if 2389 // Drops top JavaScript frame and an arguments adaptor frame below it (if
2321 // present) preserving all the arguments prepared for current call. 2390 // present) preserving all the arguments prepared for current call.
2322 // Does nothing if debugger is currently active. 2391 // Does nothing if debugger is currently active.
2323 // ES6 14.6.3. PrepareForTailCall 2392 // ES6 14.6.3. PrepareForTailCall
2324 // 2393 //
2325 // Stack structure for the function g() tail calling f(): 2394 // Stack structure for the function g() tail calling f():
2326 // 2395 //
2327 // ------- Caller frame: ------- 2396 // ------- Caller frame: -------
(...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after
3124 __ bkpt(0); 3193 __ bkpt(0);
3125 } 3194 }
3126 } 3195 }
3127 3196
3128 #undef __ 3197 #undef __
3129 3198
3130 } // namespace internal 3199 } // namespace internal
3131 } // namespace v8 3200 } // namespace v8
3132 3201
3133 #endif // V8_TARGET_ARCH_S390 3202 #endif // V8_TARGET_ARCH_S390
OLDNEW
« no previous file with comments | « src/builtins/ppc/builtins-ppc.cc ('k') | src/ppc/interface-descriptors-ppc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698