OLD | NEW |
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_MIPS | 5 #if V8_TARGET_ARCH_MIPS |
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 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 __ bind(&drop_frame_and_ret); | 389 __ bind(&drop_frame_and_ret); |
390 { | 390 { |
391 __ Lsa(sp, sp, t0, kPointerSizeLog2); | 391 __ Lsa(sp, sp, t0, kPointerSizeLog2); |
392 __ DropAndRet(1); | 392 __ DropAndRet(1); |
393 } | 393 } |
394 } | 394 } |
395 | 395 |
396 static void GenerateTailCallToSharedCode(MacroAssembler* masm) { | 396 static void GenerateTailCallToSharedCode(MacroAssembler* masm) { |
397 __ lw(a2, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); | 397 __ lw(a2, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); |
398 __ lw(a2, FieldMemOperand(a2, SharedFunctionInfo::kCodeOffset)); | 398 __ lw(a2, FieldMemOperand(a2, SharedFunctionInfo::kCodeOffset)); |
399 __ Addu(at, a2, Operand(Code::kHeaderSize - kHeapObjectTag)); | 399 __ Jump(at, a2, Code::kHeaderSize - kHeapObjectTag); |
400 __ Jump(at); | |
401 } | 400 } |
402 | 401 |
403 static void GenerateTailCallToReturnedCode(MacroAssembler* masm, | 402 static void GenerateTailCallToReturnedCode(MacroAssembler* masm, |
404 Runtime::FunctionId function_id) { | 403 Runtime::FunctionId function_id) { |
405 // ----------- S t a t e ------------- | 404 // ----------- S t a t e ------------- |
406 // -- a0 : argument count (preserved for callee) | 405 // -- a0 : argument count (preserved for callee) |
407 // -- a1 : target function (preserved for callee) | 406 // -- a1 : target function (preserved for callee) |
408 // -- a3 : new target (preserved for callee) | 407 // -- a3 : new target (preserved for callee) |
409 // ----------------------------------- | 408 // ----------------------------------- |
410 { | 409 { |
411 FrameScope scope(masm, StackFrame::INTERNAL); | 410 FrameScope scope(masm, StackFrame::INTERNAL); |
412 // Push a copy of the target function and the new target. | 411 // Push a copy of the target function and the new target. |
413 // Push function as parameter to the runtime call. | 412 // Push function as parameter to the runtime call. |
414 __ SmiTag(a0); | 413 __ SmiTag(a0); |
415 __ Push(a0, a1, a3, a1); | 414 __ Push(a0, a1, a3, a1); |
416 | 415 |
417 __ CallRuntime(function_id, 1); | 416 __ CallRuntime(function_id, 1); |
418 | 417 |
419 // Restore target function and new target. | 418 // Restore target function and new target. |
420 __ Pop(a0, a1, a3); | 419 __ Pop(a0, a1, a3); |
421 __ SmiUntag(a0); | 420 __ SmiUntag(a0); |
422 } | 421 } |
423 | 422 |
424 __ Addu(at, v0, Operand(Code::kHeaderSize - kHeapObjectTag)); | 423 __ Jump(at, v0, Code::kHeaderSize - kHeapObjectTag); |
425 __ Jump(at); | |
426 } | 424 } |
427 | 425 |
428 void Builtins::Generate_InOptimizationQueue(MacroAssembler* masm) { | 426 void Builtins::Generate_InOptimizationQueue(MacroAssembler* masm) { |
429 // Checking whether the queued function is ready for install is optional, | 427 // Checking whether the queued function is ready for install is optional, |
430 // since we come across interrupts and stack checks elsewhere. However, | 428 // since we come across interrupts and stack checks elsewhere. However, |
431 // not checking may delay installing ready functions, and always checking | 429 // not checking may delay installing ready functions, and always checking |
432 // would be quite expensive. A good compromise is to first check against | 430 // would be quite expensive. A good compromise is to first check against |
433 // stack limit as a cue for an interrupt signal. | 431 // stack limit as a cue for an interrupt signal. |
434 Label ok; | 432 Label ok; |
435 __ LoadRoot(t0, Heap::kStackLimitRootIndex); | 433 __ LoadRoot(t0, Heap::kStackLimitRootIndex); |
(...skipping 748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1184 Generate_InterpreterPushArgs(masm, a0, t4, t1, t0); | 1182 Generate_InterpreterPushArgs(masm, a0, t4, t1, t0); |
1185 | 1183 |
1186 __ AssertUndefinedOrAllocationSite(a2, t0); | 1184 __ AssertUndefinedOrAllocationSite(a2, t0); |
1187 if (mode == InterpreterPushArgsMode::kJSFunction) { | 1185 if (mode == InterpreterPushArgsMode::kJSFunction) { |
1188 __ AssertFunction(a1); | 1186 __ AssertFunction(a1); |
1189 | 1187 |
1190 // Tail call to the function-specific construct stub (still in the caller | 1188 // Tail call to the function-specific construct stub (still in the caller |
1191 // context at this point). | 1189 // context at this point). |
1192 __ lw(t0, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); | 1190 __ lw(t0, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); |
1193 __ lw(t0, FieldMemOperand(t0, SharedFunctionInfo::kConstructStubOffset)); | 1191 __ lw(t0, FieldMemOperand(t0, SharedFunctionInfo::kConstructStubOffset)); |
1194 __ Addu(at, t0, Operand(Code::kHeaderSize - kHeapObjectTag)); | 1192 __ Jump(at, t0, Code::kHeaderSize - kHeapObjectTag); |
1195 __ Jump(at); | |
1196 } else if (mode == InterpreterPushArgsMode::kWithFinalSpread) { | 1193 } else if (mode == InterpreterPushArgsMode::kWithFinalSpread) { |
1197 // Call the constructor with a0, a1, and a3 unmodified. | 1194 // Call the constructor with a0, a1, and a3 unmodified. |
1198 __ Jump(masm->isolate()->builtins()->ConstructWithSpread(), | 1195 __ Jump(masm->isolate()->builtins()->ConstructWithSpread(), |
1199 RelocInfo::CODE_TARGET); | 1196 RelocInfo::CODE_TARGET); |
1200 } else { | 1197 } else { |
1201 DCHECK_EQ(InterpreterPushArgsMode::kOther, mode); | 1198 DCHECK_EQ(InterpreterPushArgsMode::kOther, mode); |
1202 // Call the constructor with a0, a1, and a3 unmodified. | 1199 // Call the constructor with a0, a1, and a3 unmodified. |
1203 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); | 1200 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); |
1204 } | 1201 } |
1205 | 1202 |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1565 __ li(a1, Operand(ExternalReference::isolate_address(masm->isolate()))); | 1562 __ li(a1, Operand(ExternalReference::isolate_address(masm->isolate()))); |
1566 __ CallCFunction( | 1563 __ CallCFunction( |
1567 ExternalReference::get_mark_code_as_executed_function(masm->isolate()), | 1564 ExternalReference::get_mark_code_as_executed_function(masm->isolate()), |
1568 2); | 1565 2); |
1569 __ MultiPop(saved_regs); | 1566 __ MultiPop(saved_regs); |
1570 | 1567 |
1571 // Perform prologue operations usually performed by the young code stub. | 1568 // Perform prologue operations usually performed by the young code stub. |
1572 __ PushStandardFrame(a1); | 1569 __ PushStandardFrame(a1); |
1573 | 1570 |
1574 // Jump to point after the code-age stub. | 1571 // Jump to point after the code-age stub. |
1575 __ Addu(a0, a0, Operand(kNoCodeAgeSequenceLength)); | 1572 __ Jump(a0, kNoCodeAgeSequenceLength); |
1576 __ Jump(a0); | |
1577 } | 1573 } |
1578 | 1574 |
1579 void Builtins::Generate_MarkCodeAsExecutedTwice(MacroAssembler* masm) { | 1575 void Builtins::Generate_MarkCodeAsExecutedTwice(MacroAssembler* masm) { |
1580 GenerateMakeCodeYoungAgainCommon(masm); | 1576 GenerateMakeCodeYoungAgainCommon(masm); |
1581 } | 1577 } |
1582 | 1578 |
1583 void Builtins::Generate_MarkCodeAsToBeExecutedOnce(MacroAssembler* masm) { | 1579 void Builtins::Generate_MarkCodeAsToBeExecutedOnce(MacroAssembler* masm) { |
1584 Generate_MarkCodeAsExecutedOnce(masm); | 1580 Generate_MarkCodeAsExecutedOnce(masm); |
1585 } | 1581 } |
1586 | 1582 |
(...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2485 __ Addu(a0, a0, Operand(1)); | 2481 __ Addu(a0, a0, Operand(1)); |
2486 __ Branch(&loop); | 2482 __ Branch(&loop); |
2487 __ bind(&done_loop); | 2483 __ bind(&done_loop); |
2488 } | 2484 } |
2489 | 2485 |
2490 // Call the [[BoundTargetFunction]] via the Call builtin. | 2486 // Call the [[BoundTargetFunction]] via the Call builtin. |
2491 __ lw(a1, FieldMemOperand(a1, JSBoundFunction::kBoundTargetFunctionOffset)); | 2487 __ lw(a1, FieldMemOperand(a1, JSBoundFunction::kBoundTargetFunctionOffset)); |
2492 __ li(at, Operand(ExternalReference(Builtins::kCall_ReceiverIsAny, | 2488 __ li(at, Operand(ExternalReference(Builtins::kCall_ReceiverIsAny, |
2493 masm->isolate()))); | 2489 masm->isolate()))); |
2494 __ lw(at, MemOperand(at)); | 2490 __ lw(at, MemOperand(at)); |
2495 __ Addu(at, at, Operand(Code::kHeaderSize - kHeapObjectTag)); | 2491 __ Jump(at, Code::kHeaderSize - kHeapObjectTag); |
2496 __ Jump(at); | |
2497 } | 2492 } |
2498 | 2493 |
2499 // static | 2494 // static |
2500 void Builtins::Generate_Call(MacroAssembler* masm, ConvertReceiverMode mode, | 2495 void Builtins::Generate_Call(MacroAssembler* masm, ConvertReceiverMode mode, |
2501 TailCallMode tail_call_mode) { | 2496 TailCallMode tail_call_mode) { |
2502 // ----------- S t a t e ------------- | 2497 // ----------- S t a t e ------------- |
2503 // -- a0 : the number of arguments (not including the receiver) | 2498 // -- a0 : the number of arguments (not including the receiver) |
2504 // -- a1 : the target to call (can be any Object). | 2499 // -- a1 : the target to call (can be any Object). |
2505 // ----------------------------------- | 2500 // ----------------------------------- |
2506 | 2501 |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2710 __ AssertFunction(a1); | 2705 __ AssertFunction(a1); |
2711 | 2706 |
2712 // Calling convention for function specific ConstructStubs require | 2707 // Calling convention for function specific ConstructStubs require |
2713 // a2 to contain either an AllocationSite or undefined. | 2708 // a2 to contain either an AllocationSite or undefined. |
2714 __ LoadRoot(a2, Heap::kUndefinedValueRootIndex); | 2709 __ LoadRoot(a2, Heap::kUndefinedValueRootIndex); |
2715 | 2710 |
2716 // Tail call to the function-specific construct stub (still in the caller | 2711 // Tail call to the function-specific construct stub (still in the caller |
2717 // context at this point). | 2712 // context at this point). |
2718 __ lw(t0, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); | 2713 __ lw(t0, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); |
2719 __ lw(t0, FieldMemOperand(t0, SharedFunctionInfo::kConstructStubOffset)); | 2714 __ lw(t0, FieldMemOperand(t0, SharedFunctionInfo::kConstructStubOffset)); |
2720 __ Addu(at, t0, Operand(Code::kHeaderSize - kHeapObjectTag)); | 2715 __ Jump(at, t0, Code::kHeaderSize - kHeapObjectTag); |
2721 __ Jump(at); | |
2722 } | 2716 } |
2723 | 2717 |
2724 // static | 2718 // static |
2725 void Builtins::Generate_ConstructBoundFunction(MacroAssembler* masm) { | 2719 void Builtins::Generate_ConstructBoundFunction(MacroAssembler* masm) { |
2726 // ----------- S t a t e ------------- | 2720 // ----------- S t a t e ------------- |
2727 // -- a0 : the number of arguments (not including the receiver) | 2721 // -- a0 : the number of arguments (not including the receiver) |
2728 // -- a1 : the function to call (checked to be a JSBoundFunction) | 2722 // -- a1 : the function to call (checked to be a JSBoundFunction) |
2729 // -- a3 : the new target (checked to be a constructor) | 2723 // -- a3 : the new target (checked to be a constructor) |
2730 // ----------------------------------- | 2724 // ----------------------------------- |
2731 __ AssertBoundFunction(a1); | 2725 __ AssertBoundFunction(a1); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2801 Label skip_load; | 2795 Label skip_load; |
2802 __ Branch(&skip_load, ne, a1, Operand(a3)); | 2796 __ Branch(&skip_load, ne, a1, Operand(a3)); |
2803 __ lw(a3, FieldMemOperand(a1, JSBoundFunction::kBoundTargetFunctionOffset)); | 2797 __ lw(a3, FieldMemOperand(a1, JSBoundFunction::kBoundTargetFunctionOffset)); |
2804 __ bind(&skip_load); | 2798 __ bind(&skip_load); |
2805 } | 2799 } |
2806 | 2800 |
2807 // Construct the [[BoundTargetFunction]] via the Construct builtin. | 2801 // Construct the [[BoundTargetFunction]] via the Construct builtin. |
2808 __ lw(a1, FieldMemOperand(a1, JSBoundFunction::kBoundTargetFunctionOffset)); | 2802 __ lw(a1, FieldMemOperand(a1, JSBoundFunction::kBoundTargetFunctionOffset)); |
2809 __ li(at, Operand(ExternalReference(Builtins::kConstruct, masm->isolate()))); | 2803 __ li(at, Operand(ExternalReference(Builtins::kConstruct, masm->isolate()))); |
2810 __ lw(at, MemOperand(at)); | 2804 __ lw(at, MemOperand(at)); |
2811 __ Addu(at, at, Operand(Code::kHeaderSize - kHeapObjectTag)); | 2805 __ Jump(at, Code::kHeaderSize - kHeapObjectTag); |
2812 __ Jump(at); | |
2813 } | 2806 } |
2814 | 2807 |
2815 // static | 2808 // static |
2816 void Builtins::Generate_ConstructProxy(MacroAssembler* masm) { | 2809 void Builtins::Generate_ConstructProxy(MacroAssembler* masm) { |
2817 // ----------- S t a t e ------------- | 2810 // ----------- S t a t e ------------- |
2818 // -- a0 : the number of arguments (not including the receiver) | 2811 // -- a0 : the number of arguments (not including the receiver) |
2819 // -- a1 : the constructor to call (checked to be a JSProxy) | 2812 // -- a1 : the constructor to call (checked to be a JSProxy) |
2820 // -- a3 : the new target (either the same as the constructor or | 2813 // -- a3 : the new target (either the same as the constructor or |
2821 // the JSFunction on which new was invoked initially) | 2814 // the JSFunction on which new was invoked initially) |
2822 // ----------------------------------- | 2815 // ----------------------------------- |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3074 __ MultiPushFPU(fp_regs); | 3067 __ MultiPushFPU(fp_regs); |
3075 | 3068 |
3076 __ Move(kContextRegister, Smi::kZero); | 3069 __ Move(kContextRegister, Smi::kZero); |
3077 __ CallRuntime(Runtime::kWasmCompileLazy); | 3070 __ CallRuntime(Runtime::kWasmCompileLazy); |
3078 | 3071 |
3079 // Restore registers. | 3072 // Restore registers. |
3080 __ MultiPopFPU(fp_regs); | 3073 __ MultiPopFPU(fp_regs); |
3081 __ MultiPop(gp_regs); | 3074 __ MultiPop(gp_regs); |
3082 } | 3075 } |
3083 // Now jump to the instructions of the returned code object. | 3076 // Now jump to the instructions of the returned code object. |
3084 __ Addu(at, v0, Operand(Code::kHeaderSize - kHeapObjectTag)); | 3077 __ Jump(at, v0, Code::kHeaderSize - kHeapObjectTag); |
3085 __ Jump(at); | |
3086 } | 3078 } |
3087 | 3079 |
3088 #undef __ | 3080 #undef __ |
3089 | 3081 |
3090 } // namespace internal | 3082 } // namespace internal |
3091 } // namespace v8 | 3083 } // namespace v8 |
3092 | 3084 |
3093 #endif // V8_TARGET_ARCH_MIPS | 3085 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |