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

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

Issue 1896933002: PPC: First version of the new generators implementation. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: remove redundant load by using a scratch register 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_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 743 matching lines...) Expand 10 before | Expand all | Expand 10 after
754 // -- r7 : generator function 754 // -- r7 : generator function
755 // -- cp : generator context 755 // -- cp : generator context
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(r3, FieldMemOperand(r7, JSFunction::kSharedFunctionInfoOffset));
MTBrandyberry 2016/04/18 20:55:10 If you leave this load target as r6, you can omit
765 __ LoadWordArith( 765 __ LoadWordArith(
766 r6, FieldMemOperand(r6, SharedFunctionInfo::kFormalParameterCountOffset)); 766 r3, FieldMemOperand(r3, 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(r7, JSFunction::kSharedFunctionInfoOffset));
787 __ PushStandardFrame(r7); 787 __ LoadP(r6, FieldMemOperand(r6, SharedFunctionInfo::kFunctionDataOffset));
788 __ CompareObjectType(r6, r6, r6, BYTECODE_ARRAY_TYPE);
789 __ bne(&old_generator);
788 790
789 // Restore the operand stack. 791 // 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 { 792 {
795 Label loop, done_loop; 793 // We abuse new.target both to indicate that this is a resume call and to
796 __ SmiUntag(r6, SetRC); 794 // pass in the generator object. In ordinary calls, new.target is always
797 __ beq(&done_loop, cr0); 795 // undefined because generator functions are non-constructable.
798 __ mtctr(r6); 796 __ mr(r6, r4);
799 __ bind(&loop); 797 __ mr(r4, r7);
800 __ LoadPU(ip, MemOperand(r3, kPointerSize)); 798 __ LoadP(ip, FieldMemOperand(r4, JSFunction::kCodeEntryOffset));
801 __ Push(ip); 799 __ JumpToJSEntry(ip);
802 __ bdnz(&loop);
803 __ bind(&done_loop);
804 } 800 }
805 801
806 // Reset operand stack so we don't leak. 802 // Old-style (full-codegen) generator object
807 __ LoadRoot(ip, Heap::kEmptyFixedArrayRootIndex); 803 __ bind(&old_generator);
808 __ StoreP(ip, FieldMemOperand(r4, JSGeneratorObject::kOperandStackOffset), 804 {
809 r0); 805 // Enter a new JavaScript frame, and initialize its slots as they were when
806 // the generator was suspended.
807 FrameScope scope(masm, StackFrame::MANUAL);
808 __ PushStandardFrame(r7);
810 809
811 // Resume the generator function at the continuation. 810 // Restore the operand stack.
812 __ LoadP(r6, FieldMemOperand(r7, JSFunction::kSharedFunctionInfoOffset)); 811 __ LoadP(r3, FieldMemOperand(r4, JSGeneratorObject::kOperandStackOffset));
813 __ LoadP(r6, FieldMemOperand(r6, SharedFunctionInfo::kCodeOffset)); 812 __ LoadP(r6, FieldMemOperand(r3, FixedArray::kLengthOffset));
814 __ addi(r6, r6, Operand(Code::kHeaderSize - kHeapObjectTag)); 813 __ addi(r3, r3,
815 { 814 Operand(FixedArray::kHeaderSize - kHeapObjectTag - kPointerSize));
816 ConstantPoolUnavailableScope constant_pool_unavailable(masm); 815 {
817 if (FLAG_enable_embedded_constant_pool) { 816 Label loop, done_loop;
818 __ LoadConstantPoolPointerRegisterFromCodeTargetAddress(r6); 817 __ SmiUntag(r6, SetRC);
818 __ beq(&done_loop, cr0);
819 __ mtctr(r6);
820 __ bind(&loop);
821 __ LoadPU(ip, MemOperand(r3, kPointerSize));
822 __ Push(ip);
823 __ bdnz(&loop);
824 __ bind(&done_loop);
819 } 825 }
820 __ LoadP(r5, FieldMemOperand(r4, JSGeneratorObject::kContinuationOffset)); 826
821 __ SmiUntag(r5); 827 // Reset operand stack so we don't leak.
822 __ add(r6, r6, r5); 828 __ LoadRoot(ip, Heap::kEmptyFixedArrayRootIndex);
823 __ LoadSmiLiteral(r5, Smi::FromInt(JSGeneratorObject::kGeneratorExecuting)); 829 __ StoreP(ip, FieldMemOperand(r4, JSGeneratorObject::kOperandStackOffset),
824 __ StoreP(r5, FieldMemOperand(r4, JSGeneratorObject::kContinuationOffset),
825 r0); 830 r0);
826 __ mr(r3, r4); // Continuation expects generator object in r3. 831
827 __ Jump(r6); 832 // Resume the generator function at the continuation.
833 __ LoadP(r6, FieldMemOperand(r7, JSFunction::kSharedFunctionInfoOffset));
834 __ LoadP(r6, FieldMemOperand(r6, SharedFunctionInfo::kCodeOffset));
835 __ addi(r6, r6, Operand(Code::kHeaderSize - kHeapObjectTag));
836 {
837 ConstantPoolUnavailableScope constant_pool_unavailable(masm);
838 if (FLAG_enable_embedded_constant_pool) {
839 __ LoadConstantPoolPointerRegisterFromCodeTargetAddress(r6);
840 }
841 __ LoadP(r5, FieldMemOperand(r4, JSGeneratorObject::kContinuationOffset));
842 __ SmiUntag(r5);
843 __ add(r6, r6, r5);
844 __ LoadSmiLiteral(r5,
845 Smi::FromInt(JSGeneratorObject::kGeneratorExecuting));
846 __ StoreP(r5, FieldMemOperand(r4, JSGeneratorObject::kContinuationOffset),
847 r0);
848 __ mr(r3, r4); // Continuation expects generator object in r3.
849 __ Jump(r6);
850 }
828 } 851 }
829 } 852 }
830 853
831 void Builtins::Generate_ConstructedNonConstructable(MacroAssembler* masm) { 854 void Builtins::Generate_ConstructedNonConstructable(MacroAssembler* masm) {
832 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); 855 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL);
833 __ push(r4); 856 __ push(r4);
834 __ CallRuntime(Runtime::kThrowConstructedNonConstructable); 857 __ CallRuntime(Runtime::kThrowConstructedNonConstructable);
835 } 858 }
836 859
837 860
(...skipping 2005 matching lines...) Expand 10 before | Expand all | Expand 10 after
2843 __ bkpt(0); 2866 __ bkpt(0);
2844 } 2867 }
2845 } 2868 }
2846 2869
2847 2870
2848 #undef __ 2871 #undef __
2849 } // namespace internal 2872 } // namespace internal
2850 } // namespace v8 2873 } // namespace v8
2851 2874
2852 #endif // V8_TARGET_ARCH_PPC 2875 #endif // V8_TARGET_ARCH_PPC
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