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

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

Issue 1469283004: PPC: [turbofan] Switch passing of new.target to register. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years 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/crankshaft/ppc/lithium-codegen-ppc.cc ('k') | src/ppc/macro-assembler-ppc.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 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_PPC 5 #if V8_TARGET_ARCH_PPC
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 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 __ CallRuntime(Runtime::kNewObject, 2); 298 __ CallRuntime(Runtime::kNewObject, 2);
299 __ Pop(r5); 299 __ Pop(r5);
300 } 300 }
301 __ StoreP(r5, FieldMemOperand(r3, JSValue::kValueOffset), r0); 301 __ StoreP(r5, FieldMemOperand(r3, JSValue::kValueOffset), r0);
302 __ Ret(); 302 __ Ret();
303 } 303 }
304 304
305 305
306 static void CallRuntimePassFunction(MacroAssembler* masm, 306 static void CallRuntimePassFunction(MacroAssembler* masm,
307 Runtime::FunctionId function_id) { 307 Runtime::FunctionId function_id) {
308 // ----------- S t a t e -------------
309 // -- r4 : target function (preserved for callee)
310 // -- r6 : new target (preserved for callee)
311 // -----------------------------------
312
308 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); 313 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL);
309 // Push a copy of the function onto the stack. 314 // Push a copy of the target function and the new target.
310 // Push function as parameter to the runtime call. 315 // Push function as parameter to the runtime call.
311 __ Push(r4, r4); 316 __ Push(r4, r6, r4);
312 317
313 __ CallRuntime(function_id, 1); 318 __ CallRuntime(function_id, 1);
314 // Restore reciever. 319 // Restore target function and new target.
315 __ Pop(r4); 320 __ Pop(r4, r6);
316 } 321 }
317 322
318 323
319 static void GenerateTailCallToSharedCode(MacroAssembler* masm) { 324 static void GenerateTailCallToSharedCode(MacroAssembler* masm) {
320 __ LoadP(ip, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset)); 325 __ LoadP(ip, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset));
321 __ LoadP(ip, FieldMemOperand(ip, SharedFunctionInfo::kCodeOffset)); 326 __ LoadP(ip, FieldMemOperand(ip, SharedFunctionInfo::kCodeOffset));
322 __ addi(ip, ip, Operand(Code::kHeaderSize - kHeapObjectTag)); 327 __ addi(ip, ip, Operand(Code::kHeaderSize - kHeapObjectTag));
323 __ JumpToJSEntry(ip); 328 __ JumpToJSEntry(ip);
324 } 329 }
325 330
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 __ Push(r6, r7, r7); 532 __ Push(r6, r7, r7);
528 } 533 }
529 534
530 // Set up pointer to last argument. 535 // Set up pointer to last argument.
531 __ addi(r5, fp, Operand(StandardFrameConstants::kCallerSPOffset)); 536 __ addi(r5, fp, Operand(StandardFrameConstants::kCallerSPOffset));
532 537
533 // Copy arguments and receiver to the expression stack. 538 // Copy arguments and receiver to the expression stack.
534 // r3: number of arguments 539 // r3: number of arguments
535 // r4: constructor function 540 // r4: constructor function
536 // r5: address of last argument (caller sp) 541 // r5: address of last argument (caller sp)
542 // r6: new target
537 // cr0: condition indicating whether r3 is zero 543 // cr0: condition indicating whether r3 is zero
538 // sp[0]: receiver 544 // sp[0]: receiver
539 // sp[1]: receiver 545 // sp[1]: receiver
540 // sp[2]: new.target 546 // sp[2]: new.target
541 // sp[3]: number of arguments (smi-tagged) 547 // sp[3]: number of arguments (smi-tagged)
542 Label loop, no_args; 548 Label loop, no_args;
543 __ beq(&no_args, cr0); 549 __ beq(&no_args, cr0);
544 __ ShiftLeftImm(ip, r3, Operand(kPointerSizeLog2)); 550 __ ShiftLeftImm(ip, r3, Operand(kPointerSizeLog2));
545 __ sub(sp, sp, ip); 551 __ sub(sp, sp, ip);
546 __ mtctr(r3); 552 __ mtctr(r3);
547 __ bind(&loop); 553 __ bind(&loop);
548 __ subi(ip, ip, Operand(kPointerSize)); 554 __ subi(ip, ip, Operand(kPointerSize));
549 __ LoadPX(r0, MemOperand(r5, ip)); 555 __ LoadPX(r0, MemOperand(r5, ip));
550 __ StorePX(r0, MemOperand(sp, ip)); 556 __ StorePX(r0, MemOperand(sp, ip));
551 __ bdnz(&loop); 557 __ bdnz(&loop);
552 __ bind(&no_args); 558 __ bind(&no_args);
553 559
554 // Call the function. 560 // Call the function.
555 // r3: number of arguments 561 // r3: number of arguments
556 // r4: constructor function 562 // r4: constructor function
563 // r6: new target
557 if (is_api_function) { 564 if (is_api_function) {
558 __ LoadP(cp, FieldMemOperand(r4, JSFunction::kContextOffset)); 565 __ LoadP(cp, FieldMemOperand(r4, JSFunction::kContextOffset));
559 Handle<Code> code = masm->isolate()->builtins()->HandleApiCallConstruct(); 566 Handle<Code> code = masm->isolate()->builtins()->HandleApiCallConstruct();
560 __ Call(code, RelocInfo::CODE_TARGET); 567 __ Call(code, RelocInfo::CODE_TARGET);
561 } else { 568 } else {
562 ParameterCount actual(r3); 569 ParameterCount actual(r3);
563 __ InvokeFunction(r4, actual, CALL_FUNCTION, NullCallWrapper()); 570 __ InvokeFunction(r4, r6, actual, CALL_FUNCTION, NullCallWrapper());
564 } 571 }
565 572
566 // Store offset of return address for deoptimizer. 573 // Store offset of return address for deoptimizer.
567 if (create_implicit_receiver && !is_api_function) { 574 if (create_implicit_receiver && !is_api_function) {
568 masm->isolate()->heap()->SetConstructStubDeoptPCOffset(masm->pc_offset()); 575 masm->isolate()->heap()->SetConstructStubDeoptPCOffset(masm->pc_offset());
569 } 576 }
570 577
571 // Restore context from the frame. 578 // Restore context from the frame.
572 // r3: result 579 // r3: result
573 // sp[0]: receiver 580 // sp[0]: receiver
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
972 // internal frame to make the code faster, since we shouldn't have to do stack 979 // internal frame to make the code faster, since we shouldn't have to do stack
973 // crawls in MakeCodeYoung. This seems a bit fragile. 980 // crawls in MakeCodeYoung. This seems a bit fragile.
974 981
975 // Point r3 at the start of the PlatformCodeAge sequence. 982 // Point r3 at the start of the PlatformCodeAge sequence.
976 __ mr(r3, ip); 983 __ mr(r3, ip);
977 984
978 // The following registers must be saved and restored when calling through to 985 // The following registers must be saved and restored when calling through to
979 // the runtime: 986 // the runtime:
980 // r3 - contains return address (beginning of patch sequence) 987 // r3 - contains return address (beginning of patch sequence)
981 // r4 - isolate 988 // r4 - isolate
989 // r6 - new target
982 // lr - return address 990 // lr - return address
983 FrameScope scope(masm, StackFrame::MANUAL); 991 FrameScope scope(masm, StackFrame::MANUAL);
984 __ mflr(r0); 992 __ mflr(r0);
985 __ MultiPush(r0.bit() | r3.bit() | r4.bit() | fp.bit()); 993 __ MultiPush(r0.bit() | r3.bit() | r4.bit() | r6.bit() | fp.bit());
986 __ PrepareCallCFunction(2, 0, r5); 994 __ PrepareCallCFunction(2, 0, r5);
987 __ mov(r4, Operand(ExternalReference::isolate_address(masm->isolate()))); 995 __ mov(r4, Operand(ExternalReference::isolate_address(masm->isolate())));
988 __ CallCFunction( 996 __ CallCFunction(
989 ExternalReference::get_make_code_young_function(masm->isolate()), 2); 997 ExternalReference::get_make_code_young_function(masm->isolate()), 2);
990 __ MultiPop(r0.bit() | r3.bit() | r4.bit() | fp.bit()); 998 __ MultiPop(r0.bit() | r3.bit() | r4.bit() | r6.bit() | fp.bit());
991 __ mtlr(r0); 999 __ mtlr(r0);
992 __ mr(ip, r3); 1000 __ mr(ip, r3);
993 __ Jump(ip); 1001 __ Jump(ip);
994 } 1002 }
995 1003
996 #define DEFINE_CODE_AGE_BUILTIN_GENERATOR(C) \ 1004 #define DEFINE_CODE_AGE_BUILTIN_GENERATOR(C) \
997 void Builtins::Generate_Make##C##CodeYoungAgainEvenMarking( \ 1005 void Builtins::Generate_Make##C##CodeYoungAgainEvenMarking( \
998 MacroAssembler* masm) { \ 1006 MacroAssembler* masm) { \
999 GenerateMakeCodeYoungAgainCommon(masm); \ 1007 GenerateMakeCodeYoungAgainCommon(masm); \
1000 } \ 1008 } \
(...skipping 12 matching lines...) Expand all
1013 // internal frame to make the code faster, since we shouldn't have to do stack 1021 // internal frame to make the code faster, since we shouldn't have to do stack
1014 // crawls in MakeCodeYoung. This seems a bit fragile. 1022 // crawls in MakeCodeYoung. This seems a bit fragile.
1015 1023
1016 // Point r3 at the start of the PlatformCodeAge sequence. 1024 // Point r3 at the start of the PlatformCodeAge sequence.
1017 __ mr(r3, ip); 1025 __ mr(r3, ip);
1018 1026
1019 // The following registers must be saved and restored when calling through to 1027 // The following registers must be saved and restored when calling through to
1020 // the runtime: 1028 // the runtime:
1021 // r3 - contains return address (beginning of patch sequence) 1029 // r3 - contains return address (beginning of patch sequence)
1022 // r4 - isolate 1030 // r4 - isolate
1031 // r6 - new target
1023 // lr - return address 1032 // lr - return address
1024 FrameScope scope(masm, StackFrame::MANUAL); 1033 FrameScope scope(masm, StackFrame::MANUAL);
1025 __ mflr(r0); 1034 __ mflr(r0);
1026 __ MultiPush(r0.bit() | r3.bit() | r4.bit() | fp.bit()); 1035 __ MultiPush(r0.bit() | r3.bit() | r4.bit() | r6.bit() | fp.bit());
1027 __ PrepareCallCFunction(2, 0, r5); 1036 __ PrepareCallCFunction(2, 0, r5);
1028 __ mov(r4, Operand(ExternalReference::isolate_address(masm->isolate()))); 1037 __ mov(r4, Operand(ExternalReference::isolate_address(masm->isolate())));
1029 __ CallCFunction( 1038 __ CallCFunction(
1030 ExternalReference::get_mark_code_as_executed_function(masm->isolate()), 1039 ExternalReference::get_mark_code_as_executed_function(masm->isolate()),
1031 2); 1040 2);
1032 __ MultiPop(r0.bit() | r3.bit() | r4.bit() | fp.bit()); 1041 __ MultiPop(r0.bit() | r3.bit() | r4.bit() | r6.bit() | fp.bit());
1033 __ mtlr(r0); 1042 __ mtlr(r0);
1034 __ mr(ip, r3); 1043 __ mr(ip, r3);
1035 1044
1036 // Perform prologue operations usually performed by the young code stub. 1045 // Perform prologue operations usually performed by the young code stub.
1037 __ PushFixedFrame(r4); 1046 __ PushFixedFrame(r4);
1038 __ addi(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp)); 1047 __ addi(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp));
1039 1048
1040 // Jump to point after the code-age stub. 1049 // Jump to point after the code-age stub.
1041 __ addi(r3, ip, Operand(kNoCodeAgeSequenceLength)); 1050 __ addi(r3, ip, Operand(kNoCodeAgeSequenceLength));
1042 __ Jump(r3); 1051 __ Jump(r3);
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after
1681 // -- r4 : the function to call (checked to be a JSFunction) 1690 // -- r4 : the function to call (checked to be a JSFunction)
1682 // -- r5 : the shared function info. 1691 // -- r5 : the shared function info.
1683 // -- cp : the function context. 1692 // -- cp : the function context.
1684 // ----------------------------------- 1693 // -----------------------------------
1685 1694
1686 __ LoadWordArith( 1695 __ LoadWordArith(
1687 r5, FieldMemOperand(r5, SharedFunctionInfo::kFormalParameterCountOffset)); 1696 r5, FieldMemOperand(r5, SharedFunctionInfo::kFormalParameterCountOffset));
1688 #if !V8_TARGET_ARCH_PPC64 1697 #if !V8_TARGET_ARCH_PPC64
1689 __ SmiUntag(r5); 1698 __ SmiUntag(r5);
1690 #endif 1699 #endif
1691 __ LoadP(r6, FieldMemOperand(r4, JSFunction::kCodeEntryOffset)); 1700 __ LoadP(r7, FieldMemOperand(r4, JSFunction::kCodeEntryOffset));
1692 ParameterCount actual(r3); 1701 ParameterCount actual(r3);
1693 ParameterCount expected(r5); 1702 ParameterCount expected(r5);
1694 __ InvokeCode(r6, expected, actual, JUMP_FUNCTION, NullCallWrapper()); 1703 __ InvokeCode(r7, no_reg, expected, actual, JUMP_FUNCTION, NullCallWrapper());
1695 1704
1696 // The function is a "classConstructor", need to raise an exception. 1705 // The function is a "classConstructor", need to raise an exception.
1697 __ bind(&class_constructor); 1706 __ bind(&class_constructor);
1698 { 1707 {
1699 FrameAndConstantPoolScope frame(masm, StackFrame::INTERNAL); 1708 FrameAndConstantPoolScope frame(masm, StackFrame::INTERNAL);
1700 __ CallRuntime(Runtime::kThrowConstructorNonCallableError, 0); 1709 __ CallRuntime(Runtime::kThrowConstructorNonCallableError, 0);
1701 } 1710 }
1702 } 1711 }
1703 1712
1704 1713
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
1993 __ bkpt(0); 2002 __ bkpt(0);
1994 } 2003 }
1995 } 2004 }
1996 2005
1997 2006
1998 #undef __ 2007 #undef __
1999 } // namespace internal 2008 } // namespace internal
2000 } // namespace v8 2009 } // namespace v8
2001 2010
2002 #endif // V8_TARGET_ARCH_PPC 2011 #endif // V8_TARGET_ARCH_PPC
OLDNEW
« no previous file with comments | « src/crankshaft/ppc/lithium-codegen-ppc.cc ('k') | src/ppc/macro-assembler-ppc.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698