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_ARM | 5 #if V8_TARGET_ARCH_ARM |
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 686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
697 void Builtins::Generate_JSBuiltinsConstructStub(MacroAssembler* masm) { | 697 void Builtins::Generate_JSBuiltinsConstructStub(MacroAssembler* masm) { |
698 Generate_JSConstructStubHelper(masm, false, false, false); | 698 Generate_JSConstructStubHelper(masm, false, false, false); |
699 } | 699 } |
700 | 700 |
701 | 701 |
702 void Builtins::Generate_JSBuiltinsConstructStubForDerived( | 702 void Builtins::Generate_JSBuiltinsConstructStubForDerived( |
703 MacroAssembler* masm) { | 703 MacroAssembler* masm) { |
704 Generate_JSConstructStubHelper(masm, false, false, true); | 704 Generate_JSConstructStubHelper(masm, false, false, true); |
705 } | 705 } |
706 | 706 |
| 707 // static |
| 708 void Builtins::Generate_ResumeGeneratorTrampoline(MacroAssembler* masm) { |
| 709 // ----------- S t a t e ------------- |
| 710 // -- r0 : the value to pass to the generator |
| 711 // -- r1 : the JSGeneratorObject to resume |
| 712 // -- r2 : the resume mode (tagged) |
| 713 // -- lr : return address |
| 714 // ----------------------------------- |
| 715 __ AssertGeneratorObject(r1); |
| 716 |
| 717 // Store input value into generator object. |
| 718 __ str(r0, FieldMemOperand(r1, JSGeneratorObject::kInputOffset)); |
| 719 __ RecordWriteField(r1, JSGeneratorObject::kInputOffset, r0, r3, |
| 720 kLRHasNotBeenSaved, kDontSaveFPRegs); |
| 721 |
| 722 // Load suspended function and context. |
| 723 __ ldr(cp, FieldMemOperand(r1, JSGeneratorObject::kContextOffset)); |
| 724 __ ldr(r4, FieldMemOperand(r1, JSGeneratorObject::kFunctionOffset)); |
| 725 |
| 726 // Flood function if we are stepping. |
| 727 Label skip_flooding; |
| 728 ExternalReference step_in_enabled = |
| 729 ExternalReference::debug_step_in_enabled_address(masm->isolate()); |
| 730 __ mov(ip, Operand(step_in_enabled)); |
| 731 __ ldrb(ip, MemOperand(ip)); |
| 732 __ cmp(ip, Operand(0)); |
| 733 __ b(eq, &skip_flooding); |
| 734 { |
| 735 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); |
| 736 __ Push(r1, r2, r4); |
| 737 __ CallRuntime(Runtime::kDebugPrepareStepInIfStepping); |
| 738 __ Pop(r1, r2); |
| 739 __ ldr(r4, FieldMemOperand(r1, JSGeneratorObject::kFunctionOffset)); |
| 740 } |
| 741 __ bind(&skip_flooding); |
| 742 |
| 743 // Push receiver. |
| 744 __ ldr(ip, FieldMemOperand(r1, JSGeneratorObject::kReceiverOffset)); |
| 745 __ Push(ip); |
| 746 |
| 747 // ----------- S t a t e ------------- |
| 748 // -- r1 : the JSGeneratorObject to resume |
| 749 // -- r2 : the resume mode (tagged) |
| 750 // -- r4 : generator function |
| 751 // -- cp : generator context |
| 752 // -- lr : return address |
| 753 // -- sp[0] : generator receiver |
| 754 // ----------------------------------- |
| 755 |
| 756 // Push holes for arguments to generator function. Since the parser forced |
| 757 // context allocation for any variables in generators, the actual argument |
| 758 // values have already been copied into the context and these dummy values |
| 759 // will never be used. |
| 760 __ ldr(r3, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset)); |
| 761 __ ldr(r3, |
| 762 FieldMemOperand(r3, SharedFunctionInfo::kFormalParameterCountOffset)); |
| 763 { |
| 764 Label done_loop, loop; |
| 765 __ bind(&loop); |
| 766 __ sub(r3, r3, Operand(Smi::FromInt(1)), SetCC); |
| 767 __ b(mi, &done_loop); |
| 768 __ PushRoot(Heap::kTheHoleValueRootIndex); |
| 769 __ b(&loop); |
| 770 __ bind(&done_loop); |
| 771 } |
| 772 |
| 773 // Enter a new JavaScript frame, and initialize its slots as they were when |
| 774 // the generator was suspended. |
| 775 DCHECK(!FLAG_enable_embedded_constant_pool); |
| 776 FrameScope scope(masm, StackFrame::MANUAL); |
| 777 __ Push(lr, fp); |
| 778 __ Move(fp, sp); |
| 779 __ Push(cp, r4); |
| 780 |
| 781 // Restore the operand stack. |
| 782 __ ldr(r0, FieldMemOperand(r1, JSGeneratorObject::kOperandStackOffset)); |
| 783 __ ldr(r3, FieldMemOperand(r0, FixedArray::kLengthOffset)); |
| 784 __ add(r0, r0, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); |
| 785 __ add(r3, r0, Operand(r3, LSL, kPointerSizeLog2 - 1)); |
| 786 { |
| 787 Label done_loop, loop; |
| 788 __ bind(&loop); |
| 789 __ cmp(r0, r3); |
| 790 __ b(eq, &done_loop); |
| 791 __ ldr(ip, MemOperand(r0, kPointerSize, PostIndex)); |
| 792 __ Push(ip); |
| 793 __ b(&loop); |
| 794 __ bind(&done_loop); |
| 795 } |
| 796 |
| 797 // Push resume mode (consumed in continuation). |
| 798 __ Push(r2); |
| 799 |
| 800 // Reset operand stack so we don't leak. |
| 801 __ LoadRoot(ip, Heap::kEmptyFixedArrayRootIndex); |
| 802 __ str(ip, FieldMemOperand(r1, JSGeneratorObject::kOperandStackOffset)); |
| 803 |
| 804 // Restore value. |
| 805 __ ldr(r0, FieldMemOperand(r1, JSGeneratorObject::kInputOffset)); |
| 806 |
| 807 // Resume the generator function at the continuation. |
| 808 __ ldr(r3, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset)); |
| 809 __ ldr(r3, FieldMemOperand(r3, SharedFunctionInfo::kCodeOffset)); |
| 810 __ add(r3, r3, Operand(Code::kHeaderSize - kHeapObjectTag)); |
| 811 __ ldr(r2, FieldMemOperand(r1, JSGeneratorObject::kContinuationOffset)); |
| 812 __ add(r3, r3, Operand(r2, ASR, 1)); |
| 813 __ mov(r2, Operand(Smi::FromInt(JSGeneratorObject::kGeneratorExecuting))); |
| 814 __ str(r2, FieldMemOperand(r1, JSGeneratorObject::kContinuationOffset)); |
| 815 __ Jump(r3); |
| 816 } |
707 | 817 |
708 void Builtins::Generate_ConstructedNonConstructable(MacroAssembler* masm) { | 818 void Builtins::Generate_ConstructedNonConstructable(MacroAssembler* masm) { |
709 FrameScope scope(masm, StackFrame::INTERNAL); | 819 FrameScope scope(masm, StackFrame::INTERNAL); |
710 __ push(r1); | 820 __ push(r1); |
711 __ CallRuntime(Runtime::kThrowConstructedNonConstructable); | 821 __ CallRuntime(Runtime::kThrowConstructedNonConstructable); |
712 } | 822 } |
713 | 823 |
714 | 824 |
715 enum IsTagged { kArgcIsSmiTagged, kArgcIsUntaggedInt }; | 825 enum IsTagged { kArgcIsSmiTagged, kArgcIsUntaggedInt }; |
716 | 826 |
(...skipping 1795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2512 } | 2622 } |
2513 } | 2623 } |
2514 | 2624 |
2515 | 2625 |
2516 #undef __ | 2626 #undef __ |
2517 | 2627 |
2518 } // namespace internal | 2628 } // namespace internal |
2519 } // namespace v8 | 2629 } // namespace v8 |
2520 | 2630 |
2521 #endif // V8_TARGET_ARCH_ARM | 2631 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |