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

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

Issue 1460503008: [turbofan] Switch passing of new.target to register. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@local_turbofan-pass-new-target-6
Patch Set: Ported to MIPS64. 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/mips/macro-assembler-mips.cc ('k') | src/mips64/macro-assembler-mips64.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 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_MIPS64 5 #if V8_TARGET_ARCH_MIPS64
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 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 __ CallRuntime(Runtime::kNewObject, 2); 297 __ CallRuntime(Runtime::kNewObject, 2);
298 __ Pop(a0); 298 __ Pop(a0);
299 } 299 }
300 __ sd(a0, FieldMemOperand(v0, JSValue::kValueOffset)); 300 __ sd(a0, FieldMemOperand(v0, JSValue::kValueOffset));
301 __ Ret(); 301 __ Ret();
302 } 302 }
303 303
304 304
305 static void CallRuntimePassFunction( 305 static void CallRuntimePassFunction(
306 MacroAssembler* masm, Runtime::FunctionId function_id) { 306 MacroAssembler* masm, Runtime::FunctionId function_id) {
307 // ----------- S t a t e -------------
308 // -- a1 : target function (preserved for callee)
309 // -- a3 : new target (preserved for callee)
310 // -----------------------------------
311
307 FrameScope scope(masm, StackFrame::INTERNAL); 312 FrameScope scope(masm, StackFrame::INTERNAL);
308 // Push a copy of the function onto the stack. 313 // Push a copy of the function onto the stack.
309 // Push call kind information and function as parameter to the runtime call. 314 // Push a copy of the target function and the new target.
310 __ Push(a1, a1); 315 __ Push(a1, a3, a1);
311 316
312 __ CallRuntime(function_id, 1); 317 __ CallRuntime(function_id, 1);
313 // Restore call kind information and receiver. 318 // Restore target function and new target.
314 __ Pop(a1); 319 __ Pop(a1, a3);
315 } 320 }
316 321
317 322
318 static void GenerateTailCallToSharedCode(MacroAssembler* masm) { 323 static void GenerateTailCallToSharedCode(MacroAssembler* masm) {
319 __ ld(a2, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); 324 __ ld(a2, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset));
320 __ ld(a2, FieldMemOperand(a2, SharedFunctionInfo::kCodeOffset)); 325 __ ld(a2, FieldMemOperand(a2, SharedFunctionInfo::kCodeOffset));
321 __ Daddu(at, a2, Operand(Code::kHeaderSize - kHeapObjectTag)); 326 __ Daddu(at, a2, Operand(Code::kHeaderSize - kHeapObjectTag));
322 __ Jump(at); 327 __ Jump(at);
323 } 328 }
324 329
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 __ PushRoot(Heap::kTheHoleValueRootIndex); 544 __ PushRoot(Heap::kTheHoleValueRootIndex);
540 } 545 }
541 546
542 // Set up pointer to last argument. 547 // Set up pointer to last argument.
543 __ Daddu(a2, fp, Operand(StandardFrameConstants::kCallerSPOffset)); 548 __ Daddu(a2, fp, Operand(StandardFrameConstants::kCallerSPOffset));
544 549
545 // Copy arguments and receiver to the expression stack. 550 // Copy arguments and receiver to the expression stack.
546 // a0: number of arguments 551 // a0: number of arguments
547 // a1: constructor function 552 // a1: constructor function
548 // a2: address of last argument (caller sp) 553 // a2: address of last argument (caller sp)
549 // a3: number of arguments (smi-tagged) 554 // a3: new target
555 // t0: number of arguments (smi-tagged)
550 // sp[0]: receiver 556 // sp[0]: receiver
551 // sp[1]: receiver 557 // sp[1]: receiver
552 // sp[2]: new.target 558 // sp[2]: new.target
553 // sp[3]: number of arguments (smi-tagged) 559 // sp[3]: number of arguments (smi-tagged)
554 Label loop, entry; 560 Label loop, entry;
555 __ mov(a3, a0); 561 __ mov(t0, a0);
556 __ jmp(&entry); 562 __ jmp(&entry);
557 __ bind(&loop); 563 __ bind(&loop);
558 __ dsll(a4, a3, kPointerSizeLog2); 564 __ dsll(a4, t0, kPointerSizeLog2);
559 __ Daddu(a4, a2, Operand(a4)); 565 __ Daddu(a4, a2, Operand(a4));
560 __ ld(a5, MemOperand(a4)); 566 __ ld(a5, MemOperand(a4));
561 __ push(a5); 567 __ push(a5);
562 __ bind(&entry); 568 __ bind(&entry);
563 __ Daddu(a3, a3, Operand(-1)); 569 __ Daddu(t0, t0, Operand(-1));
564 __ Branch(&loop, greater_equal, a3, Operand(zero_reg)); 570 __ Branch(&loop, greater_equal, t0, Operand(zero_reg));
565 571
566 // Call the function. 572 // Call the function.
567 // a0: number of arguments 573 // a0: number of arguments
568 // a1: constructor function 574 // a1: constructor function
575 // a3: new target
569 if (is_api_function) { 576 if (is_api_function) {
570 __ ld(cp, FieldMemOperand(a1, JSFunction::kContextOffset)); 577 __ ld(cp, FieldMemOperand(a1, JSFunction::kContextOffset));
571 Handle<Code> code = 578 Handle<Code> code =
572 masm->isolate()->builtins()->HandleApiCallConstruct(); 579 masm->isolate()->builtins()->HandleApiCallConstruct();
573 __ Call(code, RelocInfo::CODE_TARGET); 580 __ Call(code, RelocInfo::CODE_TARGET);
574 } else { 581 } else {
575 ParameterCount actual(a0); 582 ParameterCount actual(a0);
576 __ InvokeFunction(a1, actual, CALL_FUNCTION, NullCallWrapper()); 583 __ InvokeFunction(a1, a3, actual, CALL_FUNCTION, NullCallWrapper());
577 } 584 }
578 585
579 // Store offset of return address for deoptimizer. 586 // Store offset of return address for deoptimizer.
580 if (create_implicit_receiver && !is_api_function) { 587 if (create_implicit_receiver && !is_api_function) {
581 masm->isolate()->heap()->SetConstructStubDeoptPCOffset(masm->pc_offset()); 588 masm->isolate()->heap()->SetConstructStubDeoptPCOffset(masm->pc_offset());
582 } 589 }
583 590
584 // Restore context from the frame. 591 // Restore context from the frame.
585 __ ld(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 592 __ ld(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
586 593
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
986 // crawls in MakeCodeYoung. This seems a bit fragile. 993 // crawls in MakeCodeYoung. This seems a bit fragile.
987 994
988 // Set a0 to point to the head of the PlatformCodeAge sequence. 995 // Set a0 to point to the head of the PlatformCodeAge sequence.
989 __ Dsubu(a0, a0, 996 __ Dsubu(a0, a0,
990 Operand(kNoCodeAgeSequenceLength - Assembler::kInstrSize)); 997 Operand(kNoCodeAgeSequenceLength - Assembler::kInstrSize));
991 998
992 // The following registers must be saved and restored when calling through to 999 // The following registers must be saved and restored when calling through to
993 // the runtime: 1000 // the runtime:
994 // a0 - contains return address (beginning of patch sequence) 1001 // a0 - contains return address (beginning of patch sequence)
995 // a1 - isolate 1002 // a1 - isolate
1003 // a3 - new target
996 RegList saved_regs = 1004 RegList saved_regs =
997 (a0.bit() | a1.bit() | ra.bit() | fp.bit()) & ~sp.bit(); 1005 (a0.bit() | a1.bit() | a3.bit() | ra.bit() | fp.bit()) & ~sp.bit();
998 FrameScope scope(masm, StackFrame::MANUAL); 1006 FrameScope scope(masm, StackFrame::MANUAL);
999 __ MultiPush(saved_regs); 1007 __ MultiPush(saved_regs);
1000 __ PrepareCallCFunction(2, 0, a2); 1008 __ PrepareCallCFunction(2, 0, a2);
1001 __ li(a1, Operand(ExternalReference::isolate_address(masm->isolate()))); 1009 __ li(a1, Operand(ExternalReference::isolate_address(masm->isolate())));
1002 __ CallCFunction( 1010 __ CallCFunction(
1003 ExternalReference::get_make_code_young_function(masm->isolate()), 2); 1011 ExternalReference::get_make_code_young_function(masm->isolate()), 2);
1004 __ MultiPop(saved_regs); 1012 __ MultiPop(saved_regs);
1005 __ Jump(a0); 1013 __ Jump(a0);
1006 } 1014 }
1007 1015
(...skipping 17 matching lines...) Expand all
1025 // pointers. 1033 // pointers.
1026 1034
1027 // Set a0 to point to the head of the PlatformCodeAge sequence. 1035 // Set a0 to point to the head of the PlatformCodeAge sequence.
1028 __ Dsubu(a0, a0, 1036 __ Dsubu(a0, a0,
1029 Operand(kNoCodeAgeSequenceLength - Assembler::kInstrSize)); 1037 Operand(kNoCodeAgeSequenceLength - Assembler::kInstrSize));
1030 1038
1031 // The following registers must be saved and restored when calling through to 1039 // The following registers must be saved and restored when calling through to
1032 // the runtime: 1040 // the runtime:
1033 // a0 - contains return address (beginning of patch sequence) 1041 // a0 - contains return address (beginning of patch sequence)
1034 // a1 - isolate 1042 // a1 - isolate
1043 // a3 - new target
1035 RegList saved_regs = 1044 RegList saved_regs =
1036 (a0.bit() | a1.bit() | ra.bit() | fp.bit()) & ~sp.bit(); 1045 (a0.bit() | a1.bit() | a3.bit() | ra.bit() | fp.bit()) & ~sp.bit();
1037 FrameScope scope(masm, StackFrame::MANUAL); 1046 FrameScope scope(masm, StackFrame::MANUAL);
1038 __ MultiPush(saved_regs); 1047 __ MultiPush(saved_regs);
1039 __ PrepareCallCFunction(2, 0, a2); 1048 __ PrepareCallCFunction(2, 0, a2);
1040 __ li(a1, Operand(ExternalReference::isolate_address(masm->isolate()))); 1049 __ li(a1, Operand(ExternalReference::isolate_address(masm->isolate())));
1041 __ CallCFunction( 1050 __ CallCFunction(
1042 ExternalReference::get_mark_code_as_executed_function(masm->isolate()), 1051 ExternalReference::get_mark_code_as_executed_function(masm->isolate()),
1043 2); 1052 2);
1044 __ MultiPop(saved_regs); 1053 __ MultiPop(saved_regs);
1045 1054
1046 // Perform prologue operations usually performed by the young code stub. 1055 // Perform prologue operations usually performed by the young code stub.
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after
1559 1568
1560 // ----------- S t a t e ------------- 1569 // ----------- S t a t e -------------
1561 // -- a0 : the number of arguments (not including the receiver) 1570 // -- a0 : the number of arguments (not including the receiver)
1562 // -- a1 : the function to call (checked to be a JSFunction) 1571 // -- a1 : the function to call (checked to be a JSFunction)
1563 // -- a2 : the shared function info. 1572 // -- a2 : the shared function info.
1564 // -- cp : the function context. 1573 // -- cp : the function context.
1565 // ----------------------------------- 1574 // -----------------------------------
1566 1575
1567 __ lw(a2, 1576 __ lw(a2,
1568 FieldMemOperand(a2, SharedFunctionInfo::kFormalParameterCountOffset)); 1577 FieldMemOperand(a2, SharedFunctionInfo::kFormalParameterCountOffset));
1569 __ ld(a3, FieldMemOperand(a1, JSFunction::kCodeEntryOffset)); 1578 __ ld(t0, FieldMemOperand(a1, JSFunction::kCodeEntryOffset));
1570 ParameterCount actual(a0); 1579 ParameterCount actual(a0);
1571 ParameterCount expected(a2); 1580 ParameterCount expected(a2);
1572 __ InvokeCode(a3, expected, actual, JUMP_FUNCTION, NullCallWrapper()); 1581 __ InvokeCode(t0, no_reg, expected, actual, JUMP_FUNCTION, NullCallWrapper());
1573 1582
1574 // The function is a "classConstructor", need to raise an exception. 1583 // The function is a "classConstructor", need to raise an exception.
1575 __ bind(&class_constructor); 1584 __ bind(&class_constructor);
1576 { 1585 {
1577 FrameScope frame(masm, StackFrame::INTERNAL); 1586 FrameScope frame(masm, StackFrame::INTERNAL);
1578 __ CallRuntime(Runtime::kThrowConstructorNonCallableError, 0); 1587 __ CallRuntime(Runtime::kThrowConstructorNonCallableError, 0);
1579 } 1588 }
1580 } 1589 }
1581 1590
1582 1591
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
1868 } 1877 }
1869 } 1878 }
1870 1879
1871 1880
1872 #undef __ 1881 #undef __
1873 1882
1874 } // namespace internal 1883 } // namespace internal
1875 } // namespace v8 1884 } // namespace v8
1876 1885
1877 #endif // V8_TARGET_ARCH_MIPS64 1886 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « src/mips/macro-assembler-mips.cc ('k') | src/mips64/macro-assembler-mips64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698