| OLD | NEW |
| 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 745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 756 // -- lr : return address | 756 // -- lr : return address |
| 757 // -- sp[0] : generator receiver | 757 // -- sp[0] : generator receiver |
| 758 // ----------------------------------- | 758 // ----------------------------------- |
| 759 | 759 |
| 760 // Push holes for arguments to generator function. Since the parser forced | 760 // Push holes for arguments to generator function. Since the parser forced |
| 761 // context allocation for any variables in generators, the actual argument | 761 // context allocation for any variables in generators, the actual argument |
| 762 // values have already been copied into the context and these dummy values | 762 // values have already been copied into the context and these dummy values |
| 763 // will never be used. | 763 // will never be used. |
| 764 __ LoadP(r6, FieldMemOperand(r7, JSFunction::kSharedFunctionInfoOffset)); | 764 __ LoadP(r6, FieldMemOperand(r7, JSFunction::kSharedFunctionInfoOffset)); |
| 765 __ LoadWordArith( | 765 __ LoadWordArith( |
| 766 r6, FieldMemOperand(r6, SharedFunctionInfo::kFormalParameterCountOffset)); | 766 r3, FieldMemOperand(r6, SharedFunctionInfo::kFormalParameterCountOffset)); |
| 767 { | 767 { |
| 768 Label loop, done_loop; | 768 Label loop, done_loop; |
| 769 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); | 769 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); |
| 770 #if V8_TARGET_ARCH_PPC64 | 770 #if V8_TARGET_ARCH_PPC64 |
| 771 __ cmpi(r6, Operand::Zero()); | 771 __ cmpi(r3, Operand::Zero()); |
| 772 __ beq(&done_loop); | 772 __ beq(&done_loop); |
| 773 #else | 773 #else |
| 774 __ SmiUntag(r6, SetRC); | 774 __ SmiUntag(r3, SetRC); |
| 775 __ beq(&done_loop, cr0); | 775 __ beq(&done_loop, cr0); |
| 776 #endif | 776 #endif |
| 777 __ mtctr(r6); | 777 __ mtctr(r3); |
| 778 __ bind(&loop); | 778 __ bind(&loop); |
| 779 __ push(ip); | 779 __ push(ip); |
| 780 __ bdnz(&loop); | 780 __ bdnz(&loop); |
| 781 __ bind(&done_loop); | 781 __ bind(&done_loop); |
| 782 } | 782 } |
| 783 | 783 |
| 784 // Enter a new JavaScript frame, and initialize its slots as they were when | 784 // Dispatch on the kind of generator object. |
| 785 // the generator was suspended. | 785 Label old_generator; |
| 786 FrameScope scope(masm, StackFrame::MANUAL); | 786 __ LoadP(r6, FieldMemOperand(r6, SharedFunctionInfo::kFunctionDataOffset)); |
| 787 __ PushStandardFrame(r7); | 787 __ CompareObjectType(r6, r6, r6, BYTECODE_ARRAY_TYPE); |
| 788 __ bne(&old_generator); |
| 788 | 789 |
| 789 // Restore the operand stack. | 790 // New-style (ignition/turbofan) generator object |
| 790 __ LoadP(r3, FieldMemOperand(r4, JSGeneratorObject::kOperandStackOffset)); | |
| 791 __ LoadP(r6, FieldMemOperand(r3, FixedArray::kLengthOffset)); | |
| 792 __ addi(r3, r3, | |
| 793 Operand(FixedArray::kHeaderSize - kHeapObjectTag - kPointerSize)); | |
| 794 { | 791 { |
| 795 Label loop, done_loop; | 792 // We abuse new.target both to indicate that this is a resume call and to |
| 796 __ SmiUntag(r6, SetRC); | 793 // pass in the generator object. In ordinary calls, new.target is always |
| 797 __ beq(&done_loop, cr0); | 794 // undefined because generator functions are non-constructable. |
| 798 __ mtctr(r6); | 795 __ mr(r6, r4); |
| 799 __ bind(&loop); | 796 __ mr(r4, r7); |
| 800 __ LoadPU(ip, MemOperand(r3, kPointerSize)); | 797 __ LoadP(ip, FieldMemOperand(r4, JSFunction::kCodeEntryOffset)); |
| 801 __ Push(ip); | 798 __ JumpToJSEntry(ip); |
| 802 __ bdnz(&loop); | |
| 803 __ bind(&done_loop); | |
| 804 } | 799 } |
| 805 | 800 |
| 806 // Reset operand stack so we don't leak. | 801 // Old-style (full-codegen) generator object |
| 807 __ LoadRoot(ip, Heap::kEmptyFixedArrayRootIndex); | 802 __ bind(&old_generator); |
| 808 __ StoreP(ip, FieldMemOperand(r4, JSGeneratorObject::kOperandStackOffset), | 803 { |
| 809 r0); | 804 // Enter a new JavaScript frame, and initialize its slots as they were when |
| 805 // the generator was suspended. |
| 806 FrameScope scope(masm, StackFrame::MANUAL); |
| 807 __ PushStandardFrame(r7); |
| 810 | 808 |
| 811 // Resume the generator function at the continuation. | 809 // Restore the operand stack. |
| 812 __ LoadP(r6, FieldMemOperand(r7, JSFunction::kSharedFunctionInfoOffset)); | 810 __ LoadP(r3, FieldMemOperand(r4, JSGeneratorObject::kOperandStackOffset)); |
| 813 __ LoadP(r6, FieldMemOperand(r6, SharedFunctionInfo::kCodeOffset)); | 811 __ LoadP(r6, FieldMemOperand(r3, FixedArray::kLengthOffset)); |
| 814 __ addi(r6, r6, Operand(Code::kHeaderSize - kHeapObjectTag)); | 812 __ addi(r3, r3, |
| 815 { | 813 Operand(FixedArray::kHeaderSize - kHeapObjectTag - kPointerSize)); |
| 816 ConstantPoolUnavailableScope constant_pool_unavailable(masm); | 814 { |
| 817 if (FLAG_enable_embedded_constant_pool) { | 815 Label loop, done_loop; |
| 818 __ LoadConstantPoolPointerRegisterFromCodeTargetAddress(r6); | 816 __ SmiUntag(r6, SetRC); |
| 817 __ beq(&done_loop, cr0); |
| 818 __ mtctr(r6); |
| 819 __ bind(&loop); |
| 820 __ LoadPU(ip, MemOperand(r3, kPointerSize)); |
| 821 __ Push(ip); |
| 822 __ bdnz(&loop); |
| 823 __ bind(&done_loop); |
| 819 } | 824 } |
| 820 __ LoadP(r5, FieldMemOperand(r4, JSGeneratorObject::kContinuationOffset)); | 825 |
| 821 __ SmiUntag(r5); | 826 // Reset operand stack so we don't leak. |
| 822 __ add(r6, r6, r5); | 827 __ LoadRoot(ip, Heap::kEmptyFixedArrayRootIndex); |
| 823 __ LoadSmiLiteral(r5, Smi::FromInt(JSGeneratorObject::kGeneratorExecuting)); | 828 __ StoreP(ip, FieldMemOperand(r4, JSGeneratorObject::kOperandStackOffset), |
| 824 __ StoreP(r5, FieldMemOperand(r4, JSGeneratorObject::kContinuationOffset), | |
| 825 r0); | 829 r0); |
| 826 __ mr(r3, r4); // Continuation expects generator object in r3. | 830 |
| 827 __ Jump(r6); | 831 // Resume the generator function at the continuation. |
| 832 __ LoadP(r6, FieldMemOperand(r7, JSFunction::kSharedFunctionInfoOffset)); |
| 833 __ LoadP(r6, FieldMemOperand(r6, SharedFunctionInfo::kCodeOffset)); |
| 834 __ addi(r6, r6, Operand(Code::kHeaderSize - kHeapObjectTag)); |
| 835 { |
| 836 ConstantPoolUnavailableScope constant_pool_unavailable(masm); |
| 837 if (FLAG_enable_embedded_constant_pool) { |
| 838 __ LoadConstantPoolPointerRegisterFromCodeTargetAddress(r6); |
| 839 } |
| 840 __ LoadP(r5, FieldMemOperand(r4, JSGeneratorObject::kContinuationOffset)); |
| 841 __ SmiUntag(r5); |
| 842 __ add(r6, r6, r5); |
| 843 __ LoadSmiLiteral(r5, |
| 844 Smi::FromInt(JSGeneratorObject::kGeneratorExecuting)); |
| 845 __ StoreP(r5, FieldMemOperand(r4, JSGeneratorObject::kContinuationOffset), |
| 846 r0); |
| 847 __ mr(r3, r4); // Continuation expects generator object in r3. |
| 848 __ Jump(r6); |
| 849 } |
| 828 } | 850 } |
| 829 } | 851 } |
| 830 | 852 |
| 831 void Builtins::Generate_ConstructedNonConstructable(MacroAssembler* masm) { | 853 void Builtins::Generate_ConstructedNonConstructable(MacroAssembler* masm) { |
| 832 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); | 854 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); |
| 833 __ push(r4); | 855 __ push(r4); |
| 834 __ CallRuntime(Runtime::kThrowConstructedNonConstructable); | 856 __ CallRuntime(Runtime::kThrowConstructedNonConstructable); |
| 835 } | 857 } |
| 836 | 858 |
| 837 | 859 |
| (...skipping 2005 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2843 __ bkpt(0); | 2865 __ bkpt(0); |
| 2844 } | 2866 } |
| 2845 } | 2867 } |
| 2846 | 2868 |
| 2847 | 2869 |
| 2848 #undef __ | 2870 #undef __ |
| 2849 } // namespace internal | 2871 } // namespace internal |
| 2850 } // namespace v8 | 2872 } // namespace v8 |
| 2851 | 2873 |
| 2852 #endif // V8_TARGET_ARCH_PPC | 2874 #endif // V8_TARGET_ARCH_PPC |
| OLD | NEW |