| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 1968 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1979 } | 1979 } |
| 1980 | 1980 |
| 1981 | 1981 |
| 1982 void FullCodeGenerator::VisitYield(Yield* expr) { | 1982 void FullCodeGenerator::VisitYield(Yield* expr) { |
| 1983 Comment cmnt(masm_, "[ Yield"); | 1983 Comment cmnt(masm_, "[ Yield"); |
| 1984 // Evaluate yielded value first; the initial iterator definition depends on | 1984 // Evaluate yielded value first; the initial iterator definition depends on |
| 1985 // this. It stays on the stack while we update the iterator. | 1985 // this. It stays on the stack while we update the iterator. |
| 1986 VisitForStackValue(expr->expression()); | 1986 VisitForStackValue(expr->expression()); |
| 1987 | 1987 |
| 1988 switch (expr->yield_kind()) { | 1988 switch (expr->yield_kind()) { |
| 1989 case Yield::SUSPEND: | 1989 case Yield::kSuspend: |
| 1990 // Pop value from top-of-stack slot; box result into result register. | 1990 // Pop value from top-of-stack slot; box result into result register. |
| 1991 EmitCreateIteratorResult(false); | 1991 EmitCreateIteratorResult(false); |
| 1992 __ push(result_register()); | 1992 __ push(result_register()); |
| 1993 // Fall through. | 1993 // Fall through. |
| 1994 case Yield::INITIAL: { | 1994 case Yield::kInitial: { |
| 1995 Label suspend, continuation, post_runtime, resume; | 1995 Label suspend, continuation, post_runtime, resume; |
| 1996 | 1996 |
| 1997 __ jmp(&suspend); | 1997 __ jmp(&suspend); |
| 1998 | 1998 |
| 1999 __ bind(&continuation); | 1999 __ bind(&continuation); |
| 2000 __ jmp(&resume); | 2000 __ jmp(&resume); |
| 2001 | 2001 |
| 2002 __ bind(&suspend); | 2002 __ bind(&suspend); |
| 2003 VisitForAccumulatorValue(expr->generator_object()); | 2003 VisitForAccumulatorValue(expr->generator_object()); |
| 2004 ASSERT(continuation.pos() > 0 && Smi::IsValid(continuation.pos())); | 2004 ASSERT(continuation.pos() > 0 && Smi::IsValid(continuation.pos())); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 2016 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 2016 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
| 2017 __ bind(&post_runtime); | 2017 __ bind(&post_runtime); |
| 2018 __ pop(result_register()); | 2018 __ pop(result_register()); |
| 2019 EmitReturnSequence(); | 2019 EmitReturnSequence(); |
| 2020 | 2020 |
| 2021 __ bind(&resume); | 2021 __ bind(&resume); |
| 2022 context()->Plug(result_register()); | 2022 context()->Plug(result_register()); |
| 2023 break; | 2023 break; |
| 2024 } | 2024 } |
| 2025 | 2025 |
| 2026 case Yield::FINAL: { | 2026 case Yield::kFinal: { |
| 2027 VisitForAccumulatorValue(expr->generator_object()); | 2027 VisitForAccumulatorValue(expr->generator_object()); |
| 2028 __ mov(r1, Operand(Smi::FromInt(JSGeneratorObject::kGeneratorClosed))); | 2028 __ mov(r1, Operand(Smi::FromInt(JSGeneratorObject::kGeneratorClosed))); |
| 2029 __ str(r1, FieldMemOperand(result_register(), | 2029 __ str(r1, FieldMemOperand(result_register(), |
| 2030 JSGeneratorObject::kContinuationOffset)); | 2030 JSGeneratorObject::kContinuationOffset)); |
| 2031 // Pop value from top-of-stack slot, box result into result register. | 2031 // Pop value from top-of-stack slot, box result into result register. |
| 2032 EmitCreateIteratorResult(true); | 2032 EmitCreateIteratorResult(true); |
| 2033 EmitUnwindBeforeReturn(); | 2033 EmitUnwindBeforeReturn(); |
| 2034 EmitReturnSequence(); | 2034 EmitReturnSequence(); |
| 2035 break; | 2035 break; |
| 2036 } | 2036 } |
| 2037 | 2037 |
| 2038 case Yield::DELEGATING: { | 2038 case Yield::kDelegating: { |
| 2039 VisitForStackValue(expr->generator_object()); | 2039 VisitForStackValue(expr->generator_object()); |
| 2040 | 2040 |
| 2041 // Initial stack layout is as follows: | 2041 // Initial stack layout is as follows: |
| 2042 // [sp + 1 * kPointerSize] iter | 2042 // [sp + 1 * kPointerSize] iter |
| 2043 // [sp + 0 * kPointerSize] g | 2043 // [sp + 0 * kPointerSize] g |
| 2044 | 2044 |
| 2045 Label l_catch, l_try, l_suspend, l_continuation, l_resume; | 2045 Label l_catch, l_try, l_suspend, l_continuation, l_resume; |
| 2046 Label l_next, l_call, l_loop; | 2046 Label l_next, l_call, l_loop; |
| 2047 // Initial send value is undefined. | 2047 // Initial send value is undefined. |
| 2048 __ LoadRoot(r0, Heap::kUndefinedValueRootIndex); | 2048 __ LoadRoot(r0, Heap::kUndefinedValueRootIndex); |
| (...skipping 2843 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4892 *context_length = 0; | 4892 *context_length = 0; |
| 4893 return previous_; | 4893 return previous_; |
| 4894 } | 4894 } |
| 4895 | 4895 |
| 4896 | 4896 |
| 4897 #undef __ | 4897 #undef __ |
| 4898 | 4898 |
| 4899 } } // namespace v8::internal | 4899 } } // namespace v8::internal |
| 4900 | 4900 |
| 4901 #endif // V8_TARGET_ARCH_ARM | 4901 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |