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

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

Issue 1899283002: S390: First version of the new generators implementation. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_S390 5 #if V8_TARGET_ARCH_S390
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 733 matching lines...) Expand 10 before | Expand all | Expand 10 after
744 // -- lr : return address 744 // -- lr : return address
745 // -- sp[0] : generator receiver 745 // -- sp[0] : generator receiver
746 // ----------------------------------- 746 // -----------------------------------
747 747
748 // Push holes for arguments to generator function. Since the parser forced 748 // Push holes for arguments to generator function. Since the parser forced
749 // context allocation for any variables in generators, the actual argument 749 // context allocation for any variables in generators, the actual argument
750 // values have already been copied into the context and these dummy values 750 // values have already been copied into the context and these dummy values
751 // will never be used. 751 // will never be used.
752 __ LoadP(r5, FieldMemOperand(r6, JSFunction::kSharedFunctionInfoOffset)); 752 __ LoadP(r5, FieldMemOperand(r6, JSFunction::kSharedFunctionInfoOffset));
753 __ LoadW( 753 __ LoadW(
754 r5, FieldMemOperand(r5, SharedFunctionInfo::kFormalParameterCountOffset)); 754 r2, FieldMemOperand(r5, SharedFunctionInfo::kFormalParameterCountOffset));
755 { 755 {
756 Label loop, done_loop; 756 Label loop, done_loop;
757 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); 757 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex);
758 #if V8_TARGET_ARCH_S390X 758 #if V8_TARGET_ARCH_S390X
759 __ CmpP(r5, Operand::Zero()); 759 __ CmpP(r2, Operand::Zero());
760 __ beq(&done_loop); 760 __ beq(&done_loop);
761 #else 761 #else
762 __ SmiUntag(r5); 762 __ SmiUntag(r2);
763 __ LoadAndTestP(r5, r5); 763 __ LoadAndTestP(r2, r2);
764 __ beq(&done_loop); 764 __ beq(&done_loop);
765 #endif 765 #endif
766 __ LoadRR(r1, r5); 766 __ LoadRR(r1, r2);
767 __ bind(&loop); 767 __ bind(&loop);
768 __ push(ip); 768 __ push(ip);
769 __ BranchOnCount(r1, &loop); 769 __ BranchOnCount(r1, &loop);
770 __ bind(&done_loop); 770 __ bind(&done_loop);
771 } 771 }
772 772
773 // Enter a new JavaScript frame, and initialize its slots as they were when 773 // Dispatch on the kind of generator object.
774 // the generator was suspended. 774 Label old_generator;
775 FrameScope scope(masm, StackFrame::MANUAL); 775 __ LoadP(r5, FieldMemOperand(r5, SharedFunctionInfo::kFunctionDataOffset));
776 __ PushStandardFrame(r6); 776 __ CompareObjectType(r5, r5, r5, BYTECODE_ARRAY_TYPE);
777 __ bne(&old_generator, Label::kNear);
777 778
778 // Restore the operand stack. 779 // New-style (ignition/turbofan) generator object
779 __ LoadP(r2, FieldMemOperand(r3, JSGeneratorObject::kOperandStackOffset));
780 __ LoadP(r5, FieldMemOperand(r2, FixedArray::kLengthOffset));
781 __ AddP(r2, r2,
782 Operand(FixedArray::kHeaderSize - kHeapObjectTag - kPointerSize));
783 { 780 {
784 Label loop, done_loop; 781 // We abuse new.target both to indicate that this is a resume call and to
785 __ SmiUntag(r5); 782 // pass in the generator object. In ordinary calls, new.target is always
786 __ LoadAndTestP(r5, r5); 783 // undefined because generator functions are non-constructable.
787 __ beq(&done_loop); 784 __ LoadRR(r5, r3);
788 __ LoadRR(r1, r5); 785 __ LoadRR(r3, r6);
789 __ bind(&loop); 786 __ LoadP(ip, FieldMemOperand(r3, JSFunction::kCodeEntryOffset));
790 __ LoadP(ip, MemOperand(r2, kPointerSize)); 787 __ JumpToJSEntry(ip);
791 __ la(r2, MemOperand(r2, kPointerSize));
792 __ Push(ip);
793 __ BranchOnCount(r1, &loop);
794 __ bind(&done_loop);
795 } 788 }
789 // Old-style (full-codegen) generator object
790 __ bind(&old_generator);
791 {
792 // Enter a new JavaScript frame, and initialize its slots as they were when
793 // the generator was suspended.
794 FrameScope scope(masm, StackFrame::MANUAL);
795 __ PushStandardFrame(r6);
796 796
797 // Reset operand stack so we don't leak. 797 // Restore the operand stack.
798 __ LoadRoot(ip, Heap::kEmptyFixedArrayRootIndex); 798 __ LoadP(r2, FieldMemOperand(r3, JSGeneratorObject::kOperandStackOffset));
799 __ StoreP(ip, FieldMemOperand(r3, JSGeneratorObject::kOperandStackOffset), 799 __ LoadP(r5, FieldMemOperand(r2, FixedArray::kLengthOffset));
800 r0); 800 __ AddP(r2, r2,
801 Operand(FixedArray::kHeaderSize - kHeapObjectTag - kPointerSize));
802 {
803 Label loop, done_loop;
804 __ SmiUntag(r5);
805 __ LoadAndTestP(r5, r5);
806 __ beq(&done_loop);
807 __ LoadRR(r1, r5);
808 __ bind(&loop);
809 __ LoadP(ip, MemOperand(r2, kPointerSize));
810 __ la(r2, MemOperand(r2, kPointerSize));
811 __ Push(ip);
812 __ BranchOnCount(r1, &loop);
813 __ bind(&done_loop);
814 }
801 815
802 // Resume the generator function at the continuation. 816 // Reset operand stack so we don't leak.
803 __ LoadP(r5, FieldMemOperand(r6, JSFunction::kSharedFunctionInfoOffset)); 817 __ LoadRoot(ip, Heap::kEmptyFixedArrayRootIndex);
804 __ LoadP(r5, FieldMemOperand(r5, SharedFunctionInfo::kCodeOffset)); 818 __ StoreP(ip, FieldMemOperand(r3, JSGeneratorObject::kOperandStackOffset),
805 __ AddP(r5, r5, Operand(Code::kHeaderSize - kHeapObjectTag));
806 {
807 ConstantPoolUnavailableScope constant_pool_unavailable(masm);
808 __ LoadP(r4, FieldMemOperand(r3, JSGeneratorObject::kContinuationOffset));
809 __ SmiUntag(r4);
810 __ AddP(r5, r5, r4);
811 __ LoadSmiLiteral(r4, Smi::FromInt(JSGeneratorObject::kGeneratorExecuting));
812 __ StoreP(r4, FieldMemOperand(r3, JSGeneratorObject::kContinuationOffset),
813 r0); 819 r0);
814 __ LoadRR(r2, r3); // Continuation expects generator object in r2. 820
815 __ Jump(r5); 821 // Resume the generator function at the continuation.
822 __ LoadP(r5, FieldMemOperand(r6, JSFunction::kSharedFunctionInfoOffset));
823 __ LoadP(r5, FieldMemOperand(r5, SharedFunctionInfo::kCodeOffset));
824 __ AddP(r5, r5, Operand(Code::kHeaderSize - kHeapObjectTag));
825 {
826 ConstantPoolUnavailableScope constant_pool_unavailable(masm);
827 __ LoadP(r4, FieldMemOperand(r3, JSGeneratorObject::kContinuationOffset));
828 __ SmiUntag(r4);
829 __ AddP(r5, r5, r4);
830 __ LoadSmiLiteral(r4,
831 Smi::FromInt(JSGeneratorObject::kGeneratorExecuting));
832 __ StoreP(r4, FieldMemOperand(r3, JSGeneratorObject::kContinuationOffset),
833 r0);
834 __ LoadRR(r2, r3); // Continuation expects generator object in r2.
835 __ Jump(r5);
836 }
816 } 837 }
817 } 838 }
818 839
819 void Builtins::Generate_ConstructedNonConstructable(MacroAssembler* masm) { 840 void Builtins::Generate_ConstructedNonConstructable(MacroAssembler* masm) {
820 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); 841 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL);
821 __ push(r3); 842 __ push(r3);
822 __ CallRuntime(Runtime::kThrowConstructedNonConstructable); 843 __ CallRuntime(Runtime::kThrowConstructedNonConstructable);
823 } 844 }
824 845
825 enum IsTagged { kArgcIsSmiTagged, kArgcIsUntaggedInt }; 846 enum IsTagged { kArgcIsSmiTagged, kArgcIsUntaggedInt };
(...skipping 1971 matching lines...) Expand 10 before | Expand all | Expand 10 after
2797 __ bkpt(0); 2818 __ bkpt(0);
2798 } 2819 }
2799 } 2820 }
2800 2821
2801 #undef __ 2822 #undef __
2802 2823
2803 } // namespace internal 2824 } // namespace internal
2804 } // namespace v8 2825 } // namespace v8
2805 2826
2806 #endif // V8_TARGET_ARCH_S390 2827 #endif // V8_TARGET_ARCH_S390
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698