Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: src/arm/builtins-arm.cc

Issue 1884183002: First version of the new generators implementation. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/arm64/builtins-arm64.cc » ('j') | src/interpreter/bytecode-generator.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 755 matching lines...) Expand 10 before | Expand all | Expand 10 after
766 { 766 {
767 Label done_loop, loop; 767 Label done_loop, loop;
768 __ bind(&loop); 768 __ bind(&loop);
769 __ sub(r3, r3, Operand(Smi::FromInt(1)), SetCC); 769 __ sub(r3, r3, Operand(Smi::FromInt(1)), SetCC);
770 __ b(mi, &done_loop); 770 __ b(mi, &done_loop);
771 __ PushRoot(Heap::kTheHoleValueRootIndex); 771 __ PushRoot(Heap::kTheHoleValueRootIndex);
772 __ b(&loop); 772 __ b(&loop);
773 __ bind(&done_loop); 773 __ bind(&done_loop);
774 } 774 }
775 775
776 // Enter a new JavaScript frame, and initialize its slots as they were when 776 // Dispatch on the kind of generator object.
777 // the generator was suspended. 777 Label old_generator;
778 DCHECK(!FLAG_enable_embedded_constant_pool); 778 __ ldr(r3, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset));
779 FrameScope scope(masm, StackFrame::MANUAL); 779 __ ldr(r3, FieldMemOperand(r3, SharedFunctionInfo::kFunctionDataOffset));
780 __ Push(lr, fp); 780 __ CompareObjectType(r3, r3, r3, BYTECODE_ARRAY_TYPE);
781 __ Move(fp, sp); 781 __ b(ne, &old_generator);
782 __ Push(cp, r4);
783 782
784 // Restore the operand stack. 783 // New-style (ignition/turbofan) generator object
785 __ ldr(r0, FieldMemOperand(r1, JSGeneratorObject::kOperandStackOffset));
786 __ ldr(r3, FieldMemOperand(r0, FixedArray::kLengthOffset));
787 __ add(r0, r0, Operand(FixedArray::kHeaderSize - kHeapObjectTag));
788 __ add(r3, r0, Operand(r3, LSL, kPointerSizeLog2 - 1));
789 { 784 {
790 Label done_loop, loop; 785 __ ldr(r0, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset));
791 __ bind(&loop); 786 __ ldr(r0,
792 __ cmp(r0, r3); 787 FieldMemOperand(r0, SharedFunctionInfo::kFormalParameterCountOffset));
793 __ b(eq, &done_loop); 788 __ SmiUntag(r0);
794 __ ldr(ip, MemOperand(r0, kPointerSize, PostIndex)); 789 // We abuse new.target both to indicate that this is a resume call and to
795 __ Push(ip); 790 // pass in the generator object. In ordinary calls, new.target is always
796 __ b(&loop); 791 // undefined because generator functions are non-constructable.
797 __ bind(&done_loop); 792 __ Move(r3, r1);
793 __ Move(r1, r4);
794 __ ldr(r5, FieldMemOperand(r1, JSFunction::kCodeEntryOffset));
795 __ Jump(r5);
798 } 796 }
799 797
800 // Reset operand stack so we don't leak. 798 // Old-style (full-codegen) generator object
801 __ LoadRoot(ip, Heap::kEmptyFixedArrayRootIndex); 799 __ bind(&old_generator);
802 __ str(ip, FieldMemOperand(r1, JSGeneratorObject::kOperandStackOffset)); 800 {
801 // Enter a new JavaScript frame, and initialize its slots as they were when
802 // the generator was suspended.
803 DCHECK(!FLAG_enable_embedded_constant_pool);
804 FrameScope scope(masm, StackFrame::MANUAL);
805 __ Push(lr, fp);
806 __ Move(fp, sp);
807 __ Push(cp, r4);
803 808
804 // Resume the generator function at the continuation. 809 // Restore the operand stack.
805 __ ldr(r3, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset)); 810 __ ldr(r0, FieldMemOperand(r1, JSGeneratorObject::kOperandStackOffset));
806 __ ldr(r3, FieldMemOperand(r3, SharedFunctionInfo::kCodeOffset)); 811 __ ldr(r3, FieldMemOperand(r0, FixedArray::kLengthOffset));
807 __ add(r3, r3, Operand(Code::kHeaderSize - kHeapObjectTag)); 812 __ add(r0, r0, Operand(FixedArray::kHeaderSize - kHeapObjectTag));
808 __ ldr(r2, FieldMemOperand(r1, JSGeneratorObject::kContinuationOffset)); 813 __ add(r3, r0, Operand(r3, LSL, kPointerSizeLog2 - 1));
809 __ add(r3, r3, Operand(r2, ASR, 1)); 814 {
810 __ mov(r2, Operand(Smi::FromInt(JSGeneratorObject::kGeneratorExecuting))); 815 Label done_loop, loop;
811 __ str(r2, FieldMemOperand(r1, JSGeneratorObject::kContinuationOffset)); 816 __ bind(&loop);
812 __ Move(r0, r1); // Continuation expects generator object in r0. 817 __ cmp(r0, r3);
813 __ Jump(r3); 818 __ b(eq, &done_loop);
819 __ ldr(ip, MemOperand(r0, kPointerSize, PostIndex));
820 __ Push(ip);
821 __ b(&loop);
822 __ bind(&done_loop);
823 }
824
825 // Reset operand stack so we don't leak.
826 __ LoadRoot(ip, Heap::kEmptyFixedArrayRootIndex);
827 __ str(ip, FieldMemOperand(r1, JSGeneratorObject::kOperandStackOffset));
828
829 // Resume the generator function at the continuation.
830 __ ldr(r3, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset));
831 __ ldr(r3, FieldMemOperand(r3, SharedFunctionInfo::kCodeOffset));
832 __ add(r3, r3, Operand(Code::kHeaderSize - kHeapObjectTag));
833 __ ldr(r2, FieldMemOperand(r1, JSGeneratorObject::kContinuationOffset));
834 __ add(r3, r3, Operand(r2, ASR, 1));
835 __ mov(r2, Operand(Smi::FromInt(JSGeneratorObject::kGeneratorExecuting)));
836 __ str(r2, FieldMemOperand(r1, JSGeneratorObject::kContinuationOffset));
837 __ Move(r0, r1); // Continuation expects generator object in r0.
838 __ Jump(r3);
839 }
814 } 840 }
815 841
816 void Builtins::Generate_ConstructedNonConstructable(MacroAssembler* masm) { 842 void Builtins::Generate_ConstructedNonConstructable(MacroAssembler* masm) {
817 FrameScope scope(masm, StackFrame::INTERNAL); 843 FrameScope scope(masm, StackFrame::INTERNAL);
818 __ push(r1); 844 __ push(r1);
819 __ CallRuntime(Runtime::kThrowConstructedNonConstructable); 845 __ CallRuntime(Runtime::kThrowConstructedNonConstructable);
820 } 846 }
821 847
822 848
823 enum IsTagged { kArgcIsSmiTagged, kArgcIsUntaggedInt }; 849 enum IsTagged { kArgcIsSmiTagged, kArgcIsUntaggedInt };
(...skipping 1937 matching lines...) Expand 10 before | Expand all | Expand 10 after
2761 } 2787 }
2762 } 2788 }
2763 2789
2764 2790
2765 #undef __ 2791 #undef __
2766 2792
2767 } // namespace internal 2793 } // namespace internal
2768 } // namespace v8 2794 } // namespace v8
2769 2795
2770 #endif // V8_TARGET_ARCH_ARM 2796 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/arm64/builtins-arm64.cc » ('j') | src/interpreter/bytecode-generator.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698