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

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

Issue 1648773003: [generators] Remove full-codegen implementation of yield*. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@yield-star-with-return
Patch Set: 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
« 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 1959 matching lines...) Expand 10 before | Expand all | Expand 10 after
1970 } 1970 }
1971 1971
1972 case Yield::kFinal: { 1972 case Yield::kFinal: {
1973 // Pop value from top-of-stack slot, box result into result register. 1973 // Pop value from top-of-stack slot, box result into result register.
1974 EmitCreateIteratorResult(true); 1974 EmitCreateIteratorResult(true);
1975 EmitUnwindBeforeReturn(); 1975 EmitUnwindBeforeReturn();
1976 EmitReturnSequence(); 1976 EmitReturnSequence();
1977 break; 1977 break;
1978 } 1978 }
1979 1979
1980 case Yield::kDelegating: { 1980 case Yield::kDelegating:
1981 VisitForStackValue(expr->generator_object()); 1981 UNREACHABLE();
1982
1983 // Initial stack layout is as follows:
1984 // [sp + 1 * kPointerSize] iter
1985 // [sp + 0 * kPointerSize] g
1986
1987 Label l_catch, l_try, l_suspend, l_continuation, l_resume;
1988 Label l_next, l_call;
1989 Register load_receiver = LoadDescriptor::ReceiverRegister();
1990 Register load_name = LoadDescriptor::NameRegister();
1991
1992 // Initial send value is undefined.
1993 __ LoadRoot(a0, Heap::kUndefinedValueRootIndex);
1994 __ Branch(&l_next);
1995
1996 // catch (e) { receiver = iter; f = 'throw'; arg = e; goto l_call; }
1997 __ bind(&l_catch);
1998 __ mov(a0, v0);
1999 __ LoadRoot(a2, Heap::kthrow_stringRootIndex); // "throw"
2000 __ ld(a3, MemOperand(sp, 1 * kPointerSize)); // iter
2001 __ Push(a2, a3, a0); // "throw", iter, except
2002 __ jmp(&l_call);
2003
2004 // try { received = %yield result }
2005 // Shuffle the received result above a try handler and yield it without
2006 // re-boxing.
2007 __ bind(&l_try);
2008 __ pop(a0); // result
2009 int handler_index = NewHandlerTableEntry();
2010 EnterTryBlock(handler_index, &l_catch);
2011 const int try_block_size = TryCatch::kElementCount * kPointerSize;
2012 __ push(a0); // result
2013
2014 __ jmp(&l_suspend);
2015 __ bind(&l_continuation);
2016 __ RecordGeneratorContinuation();
2017 __ mov(a0, v0);
2018 __ jmp(&l_resume);
2019
2020 __ bind(&l_suspend);
2021 const int generator_object_depth = kPointerSize + try_block_size;
2022 __ ld(a0, MemOperand(sp, generator_object_depth));
2023 __ push(a0); // g
2024 __ Push(Smi::FromInt(handler_index)); // handler-index
2025 DCHECK(l_continuation.pos() > 0 && Smi::IsValid(l_continuation.pos()));
2026 __ li(a1, Operand(Smi::FromInt(l_continuation.pos())));
2027 __ sd(a1, FieldMemOperand(a0, JSGeneratorObject::kContinuationOffset));
2028 __ sd(cp, FieldMemOperand(a0, JSGeneratorObject::kContextOffset));
2029 __ mov(a1, cp);
2030 __ RecordWriteField(a0, JSGeneratorObject::kContextOffset, a1, a2,
2031 kRAHasBeenSaved, kDontSaveFPRegs);
2032 __ CallRuntime(Runtime::kSuspendJSGeneratorObject, 2);
2033 __ ld(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
2034 __ pop(v0); // result
2035 EmitReturnSequence();
2036 __ mov(a0, v0);
2037 __ bind(&l_resume); // received in a0
2038 ExitTryBlock(handler_index);
2039
2040 // receiver = iter; f = 'next'; arg = received;
2041 __ bind(&l_next);
2042 __ LoadRoot(load_name, Heap::knext_stringRootIndex); // "next"
2043 __ ld(a3, MemOperand(sp, 1 * kPointerSize)); // iter
2044 __ Push(load_name, a3, a0); // "next", iter, received
2045
2046 // result = receiver[f](arg);
2047 __ bind(&l_call);
2048 __ ld(load_receiver, MemOperand(sp, kPointerSize));
2049 __ ld(load_name, MemOperand(sp, 2 * kPointerSize));
2050 __ li(LoadDescriptor::SlotRegister(),
2051 Operand(SmiFromSlot(expr->KeyedLoadFeedbackSlot())));
2052 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate(), SLOPPY).code();
2053 CallIC(ic, TypeFeedbackId::None());
2054 __ mov(a0, v0);
2055 __ mov(a1, a0);
2056 __ sd(a1, MemOperand(sp, 2 * kPointerSize));
2057 SetCallPosition(expr);
2058 __ li(a0, Operand(1));
2059 __ Call(
2060 isolate()->builtins()->Call(ConvertReceiverMode::kNotNullOrUndefined),
2061 RelocInfo::CODE_TARGET);
2062
2063 __ ld(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
2064 __ Drop(1); // The function is still on the stack; drop it.
2065
2066 // if (!result.done) goto l_try;
2067 __ Move(load_receiver, v0);
2068
2069 __ push(load_receiver); // save result
2070 __ LoadRoot(load_name, Heap::kdone_stringRootIndex); // "done"
2071 __ li(LoadDescriptor::SlotRegister(),
2072 Operand(SmiFromSlot(expr->DoneFeedbackSlot())));
2073 CallLoadIC(NOT_INSIDE_TYPEOF); // v0=result.done
2074 __ mov(a0, v0);
2075 Handle<Code> bool_ic = ToBooleanStub::GetUninitialized(isolate());
2076 CallIC(bool_ic);
2077 __ LoadRoot(at, Heap::kTrueValueRootIndex);
2078 __ Branch(&l_try, ne, result_register(), Operand(at));
2079
2080 // result.value
2081 __ pop(load_receiver); // result
2082 __ LoadRoot(load_name, Heap::kvalue_stringRootIndex); // "value"
2083 __ li(LoadDescriptor::SlotRegister(),
2084 Operand(SmiFromSlot(expr->ValueFeedbackSlot())));
2085 CallLoadIC(NOT_INSIDE_TYPEOF); // v0=result.value
2086 context()->DropAndPlug(2, v0); // drop iter and g
2087 break;
2088 }
2089 } 1982 }
2090 } 1983 }
2091 1984
2092 1985
2093 void FullCodeGenerator::EmitGeneratorResume(Expression *generator, 1986 void FullCodeGenerator::EmitGeneratorResume(Expression *generator,
2094 Expression *value, 1987 Expression *value,
2095 JSGeneratorObject::ResumeMode resume_mode) { 1988 JSGeneratorObject::ResumeMode resume_mode) {
2096 // The value stays in a0, and is ultimately read by the resumed generator, as 1989 // The value stays in a0, and is ultimately read by the resumed generator, as
2097 // if CallRuntime(Runtime::kSuspendJSGeneratorObject) returned it. Or it 1990 // if CallRuntime(Runtime::kSuspendJSGeneratorObject) returned it. Or it
2098 // is read to throw the value when the resumed generator is already closed. 1991 // is read to throw the value when the resumed generator is already closed.
(...skipping 2718 matching lines...) Expand 10 before | Expand all | Expand 10 after
4817 reinterpret_cast<uint64_t>( 4710 reinterpret_cast<uint64_t>(
4818 isolate->builtins()->OsrAfterStackCheck()->entry())); 4711 isolate->builtins()->OsrAfterStackCheck()->entry()));
4819 return OSR_AFTER_STACK_CHECK; 4712 return OSR_AFTER_STACK_CHECK;
4820 } 4713 }
4821 4714
4822 4715
4823 } // namespace internal 4716 } // namespace internal
4824 } // namespace v8 4717 } // namespace v8
4825 4718
4826 #endif // V8_TARGET_ARCH_MIPS64 4719 #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