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

Side by Side Diff: src/full-codegen/mips/full-codegen-mips.cc

Issue 1639343005: [generators] Implement Generator.prototype.return. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@yield-star
Patch Set: Another rebase Created 4 years, 10 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
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 // Note on Mips implementation: 7 // Note on Mips implementation:
8 // 8 //
9 // The result_register() for mips is the 'v0' register, which is defined 9 // The result_register() for mips is the 'v0' register, which is defined
10 // by the ABI to contain function return values. However, the first 10 // by the ABI to contain function return values. However, the first
(...skipping 1917 matching lines...) Expand 10 before | Expand all | Expand 10 after
1928 case Yield::kSuspend: 1928 case Yield::kSuspend:
1929 // Pop value from top-of-stack slot; box result into result register. 1929 // Pop value from top-of-stack slot; box result into result register.
1930 EmitCreateIteratorResult(false); 1930 EmitCreateIteratorResult(false);
1931 __ push(result_register()); 1931 __ push(result_register());
1932 // Fall through. 1932 // Fall through.
1933 case Yield::kInitial: { 1933 case Yield::kInitial: {
1934 Label suspend, continuation, post_runtime, resume; 1934 Label suspend, continuation, post_runtime, resume;
1935 1935
1936 __ jmp(&suspend); 1936 __ jmp(&suspend);
1937 __ bind(&continuation); 1937 __ bind(&continuation);
1938 // When we arrive here, the stack top is the resume mode and
1939 // result_register() holds the input value (the argument given to the
1940 // respective resume operation).
1938 __ RecordGeneratorContinuation(); 1941 __ RecordGeneratorContinuation();
1939 __ jmp(&resume); 1942 __ pop(a1);
1943 __ Branch(&resume, ne, a1,
1944 Operand(Smi::FromInt(JSGeneratorObject::RETURN)));
1945 __ push(result_register());
1946 EmitCreateIteratorResult(true);
1947 EmitUnwindBeforeReturn();
1948 EmitReturnSequence();
1940 1949
1941 __ bind(&suspend); 1950 __ bind(&suspend);
1942 VisitForAccumulatorValue(expr->generator_object()); 1951 VisitForAccumulatorValue(expr->generator_object());
1943 DCHECK(continuation.pos() > 0 && Smi::IsValid(continuation.pos())); 1952 DCHECK(continuation.pos() > 0 && Smi::IsValid(continuation.pos()));
1944 __ li(a1, Operand(Smi::FromInt(continuation.pos()))); 1953 __ li(a1, Operand(Smi::FromInt(continuation.pos())));
1945 __ sw(a1, FieldMemOperand(v0, JSGeneratorObject::kContinuationOffset)); 1954 __ sw(a1, FieldMemOperand(v0, JSGeneratorObject::kContinuationOffset));
1946 __ sw(cp, FieldMemOperand(v0, JSGeneratorObject::kContextOffset)); 1955 __ sw(cp, FieldMemOperand(v0, JSGeneratorObject::kContextOffset));
1947 __ mov(a1, cp); 1956 __ mov(a1, cp);
1948 __ RecordWriteField(v0, JSGeneratorObject::kContextOffset, a1, a2, 1957 __ RecordWriteField(v0, JSGeneratorObject::kContextOffset, a1, a2,
1949 kRAHasBeenSaved, kDontSaveFPRegs); 1958 kRAHasBeenSaved, kDontSaveFPRegs);
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
2145 // in directly. 2154 // in directly.
2146 if (resume_mode == JSGeneratorObject::NEXT) { 2155 if (resume_mode == JSGeneratorObject::NEXT) {
2147 Label slow_resume; 2156 Label slow_resume;
2148 __ Branch(&slow_resume, ne, a3, Operand(zero_reg)); 2157 __ Branch(&slow_resume, ne, a3, Operand(zero_reg));
2149 __ lw(a3, FieldMemOperand(t0, JSFunction::kCodeEntryOffset)); 2158 __ lw(a3, FieldMemOperand(t0, JSFunction::kCodeEntryOffset));
2150 __ lw(a2, FieldMemOperand(a1, JSGeneratorObject::kContinuationOffset)); 2159 __ lw(a2, FieldMemOperand(a1, JSGeneratorObject::kContinuationOffset));
2151 __ SmiUntag(a2); 2160 __ SmiUntag(a2);
2152 __ Addu(a3, a3, Operand(a2)); 2161 __ Addu(a3, a3, Operand(a2));
2153 __ li(a2, Operand(Smi::FromInt(JSGeneratorObject::kGeneratorExecuting))); 2162 __ li(a2, Operand(Smi::FromInt(JSGeneratorObject::kGeneratorExecuting)));
2154 __ sw(a2, FieldMemOperand(a1, JSGeneratorObject::kContinuationOffset)); 2163 __ sw(a2, FieldMemOperand(a1, JSGeneratorObject::kContinuationOffset));
2164 __ Push(Smi::FromInt(resume_mode)); // Consumed in continuation.
2155 __ Jump(a3); 2165 __ Jump(a3);
2156 __ bind(&slow_resume); 2166 __ bind(&slow_resume);
2157 } 2167 }
2158 2168
2159 // Otherwise, we push holes for the operand stack and call the runtime to fix 2169 // Otherwise, we push holes for the operand stack and call the runtime to fix
2160 // up the stack and the handlers. 2170 // up the stack and the handlers.
2161 Label push_operand_holes, call_resume; 2171 Label push_operand_holes, call_resume;
2162 __ bind(&push_operand_holes); 2172 __ bind(&push_operand_holes);
2163 __ Subu(a3, a3, Operand(1)); 2173 __ Subu(a3, a3, Operand(1));
2164 __ Branch(&call_resume, lt, a3, Operand(zero_reg)); 2174 __ Branch(&call_resume, lt, a3, Operand(zero_reg));
2165 __ push(a2); 2175 __ push(a2);
2166 __ Branch(&push_operand_holes); 2176 __ Branch(&push_operand_holes);
2167 __ bind(&call_resume); 2177 __ bind(&call_resume);
2178 __ Push(Smi::FromInt(resume_mode)); // Consumed in continuation.
2168 DCHECK(!result_register().is(a1)); 2179 DCHECK(!result_register().is(a1));
2169 __ Push(a1, result_register()); 2180 __ Push(a1, result_register());
2170 __ Push(Smi::FromInt(resume_mode)); 2181 __ Push(Smi::FromInt(resume_mode));
2171 __ CallRuntime(Runtime::kResumeJSGeneratorObject); 2182 __ CallRuntime(Runtime::kResumeJSGeneratorObject);
2172 // Not reached: the runtime call returns elsewhere. 2183 // Not reached: the runtime call returns elsewhere.
2173 __ stop("not-reached"); 2184 __ stop("not-reached");
2174 2185
2175 __ bind(&done); 2186 __ bind(&done);
2176 context()->Plug(result_register()); 2187 context()->Plug(result_register());
2177 } 2188 }
(...skipping 2614 matching lines...) Expand 10 before | Expand all | Expand 10 after
4792 reinterpret_cast<uint32_t>( 4803 reinterpret_cast<uint32_t>(
4793 isolate->builtins()->OsrAfterStackCheck()->entry())); 4804 isolate->builtins()->OsrAfterStackCheck()->entry()));
4794 return OSR_AFTER_STACK_CHECK; 4805 return OSR_AFTER_STACK_CHECK;
4795 } 4806 }
4796 4807
4797 4808
4798 } // namespace internal 4809 } // namespace internal
4799 } // namespace v8 4810 } // namespace v8
4800 4811
4801 #endif // V8_TARGET_ARCH_MIPS 4812 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/full-codegen/ia32/full-codegen-ia32.cc ('k') | src/full-codegen/mips64/full-codegen-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698