| 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 772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 783 { | 783 { |
| 784 Label done_loop, loop; | 784 Label done_loop, loop; |
| 785 __ bind(&loop); | 785 __ bind(&loop); |
| 786 __ sub(r3, r3, Operand(Smi::FromInt(1)), SetCC); | 786 __ sub(r3, r3, Operand(Smi::FromInt(1)), SetCC); |
| 787 __ b(mi, &done_loop); | 787 __ b(mi, &done_loop); |
| 788 __ PushRoot(Heap::kTheHoleValueRootIndex); | 788 __ PushRoot(Heap::kTheHoleValueRootIndex); |
| 789 __ b(&loop); | 789 __ b(&loop); |
| 790 __ bind(&done_loop); | 790 __ bind(&done_loop); |
| 791 } | 791 } |
| 792 | 792 |
| 793 // Dispatch on the kind of generator object. | 793 // Underlying function needs to have bytecode available. |
| 794 Label old_generator; | 794 if (FLAG_debug_code) { |
| 795 __ ldr(r3, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset)); | 795 __ ldr(r3, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset)); |
| 796 __ ldr(r3, FieldMemOperand(r3, SharedFunctionInfo::kFunctionDataOffset)); | 796 __ ldr(r3, FieldMemOperand(r3, SharedFunctionInfo::kFunctionDataOffset)); |
| 797 __ CompareObjectType(r3, r3, r3, BYTECODE_ARRAY_TYPE); | 797 __ CompareObjectType(r3, r3, r3, BYTECODE_ARRAY_TYPE); |
| 798 __ b(ne, &old_generator); | 798 __ Assert(eq, kMissingBytecodeArray); |
| 799 } |
| 799 | 800 |
| 800 // New-style (ignition/turbofan) generator object | 801 // Resume (Ignition/TurboFan) generator object. |
| 801 { | 802 { |
| 802 __ ldr(r0, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset)); | 803 __ ldr(r0, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset)); |
| 803 __ ldr(r0, FieldMemOperand( | 804 __ ldr(r0, FieldMemOperand( |
| 804 r0, SharedFunctionInfo::kFormalParameterCountOffset)); | 805 r0, SharedFunctionInfo::kFormalParameterCountOffset)); |
| 805 __ SmiUntag(r0); | 806 __ SmiUntag(r0); |
| 806 // We abuse new.target both to indicate that this is a resume call and to | 807 // We abuse new.target both to indicate that this is a resume call and to |
| 807 // pass in the generator object. In ordinary calls, new.target is always | 808 // pass in the generator object. In ordinary calls, new.target is always |
| 808 // undefined because generator functions are non-constructable. | 809 // undefined because generator functions are non-constructable. |
| 809 __ Move(r3, r1); | 810 __ Move(r3, r1); |
| 810 __ Move(r1, r4); | 811 __ Move(r1, r4); |
| 811 __ ldr(r5, FieldMemOperand(r1, JSFunction::kCodeEntryOffset)); | 812 __ ldr(r5, FieldMemOperand(r1, JSFunction::kCodeEntryOffset)); |
| 812 __ Jump(r5); | 813 __ Jump(r5); |
| 813 } | 814 } |
| 814 | 815 |
| 815 // Old-style (full-codegen) generator object | |
| 816 __ bind(&old_generator); | |
| 817 { | |
| 818 // Enter a new JavaScript frame, and initialize its slots as they were when | |
| 819 // the generator was suspended. | |
| 820 DCHECK(!FLAG_enable_embedded_constant_pool); | |
| 821 FrameScope scope(masm, StackFrame::MANUAL); | |
| 822 __ Push(lr, fp); | |
| 823 __ Move(fp, sp); | |
| 824 __ Push(cp, r4); | |
| 825 | |
| 826 // Restore the operand stack. | |
| 827 __ ldr(r0, FieldMemOperand(r1, JSGeneratorObject::kOperandStackOffset)); | |
| 828 __ ldr(r3, FieldMemOperand(r0, FixedArray::kLengthOffset)); | |
| 829 __ add(r0, r0, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); | |
| 830 __ add(r3, r0, Operand(r3, LSL, kPointerSizeLog2 - 1)); | |
| 831 { | |
| 832 Label done_loop, loop; | |
| 833 __ bind(&loop); | |
| 834 __ cmp(r0, r3); | |
| 835 __ b(eq, &done_loop); | |
| 836 __ ldr(ip, MemOperand(r0, kPointerSize, PostIndex)); | |
| 837 __ Push(ip); | |
| 838 __ b(&loop); | |
| 839 __ bind(&done_loop); | |
| 840 } | |
| 841 | |
| 842 // Reset operand stack so we don't leak. | |
| 843 __ LoadRoot(ip, Heap::kEmptyFixedArrayRootIndex); | |
| 844 __ str(ip, FieldMemOperand(r1, JSGeneratorObject::kOperandStackOffset)); | |
| 845 | |
| 846 // Resume the generator function at the continuation. | |
| 847 __ ldr(r3, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset)); | |
| 848 __ ldr(r3, FieldMemOperand(r3, SharedFunctionInfo::kCodeOffset)); | |
| 849 __ add(r3, r3, Operand(Code::kHeaderSize - kHeapObjectTag)); | |
| 850 __ ldr(r2, FieldMemOperand(r1, JSGeneratorObject::kContinuationOffset)); | |
| 851 __ add(r3, r3, Operand(r2, ASR, 1)); | |
| 852 __ mov(r2, Operand(Smi::FromInt(JSGeneratorObject::kGeneratorExecuting))); | |
| 853 __ str(r2, FieldMemOperand(r1, JSGeneratorObject::kContinuationOffset)); | |
| 854 __ Move(r0, r1); // Continuation expects generator object in r0. | |
| 855 __ Jump(r3); | |
| 856 } | |
| 857 | |
| 858 __ bind(&prepare_step_in_if_stepping); | 816 __ bind(&prepare_step_in_if_stepping); |
| 859 { | 817 { |
| 860 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); | 818 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); |
| 861 __ Push(r1, r2, r4); | 819 __ Push(r1, r2, r4); |
| 862 __ CallRuntime(Runtime::kDebugPrepareStepInIfStepping); | 820 __ CallRuntime(Runtime::kDebugPrepareStepInIfStepping); |
| 863 __ Pop(r1, r2); | 821 __ Pop(r1, r2); |
| 864 __ ldr(r4, FieldMemOperand(r1, JSGeneratorObject::kFunctionOffset)); | 822 __ ldr(r4, FieldMemOperand(r1, JSGeneratorObject::kFunctionOffset)); |
| 865 } | 823 } |
| 866 __ b(&stepping_prepared); | 824 __ b(&stepping_prepared); |
| 867 | 825 |
| (...skipping 2042 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2910 __ bkpt(0); | 2868 __ bkpt(0); |
| 2911 } | 2869 } |
| 2912 } | 2870 } |
| 2913 | 2871 |
| 2914 #undef __ | 2872 #undef __ |
| 2915 | 2873 |
| 2916 } // namespace internal | 2874 } // namespace internal |
| 2917 } // namespace v8 | 2875 } // namespace v8 |
| 2918 | 2876 |
| 2919 #endif // V8_TARGET_ARCH_ARM | 2877 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |