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

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

Issue 1751613004: Get rid of the different kinds of yield in the AST & full-codegen. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Do an inline call. Created 4 years, 9 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/full-codegen/mips/full-codegen-mips.cc ('k') | src/full-codegen/ppc/full-codegen-ppc.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_MIPS64 5 #if V8_TARGET_ARCH_MIPS64
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 1832 matching lines...) Expand 10 before | Expand all | Expand 10 after
1843 1843
1844 1844
1845 void FullCodeGenerator::VisitYield(Yield* expr) { 1845 void FullCodeGenerator::VisitYield(Yield* expr) {
1846 Comment cmnt(masm_, "[ Yield"); 1846 Comment cmnt(masm_, "[ Yield");
1847 SetExpressionPosition(expr); 1847 SetExpressionPosition(expr);
1848 1848
1849 // Evaluate yielded value first; the initial iterator definition depends on 1849 // Evaluate yielded value first; the initial iterator definition depends on
1850 // this. It stays on the stack while we update the iterator. 1850 // this. It stays on the stack while we update the iterator.
1851 VisitForStackValue(expr->expression()); 1851 VisitForStackValue(expr->expression());
1852 1852
1853 switch (expr->yield_kind()) { 1853 Label suspend, continuation, post_runtime, resume;
1854 case Yield::kSuspend:
1855 // Pop value from top-of-stack slot; box result into result register.
1856 EmitCreateIteratorResult(false);
1857 PushOperand(result_register());
1858 // Fall through.
1859 case Yield::kInitial: {
1860 Label suspend, continuation, post_runtime, resume;
1861 1854
1862 __ jmp(&suspend); 1855 __ jmp(&suspend);
1863 __ bind(&continuation); 1856 __ bind(&continuation);
1864 // When we arrive here, the stack top is the resume mode and 1857 // When we arrive here, the stack top is the resume mode and
1865 // result_register() holds the input value (the argument given to the 1858 // result_register() holds the input value (the argument given to the
1866 // respective resume operation). 1859 // respective resume operation).
1867 __ RecordGeneratorContinuation(); 1860 __ RecordGeneratorContinuation();
1868 __ pop(a1); 1861 __ pop(a1);
1869 __ Branch(&resume, ne, a1, 1862 __ Branch(&resume, ne, a1, Operand(Smi::FromInt(JSGeneratorObject::RETURN)));
1870 Operand(Smi::FromInt(JSGeneratorObject::RETURN))); 1863 __ push(result_register());
1871 __ push(result_register()); 1864 EmitCreateIteratorResult(true);
1872 EmitCreateIteratorResult(true); 1865 EmitUnwindAndReturn();
1873 EmitUnwindAndReturn();
1874 1866
1875 __ bind(&suspend); 1867 __ bind(&suspend);
1876 OperandStackDepthIncrement(1); // Not popped on this path. 1868 OperandStackDepthIncrement(1); // Not popped on this path.
1877 VisitForAccumulatorValue(expr->generator_object()); 1869 VisitForAccumulatorValue(expr->generator_object());
1878 DCHECK(continuation.pos() > 0 && Smi::IsValid(continuation.pos())); 1870 DCHECK(continuation.pos() > 0 && Smi::IsValid(continuation.pos()));
1879 __ li(a1, Operand(Smi::FromInt(continuation.pos()))); 1871 __ li(a1, Operand(Smi::FromInt(continuation.pos())));
1880 __ sd(a1, FieldMemOperand(v0, JSGeneratorObject::kContinuationOffset)); 1872 __ sd(a1, FieldMemOperand(v0, JSGeneratorObject::kContinuationOffset));
1881 __ sd(cp, FieldMemOperand(v0, JSGeneratorObject::kContextOffset)); 1873 __ sd(cp, FieldMemOperand(v0, JSGeneratorObject::kContextOffset));
1882 __ mov(a1, cp); 1874 __ mov(a1, cp);
1883 __ RecordWriteField(v0, JSGeneratorObject::kContextOffset, a1, a2, 1875 __ RecordWriteField(v0, JSGeneratorObject::kContextOffset, a1, a2,
1884 kRAHasBeenSaved, kDontSaveFPRegs); 1876 kRAHasBeenSaved, kDontSaveFPRegs);
1885 __ Daddu(a1, fp, Operand(StandardFrameConstants::kExpressionsOffset)); 1877 __ Daddu(a1, fp, Operand(StandardFrameConstants::kExpressionsOffset));
1886 __ Branch(&post_runtime, eq, sp, Operand(a1)); 1878 __ Branch(&post_runtime, eq, sp, Operand(a1));
1887 __ push(v0); // generator object 1879 __ push(v0); // generator object
1888 __ CallRuntime(Runtime::kSuspendJSGeneratorObject, 1); 1880 __ CallRuntime(Runtime::kSuspendJSGeneratorObject, 1);
1889 __ ld(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 1881 __ ld(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
1890 __ bind(&post_runtime); 1882 __ bind(&post_runtime);
1891 PopOperand(result_register()); 1883 PopOperand(result_register());
1892 EmitReturnSequence(); 1884 EmitReturnSequence();
1893 1885
1894 __ bind(&resume); 1886 __ bind(&resume);
1895 context()->Plug(result_register()); 1887 context()->Plug(result_register());
1896 break;
1897 }
1898
1899 case Yield::kFinal: {
1900 // Pop value from top-of-stack slot, box result into result register.
1901 EmitCreateIteratorResult(true);
1902 EmitUnwindAndReturn();
1903 break;
1904 }
1905
1906 case Yield::kDelegating:
1907 UNREACHABLE();
1908 }
1909 } 1888 }
1910 1889
1911 1890
1912 void FullCodeGenerator::EmitGeneratorResume(Expression *generator, 1891 void FullCodeGenerator::EmitGeneratorResume(Expression *generator,
1913 Expression *value, 1892 Expression *value,
1914 JSGeneratorObject::ResumeMode resume_mode) { 1893 JSGeneratorObject::ResumeMode resume_mode) {
1915 // The value stays in a0, and is ultimately read by the resumed generator, as 1894 // The value stays in a0, and is ultimately read by the resumed generator, as
1916 // if CallRuntime(Runtime::kSuspendJSGeneratorObject) returned it. Or it 1895 // if CallRuntime(Runtime::kSuspendJSGeneratorObject) returned it. Or it
1917 // is read to throw the value when the resumed generator is already closed. 1896 // is read to throw the value when the resumed generator is already closed.
1918 // a1 will hold the generator object until the activation has been resumed. 1897 // a1 will hold the generator object until the activation has been resumed.
(...skipping 2300 matching lines...) Expand 10 before | Expand all | Expand 10 after
4219 reinterpret_cast<uint64_t>( 4198 reinterpret_cast<uint64_t>(
4220 isolate->builtins()->OsrAfterStackCheck()->entry())); 4199 isolate->builtins()->OsrAfterStackCheck()->entry()));
4221 return OSR_AFTER_STACK_CHECK; 4200 return OSR_AFTER_STACK_CHECK;
4222 } 4201 }
4223 4202
4224 4203
4225 } // namespace internal 4204 } // namespace internal
4226 } // namespace v8 4205 } // namespace v8
4227 4206
4228 #endif // V8_TARGET_ARCH_MIPS64 4207 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « src/full-codegen/mips/full-codegen-mips.cc ('k') | src/full-codegen/ppc/full-codegen-ppc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698