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

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

Issue 1867263002: [generators] Store the resume mode in the generator object. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Other platforms 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 | « src/ia32/builtins-ia32.cc ('k') | src/mips64/builtins-mips64.cc » ('j') | no next file with comments »
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_MIPS 5 #if V8_TARGET_ARCH_MIPS
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 822 matching lines...) Expand 10 before | Expand all | Expand 10 after
833 // -- a2 : the resume mode (tagged) 833 // -- a2 : the resume mode (tagged)
834 // -- ra : return address 834 // -- ra : return address
835 // ----------------------------------- 835 // -----------------------------------
836 __ AssertGeneratorObject(a1); 836 __ AssertGeneratorObject(a1);
837 837
838 // Store input value into generator object. 838 // Store input value into generator object.
839 __ sw(v0, FieldMemOperand(a1, JSGeneratorObject::kInputOffset)); 839 __ sw(v0, FieldMemOperand(a1, JSGeneratorObject::kInputOffset));
840 __ RecordWriteField(a1, JSGeneratorObject::kInputOffset, v0, a3, 840 __ RecordWriteField(a1, JSGeneratorObject::kInputOffset, v0, a3,
841 kRAHasNotBeenSaved, kDontSaveFPRegs); 841 kRAHasNotBeenSaved, kDontSaveFPRegs);
842 842
843 // Store resume mode into generator object.
844 __ sw(a2, FieldMemOperand(a1, JSGeneratorObject::kResumeModeOffset));
845
843 // Load suspended function and context. 846 // Load suspended function and context.
844 __ lw(cp, FieldMemOperand(a1, JSGeneratorObject::kContextOffset)); 847 __ lw(cp, FieldMemOperand(a1, JSGeneratorObject::kContextOffset));
845 __ lw(t0, FieldMemOperand(a1, JSGeneratorObject::kFunctionOffset)); 848 __ lw(t0, FieldMemOperand(a1, JSGeneratorObject::kFunctionOffset));
846 849
847 // Flood function if we are stepping. 850 // Flood function if we are stepping.
848 Label skip_flooding; 851 Label skip_flooding;
849 ExternalReference step_in_enabled = 852 ExternalReference step_in_enabled =
850 ExternalReference::debug_step_in_enabled_address(masm->isolate()); 853 ExternalReference::debug_step_in_enabled_address(masm->isolate());
851 __ li(t1, Operand(step_in_enabled)); 854 __ li(t1, Operand(step_in_enabled));
852 __ lb(t1, MemOperand(t1)); 855 __ lb(t1, MemOperand(t1));
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
906 Label done_loop, loop; 909 Label done_loop, loop;
907 __ bind(&loop); 910 __ bind(&loop);
908 __ Branch(&done_loop, eq, a0, Operand(a3)); 911 __ Branch(&done_loop, eq, a0, Operand(a3));
909 __ lw(t1, MemOperand(a0)); 912 __ lw(t1, MemOperand(a0));
910 __ Push(t1); 913 __ Push(t1);
911 __ Branch(USE_DELAY_SLOT, &loop); 914 __ Branch(USE_DELAY_SLOT, &loop);
912 __ addiu(a0, a0, kPointerSize); // In delay slot. 915 __ addiu(a0, a0, kPointerSize); // In delay slot.
913 __ bind(&done_loop); 916 __ bind(&done_loop);
914 } 917 }
915 918
916 // Push resume mode (consumed in continuation).
917 __ Push(a2);
918
919 // Reset operand stack so we don't leak. 919 // Reset operand stack so we don't leak.
920 __ LoadRoot(t1, Heap::kEmptyFixedArrayRootIndex); 920 __ LoadRoot(t1, Heap::kEmptyFixedArrayRootIndex);
921 __ sw(t1, FieldMemOperand(a1, JSGeneratorObject::kOperandStackOffset)); 921 __ sw(t1, FieldMemOperand(a1, JSGeneratorObject::kOperandStackOffset));
922 922
923 // Restore value.
924 __ lw(v0, FieldMemOperand(a1, JSGeneratorObject::kInputOffset));
925
926 // Resume the generator function at the continuation. 923 // Resume the generator function at the continuation.
927 __ lw(a3, FieldMemOperand(t0, JSFunction::kSharedFunctionInfoOffset)); 924 __ lw(a3, FieldMemOperand(t0, JSFunction::kSharedFunctionInfoOffset));
928 __ lw(a3, FieldMemOperand(a3, SharedFunctionInfo::kCodeOffset)); 925 __ lw(a3, FieldMemOperand(a3, SharedFunctionInfo::kCodeOffset));
929 __ Addu(a3, a3, Operand(Code::kHeaderSize - kHeapObjectTag)); 926 __ Addu(a3, a3, Operand(Code::kHeaderSize - kHeapObjectTag));
930 __ lw(a2, FieldMemOperand(a1, JSGeneratorObject::kContinuationOffset)); 927 __ lw(a2, FieldMemOperand(a1, JSGeneratorObject::kContinuationOffset));
931 __ SmiUntag(a2); 928 __ SmiUntag(a2);
932 __ Addu(a3, a3, Operand(a2)); 929 __ Addu(a3, a3, Operand(a2));
933 __ li(a2, Operand(Smi::FromInt(JSGeneratorObject::kGeneratorExecuting))); 930 __ li(a2, Operand(Smi::FromInt(JSGeneratorObject::kGeneratorExecuting)));
934 __ sw(a2, FieldMemOperand(a1, JSGeneratorObject::kContinuationOffset)); 931 __ sw(a2, FieldMemOperand(a1, JSGeneratorObject::kContinuationOffset));
932 __ Move(v0, a1); // Continuation expects generator object in v0.
935 __ Jump(a3); 933 __ Jump(a3);
936 } 934 }
937 935
938 // Generate code for entering a JS function with the interpreter. 936 // Generate code for entering a JS function with the interpreter.
939 // On entry to the function the receiver and arguments have been pushed on the 937 // On entry to the function the receiver and arguments have been pushed on the
940 // stack left to right. The actual argument count matches the formal parameter 938 // stack left to right. The actual argument count matches the formal parameter
941 // count expected by the function. 939 // count expected by the function.
942 // 940 //
943 // The live registers are: 941 // The live registers are:
944 // o a1: the JS function object being called. 942 // o a1: the JS function object being called.
(...skipping 1765 matching lines...) Expand 10 before | Expand all | Expand 10 after
2710 } 2708 }
2711 } 2709 }
2712 2710
2713 2711
2714 #undef __ 2712 #undef __
2715 2713
2716 } // namespace internal 2714 } // namespace internal
2717 } // namespace v8 2715 } // namespace v8
2718 2716
2719 #endif // V8_TARGET_ARCH_MIPS 2717 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/ia32/builtins-ia32.cc ('k') | src/mips64/builtins-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698