| 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 794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 805 __ SmiUntag(r3, SetRC); | 805 __ SmiUntag(r3, SetRC); |
| 806 __ beq(&done_loop, cr0); | 806 __ beq(&done_loop, cr0); |
| 807 #endif | 807 #endif |
| 808 __ mtctr(r3); | 808 __ mtctr(r3); |
| 809 __ bind(&loop); | 809 __ bind(&loop); |
| 810 __ push(ip); | 810 __ push(ip); |
| 811 __ bdnz(&loop); | 811 __ bdnz(&loop); |
| 812 __ bind(&done_loop); | 812 __ bind(&done_loop); |
| 813 } | 813 } |
| 814 | 814 |
| 815 // Dispatch on the kind of generator object. | 815 // Underlying function needs to have bytecode available. |
| 816 Label old_generator; | 816 if (FLAG_debug_code) { |
| 817 __ LoadP(r6, FieldMemOperand(r6, SharedFunctionInfo::kFunctionDataOffset)); | 817 __ LoadP(r6, FieldMemOperand(r6, SharedFunctionInfo::kFunctionDataOffset)); |
| 818 __ CompareObjectType(r6, r6, r6, BYTECODE_ARRAY_TYPE); | 818 __ CompareObjectType(r6, r6, r6, BYTECODE_ARRAY_TYPE); |
| 819 __ bne(&old_generator); | 819 __ Assert(eq, kMissingBytecodeArray); |
| 820 } |
| 820 | 821 |
| 821 // New-style (ignition/turbofan) generator object | 822 // Resume (Ignition/TurboFan) generator object. |
| 822 { | 823 { |
| 823 // We abuse new.target both to indicate that this is a resume call and to | 824 // We abuse new.target both to indicate that this is a resume call and to |
| 824 // pass in the generator object. In ordinary calls, new.target is always | 825 // pass in the generator object. In ordinary calls, new.target is always |
| 825 // undefined because generator functions are non-constructable. | 826 // undefined because generator functions are non-constructable. |
| 826 __ mr(r6, r4); | 827 __ mr(r6, r4); |
| 827 __ mr(r4, r7); | 828 __ mr(r4, r7); |
| 828 __ LoadP(ip, FieldMemOperand(r4, JSFunction::kCodeEntryOffset)); | 829 __ LoadP(ip, FieldMemOperand(r4, JSFunction::kCodeEntryOffset)); |
| 829 __ JumpToJSEntry(ip); | 830 __ JumpToJSEntry(ip); |
| 830 } | 831 } |
| 831 | 832 |
| 832 // Old-style (full-codegen) generator object | |
| 833 __ bind(&old_generator); | |
| 834 { | |
| 835 // Enter a new JavaScript frame, and initialize its slots as they were when | |
| 836 // the generator was suspended. | |
| 837 FrameScope scope(masm, StackFrame::MANUAL); | |
| 838 __ PushStandardFrame(r7); | |
| 839 | |
| 840 // Restore the operand stack. | |
| 841 __ LoadP(r3, FieldMemOperand(r4, JSGeneratorObject::kOperandStackOffset)); | |
| 842 __ LoadP(r6, FieldMemOperand(r3, FixedArray::kLengthOffset)); | |
| 843 __ addi(r3, r3, | |
| 844 Operand(FixedArray::kHeaderSize - kHeapObjectTag - kPointerSize)); | |
| 845 { | |
| 846 Label loop, done_loop; | |
| 847 __ SmiUntag(r6, SetRC); | |
| 848 __ beq(&done_loop, cr0); | |
| 849 __ mtctr(r6); | |
| 850 __ bind(&loop); | |
| 851 __ LoadPU(ip, MemOperand(r3, kPointerSize)); | |
| 852 __ Push(ip); | |
| 853 __ bdnz(&loop); | |
| 854 __ bind(&done_loop); | |
| 855 } | |
| 856 | |
| 857 // Reset operand stack so we don't leak. | |
| 858 __ LoadRoot(ip, Heap::kEmptyFixedArrayRootIndex); | |
| 859 __ StoreP(ip, FieldMemOperand(r4, JSGeneratorObject::kOperandStackOffset), | |
| 860 r0); | |
| 861 | |
| 862 // Resume the generator function at the continuation. | |
| 863 __ LoadP(r6, FieldMemOperand(r7, JSFunction::kSharedFunctionInfoOffset)); | |
| 864 __ LoadP(r6, FieldMemOperand(r6, SharedFunctionInfo::kCodeOffset)); | |
| 865 __ addi(r6, r6, Operand(Code::kHeaderSize - kHeapObjectTag)); | |
| 866 { | |
| 867 ConstantPoolUnavailableScope constant_pool_unavailable(masm); | |
| 868 if (FLAG_enable_embedded_constant_pool) { | |
| 869 __ LoadConstantPoolPointerRegisterFromCodeTargetAddress(r6); | |
| 870 } | |
| 871 __ LoadP(r5, FieldMemOperand(r4, JSGeneratorObject::kContinuationOffset)); | |
| 872 __ SmiUntag(r5); | |
| 873 __ add(r6, r6, r5); | |
| 874 __ LoadSmiLiteral(r5, | |
| 875 Smi::FromInt(JSGeneratorObject::kGeneratorExecuting)); | |
| 876 __ StoreP(r5, FieldMemOperand(r4, JSGeneratorObject::kContinuationOffset), | |
| 877 r0); | |
| 878 __ mr(r3, r4); // Continuation expects generator object in r3. | |
| 879 __ Jump(r6); | |
| 880 } | |
| 881 } | |
| 882 | |
| 883 __ bind(&prepare_step_in_if_stepping); | 833 __ bind(&prepare_step_in_if_stepping); |
| 884 { | 834 { |
| 885 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); | 835 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); |
| 886 __ Push(r4, r5, r7); | 836 __ Push(r4, r5, r7); |
| 887 __ CallRuntime(Runtime::kDebugPrepareStepInIfStepping); | 837 __ CallRuntime(Runtime::kDebugPrepareStepInIfStepping); |
| 888 __ Pop(r4, r5); | 838 __ Pop(r4, r5); |
| 889 __ LoadP(r7, FieldMemOperand(r4, JSGeneratorObject::kFunctionOffset)); | 839 __ LoadP(r7, FieldMemOperand(r4, JSGeneratorObject::kFunctionOffset)); |
| 890 } | 840 } |
| 891 __ b(&stepping_prepared); | 841 __ b(&stepping_prepared); |
| 892 | 842 |
| (...skipping 2108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3001 __ CallRuntime(Runtime::kThrowStackOverflow); | 2951 __ CallRuntime(Runtime::kThrowStackOverflow); |
| 3002 __ bkpt(0); | 2952 __ bkpt(0); |
| 3003 } | 2953 } |
| 3004 } | 2954 } |
| 3005 | 2955 |
| 3006 #undef __ | 2956 #undef __ |
| 3007 } // namespace internal | 2957 } // namespace internal |
| 3008 } // namespace v8 | 2958 } // namespace v8 |
| 3009 | 2959 |
| 3010 #endif // V8_TARGET_ARCH_PPC | 2960 #endif // V8_TARGET_ARCH_PPC |
| OLD | NEW |