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

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: 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 763 matching lines...) Expand 10 before | Expand all | Expand 10 after
774 __ SmiUntag(r6, SetRC); 774 __ SmiUntag(r6, SetRC);
775 __ beq(&done_loop, cr0); 775 __ beq(&done_loop, cr0);
776 #endif 776 #endif
777 __ mtctr(r6); 777 __ mtctr(r6);
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 __ LoadP(r3, FieldMemOperand(r7, JSFunction::kSharedFunctionInfoOffset));
796 __ SmiUntag(r6, SetRC); 794 __ LoadP(r3,
MTBrandyberry 2016/04/18 18:08:55 The formal parameter count is an integer value. S
797 __ beq(&done_loop, cr0); 795 FieldMemOperand(r3, SharedFunctionInfo::kFormalParameterCountOffset));
798 __ mtctr(r6); 796 __ SmiUntag(r3);
799 __ bind(&loop); 797 // We abuse new.target both to indicate that this is a resume call and to
800 __ LoadPU(ip, MemOperand(r3, kPointerSize)); 798 // pass in the generator object. In ordinary calls, new.target is always
801 __ Push(ip); 799 // undefined because generator functions are non-constructable.
802 __ bdnz(&loop); 800 __ mr(r6, r4);
803 __ bind(&done_loop); 801 __ mr(r4, r7);
802 __ LoadP(r8, FieldMemOperand(r4, JSFunction::kCodeEntryOffset));
803 __ Jump(r5);
MTBrandyberry 2016/04/18 18:08:54 When calling a javascript object entry, we need to
804 } 804 }
805 805
806 // Reset operand stack so we don't leak. 806 // Old-style (full-codegen) generator object
807 __ LoadRoot(ip, Heap::kEmptyFixedArrayRootIndex); 807 __ bind(&old_generator);
808 __ StoreP(ip, FieldMemOperand(r4, JSGeneratorObject::kOperandStackOffset), 808 {
809 r0); 809 // Enter a new JavaScript frame, and initialize its slots as they were when
810 // the generator was suspended.
811 FrameScope scope(masm, StackFrame::MANUAL);
812 __ PushStandardFrame(r7);
810 813
811 // Resume the generator function at the continuation. 814 // Restore the operand stack.
812 __ LoadP(r6, FieldMemOperand(r7, JSFunction::kSharedFunctionInfoOffset)); 815 __ LoadP(r3, FieldMemOperand(r4, JSGeneratorObject::kOperandStackOffset));
813 __ LoadP(r6, FieldMemOperand(r6, SharedFunctionInfo::kCodeOffset)); 816 __ LoadP(r6, FieldMemOperand(r3, FixedArray::kLengthOffset));
814 __ addi(r6, r6, Operand(Code::kHeaderSize - kHeapObjectTag)); 817 __ addi(r3, r3,
815 { 818 Operand(FixedArray::kHeaderSize - kHeapObjectTag - kPointerSize));
816 ConstantPoolUnavailableScope constant_pool_unavailable(masm); 819 {
817 if (FLAG_enable_embedded_constant_pool) { 820 Label loop, done_loop;
818 __ LoadConstantPoolPointerRegisterFromCodeTargetAddress(r6); 821 __ SmiUntag(r6, SetRC);
822 __ beq(&done_loop, cr0);
823 __ mtctr(r6);
824 __ bind(&loop);
825 __ LoadPU(ip, MemOperand(r3, kPointerSize));
826 __ Push(ip);
827 __ bdnz(&loop);
828 __ bind(&done_loop);
819 } 829 }
820 __ LoadP(r5, FieldMemOperand(r4, JSGeneratorObject::kContinuationOffset)); 830
821 __ SmiUntag(r5); 831 // Reset operand stack so we don't leak.
822 __ add(r6, r6, r5); 832 __ LoadRoot(ip, Heap::kEmptyFixedArrayRootIndex);
823 __ LoadSmiLiteral(r5, Smi::FromInt(JSGeneratorObject::kGeneratorExecuting)); 833 __ StoreP(ip, FieldMemOperand(r4, JSGeneratorObject::kOperandStackOffset),
824 __ StoreP(r5, FieldMemOperand(r4, JSGeneratorObject::kContinuationOffset),
825 r0); 834 r0);
826 __ mr(r3, r4); // Continuation expects generator object in r3. 835
827 __ Jump(r6); 836 // Resume the generator function at the continuation.
837 __ LoadP(r6, FieldMemOperand(r7, JSFunction::kSharedFunctionInfoOffset));
838 __ LoadP(r6, FieldMemOperand(r6, SharedFunctionInfo::kCodeOffset));
839 __ addi(r6, r6, Operand(Code::kHeaderSize - kHeapObjectTag));
840 {
841 ConstantPoolUnavailableScope constant_pool_unavailable(masm);
842 if (FLAG_enable_embedded_constant_pool) {
843 __ LoadConstantPoolPointerRegisterFromCodeTargetAddress(r6);
844 }
845 __ LoadP(r5, FieldMemOperand(r4, JSGeneratorObject::kContinuationOffset));
846 __ SmiUntag(r5);
847 __ add(r6, r6, r5);
848 __ LoadSmiLiteral(r5,
849 Smi::FromInt(JSGeneratorObject::kGeneratorExecuting));
850 __ StoreP(r5, FieldMemOperand(r4, JSGeneratorObject::kContinuationOffset),
851 r0);
852 __ mr(r3, r4); // Continuation expects generator object in r3.
853 __ Jump(r6);
854 }
828 } 855 }
829 } 856 }
830 857
831 void Builtins::Generate_ConstructedNonConstructable(MacroAssembler* masm) { 858 void Builtins::Generate_ConstructedNonConstructable(MacroAssembler* masm) {
832 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); 859 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL);
833 __ push(r4); 860 __ push(r4);
834 __ CallRuntime(Runtime::kThrowConstructedNonConstructable); 861 __ CallRuntime(Runtime::kThrowConstructedNonConstructable);
835 } 862 }
836 863
837 864
(...skipping 2005 matching lines...) Expand 10 before | Expand all | Expand 10 after
2843 __ bkpt(0); 2870 __ bkpt(0);
2844 } 2871 }
2845 } 2872 }
2846 2873
2847 2874
2848 #undef __ 2875 #undef __
2849 } // namespace internal 2876 } // namespace internal
2850 } // namespace v8 2877 } // namespace v8
2851 2878
2852 #endif // V8_TARGET_ARCH_PPC 2879 #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