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_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 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
683 void Builtins::Generate_JSBuiltinsConstructStub(MacroAssembler* masm) { | 683 void Builtins::Generate_JSBuiltinsConstructStub(MacroAssembler* masm) { |
684 Generate_JSConstructStubHelper(masm, false, false, false); | 684 Generate_JSConstructStubHelper(masm, false, false, false); |
685 } | 685 } |
686 | 686 |
687 | 687 |
688 void Builtins::Generate_JSBuiltinsConstructStubForDerived( | 688 void Builtins::Generate_JSBuiltinsConstructStubForDerived( |
689 MacroAssembler* masm) { | 689 MacroAssembler* masm) { |
690 Generate_JSConstructStubHelper(masm, false, false, true); | 690 Generate_JSConstructStubHelper(masm, false, false, true); |
691 } | 691 } |
692 | 692 |
| 693 // static |
| 694 void Builtins::Generate_ResumeGeneratorTrampoline(MacroAssembler* masm) { |
| 695 // ----------- S t a t e ------------- |
| 696 // -- v0 : the value to pass to the generator |
| 697 // -- a1 : the JSGeneratorObject to resume |
| 698 // -- a2 : the resume mode (tagged) |
| 699 // -- ra : return address |
| 700 // ----------------------------------- |
| 701 __ AssertGeneratorObject(a1); |
| 702 |
| 703 // Store input value into generator object. |
| 704 __ sd(v0, FieldMemOperand(a1, JSGeneratorObject::kInputOffset)); |
| 705 __ RecordWriteField(a1, JSGeneratorObject::kInputOffset, v0, a3, |
| 706 kRAHasNotBeenSaved, kDontSaveFPRegs); |
| 707 |
| 708 // Load suspended function and context. |
| 709 __ ld(cp, FieldMemOperand(a1, JSGeneratorObject::kContextOffset)); |
| 710 __ ld(a4, FieldMemOperand(a1, JSGeneratorObject::kFunctionOffset)); |
| 711 |
| 712 // Flood function if we are stepping. |
| 713 Label skip_flooding; |
| 714 ExternalReference step_in_enabled = |
| 715 ExternalReference::debug_step_in_enabled_address(masm->isolate()); |
| 716 __ li(t1, Operand(step_in_enabled)); |
| 717 __ lb(t1, MemOperand(t1)); |
| 718 __ Branch(&skip_flooding, eq, t1, Operand(zero_reg)); |
| 719 { |
| 720 FrameScope scope(masm, StackFrame::INTERNAL); |
| 721 __ Push(a1, a2, t0); |
| 722 __ CallRuntime(Runtime::kDebugPrepareStepInIfStepping); |
| 723 __ Pop(a1, a2); |
| 724 __ ld(t0, FieldMemOperand(a1, JSGeneratorObject::kFunctionOffset)); |
| 725 } |
| 726 __ bind(&skip_flooding); |
| 727 |
| 728 // Push receiver. |
| 729 __ ld(a5, FieldMemOperand(a1, JSGeneratorObject::kReceiverOffset)); |
| 730 __ Push(a5); |
| 731 |
| 732 // ----------- S t a t e ------------- |
| 733 // -- a1 : the JSGeneratorObject to resume |
| 734 // -- a2 : the resume mode (tagged) |
| 735 // -- a4 : generator function |
| 736 // -- cp : generator context |
| 737 // -- ra : return address |
| 738 // -- sp[0] : generator receiver |
| 739 // ----------------------------------- |
| 740 |
| 741 // Push holes for arguments to generator function. Since the parser forced |
| 742 // context allocation for any variables in generators, the actual argument |
| 743 // values have already been copied into the context and these dummy values |
| 744 // will never be used. |
| 745 __ ld(a3, FieldMemOperand(a4, JSFunction::kSharedFunctionInfoOffset)); |
| 746 __ lw(a3, |
| 747 FieldMemOperand(a3, SharedFunctionInfo::kFormalParameterCountOffset)); |
| 748 { |
| 749 Label done_loop, loop; |
| 750 __ bind(&loop); |
| 751 __ Dsubu(a3, a3, Operand(1)); |
| 752 __ Branch(&done_loop, lt, a3, Operand(zero_reg)); |
| 753 __ PushRoot(Heap::kTheHoleValueRootIndex); |
| 754 __ Branch(&loop); |
| 755 __ bind(&done_loop); |
| 756 } |
| 757 |
| 758 // Enter a new JavaScript frame, and initialize its slots as they were when |
| 759 // the generator was suspended. |
| 760 FrameScope scope(masm, StackFrame::MANUAL); |
| 761 __ Push(ra, fp); |
| 762 __ Move(fp, sp); |
| 763 __ Push(cp, a4); |
| 764 |
| 765 // Restore the operand stack. |
| 766 __ ld(a0, FieldMemOperand(a1, JSGeneratorObject::kOperandStackOffset)); |
| 767 __ ld(a3, FieldMemOperand(a0, FixedArray::kLengthOffset)); |
| 768 __ SmiUntag(a3); |
| 769 __ Daddu(a0, a0, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); |
| 770 __ Lsa(a3, a0, a3, kPointerSizeLog2); |
| 771 { |
| 772 Label done_loop, loop; |
| 773 __ bind(&loop); |
| 774 __ Branch(&done_loop, eq, a0, Operand(a3)); |
| 775 __ ld(a5, MemOperand(a0)); |
| 776 __ Push(a5); |
| 777 __ Branch(USE_DELAY_SLOT, &loop); |
| 778 __ daddiu(a0, a0, kPointerSize); // In delay slot. |
| 779 __ bind(&done_loop); |
| 780 } |
| 781 |
| 782 // Push resume mode (consumed in continuation). |
| 783 __ Push(a2); |
| 784 |
| 785 // Reset operand stack so we don't leak. |
| 786 __ LoadRoot(a5, Heap::kEmptyFixedArrayRootIndex); |
| 787 __ sd(a5, FieldMemOperand(a1, JSGeneratorObject::kOperandStackOffset)); |
| 788 |
| 789 // Restore value. |
| 790 __ ld(v0, FieldMemOperand(a1, JSGeneratorObject::kInputOffset)); |
| 791 |
| 792 // Resume the generator function at the continuation. |
| 793 __ ld(a3, FieldMemOperand(a4, JSFunction::kSharedFunctionInfoOffset)); |
| 794 __ ld(a3, FieldMemOperand(a3, SharedFunctionInfo::kCodeOffset)); |
| 795 __ Daddu(a3, a3, Operand(Code::kHeaderSize - kHeapObjectTag)); |
| 796 __ ld(a2, FieldMemOperand(a1, JSGeneratorObject::kContinuationOffset)); |
| 797 __ SmiUntag(a2); |
| 798 __ Daddu(a3, a3, Operand(a2)); |
| 799 __ li(a2, Operand(Smi::FromInt(JSGeneratorObject::kGeneratorExecuting))); |
| 800 __ sd(a2, FieldMemOperand(a1, JSGeneratorObject::kContinuationOffset)); |
| 801 __ Jump(a3); |
| 802 } |
693 | 803 |
694 void Builtins::Generate_ConstructedNonConstructable(MacroAssembler* masm) { | 804 void Builtins::Generate_ConstructedNonConstructable(MacroAssembler* masm) { |
695 FrameScope scope(masm, StackFrame::INTERNAL); | 805 FrameScope scope(masm, StackFrame::INTERNAL); |
696 __ Push(a1); | 806 __ Push(a1); |
697 __ CallRuntime(Runtime::kThrowConstructedNonConstructable); | 807 __ CallRuntime(Runtime::kThrowConstructedNonConstructable); |
698 } | 808 } |
699 | 809 |
700 | 810 |
701 enum IsTagged { kArgcIsSmiTagged, kArgcIsUntaggedInt }; | 811 enum IsTagged { kArgcIsSmiTagged, kArgcIsUntaggedInt }; |
702 | 812 |
(...skipping 1888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2591 } | 2701 } |
2592 } | 2702 } |
2593 | 2703 |
2594 | 2704 |
2595 #undef __ | 2705 #undef __ |
2596 | 2706 |
2597 } // namespace internal | 2707 } // namespace internal |
2598 } // namespace v8 | 2708 } // namespace v8 |
2599 | 2709 |
2600 #endif // V8_TARGET_ARCH_MIPS64 | 2710 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |