| 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 1927 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1938 } | 1938 } |
| 1939 | 1939 |
| 1940 | 1940 |
| 1941 void FullCodeGenerator::VisitYield(Yield* expr) { | 1941 void FullCodeGenerator::VisitYield(Yield* expr) { |
| 1942 Comment cmnt(masm_, "[ Yield"); | 1942 Comment cmnt(masm_, "[ Yield"); |
| 1943 // Evaluate yielded value first; the initial iterator definition depends on | 1943 // Evaluate yielded value first; the initial iterator definition depends on |
| 1944 // this. It stays on the stack while we update the iterator. | 1944 // this. It stays on the stack while we update the iterator. |
| 1945 VisitForStackValue(expr->expression()); | 1945 VisitForStackValue(expr->expression()); |
| 1946 | 1946 |
| 1947 switch (expr->yield_kind()) { | 1947 switch (expr->yield_kind()) { |
| 1948 case Yield::kSuspend: | 1948 case Yield::SUSPEND: |
| 1949 // Pop value from top-of-stack slot; box result into result register. | 1949 // Pop value from top-of-stack slot; box result into result register. |
| 1950 EmitCreateIteratorResult(false); | 1950 EmitCreateIteratorResult(false); |
| 1951 __ push(result_register()); | 1951 __ push(result_register()); |
| 1952 // Fall through. | 1952 // Fall through. |
| 1953 case Yield::kInitial: { | 1953 case Yield::INITIAL: { |
| 1954 Label suspend, continuation, post_runtime, resume; | 1954 Label suspend, continuation, post_runtime, resume; |
| 1955 | 1955 |
| 1956 __ jmp(&suspend); | 1956 __ jmp(&suspend); |
| 1957 | 1957 |
| 1958 __ bind(&continuation); | 1958 __ bind(&continuation); |
| 1959 __ jmp(&resume); | 1959 __ jmp(&resume); |
| 1960 | 1960 |
| 1961 __ bind(&suspend); | 1961 __ bind(&suspend); |
| 1962 VisitForAccumulatorValue(expr->generator_object()); | 1962 VisitForAccumulatorValue(expr->generator_object()); |
| 1963 ASSERT(continuation.pos() > 0 && Smi::IsValid(continuation.pos())); | 1963 ASSERT(continuation.pos() > 0 && Smi::IsValid(continuation.pos())); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1976 Operand(ebp, StandardFrameConstants::kContextOffset)); | 1976 Operand(ebp, StandardFrameConstants::kContextOffset)); |
| 1977 __ bind(&post_runtime); | 1977 __ bind(&post_runtime); |
| 1978 __ pop(result_register()); | 1978 __ pop(result_register()); |
| 1979 EmitReturnSequence(); | 1979 EmitReturnSequence(); |
| 1980 | 1980 |
| 1981 __ bind(&resume); | 1981 __ bind(&resume); |
| 1982 context()->Plug(result_register()); | 1982 context()->Plug(result_register()); |
| 1983 break; | 1983 break; |
| 1984 } | 1984 } |
| 1985 | 1985 |
| 1986 case Yield::kFinal: { | 1986 case Yield::FINAL: { |
| 1987 VisitForAccumulatorValue(expr->generator_object()); | 1987 VisitForAccumulatorValue(expr->generator_object()); |
| 1988 __ mov(FieldOperand(result_register(), | 1988 __ mov(FieldOperand(result_register(), |
| 1989 JSGeneratorObject::kContinuationOffset), | 1989 JSGeneratorObject::kContinuationOffset), |
| 1990 Immediate(Smi::FromInt(JSGeneratorObject::kGeneratorClosed))); | 1990 Immediate(Smi::FromInt(JSGeneratorObject::kGeneratorClosed))); |
| 1991 // Pop value from top-of-stack slot, box result into result register. | 1991 // Pop value from top-of-stack slot, box result into result register. |
| 1992 EmitCreateIteratorResult(true); | 1992 EmitCreateIteratorResult(true); |
| 1993 EmitUnwindBeforeReturn(); | 1993 EmitUnwindBeforeReturn(); |
| 1994 EmitReturnSequence(); | 1994 EmitReturnSequence(); |
| 1995 break; | 1995 break; |
| 1996 } | 1996 } |
| 1997 | 1997 |
| 1998 case Yield::kDelegating: { | 1998 case Yield::DELEGATING: { |
| 1999 VisitForStackValue(expr->generator_object()); | 1999 VisitForStackValue(expr->generator_object()); |
| 2000 | 2000 |
| 2001 // Initial stack layout is as follows: | 2001 // Initial stack layout is as follows: |
| 2002 // [sp + 1 * kPointerSize] iter | 2002 // [sp + 1 * kPointerSize] iter |
| 2003 // [sp + 0 * kPointerSize] g | 2003 // [sp + 0 * kPointerSize] g |
| 2004 | 2004 |
| 2005 Label l_catch, l_try, l_suspend, l_continuation, l_resume; | 2005 Label l_catch, l_try, l_suspend, l_continuation, l_resume; |
| 2006 Label l_next, l_call, l_loop; | 2006 Label l_next, l_call, l_loop; |
| 2007 // Initial send value is undefined. | 2007 // Initial send value is undefined. |
| 2008 __ mov(eax, isolate()->factory()->undefined_value()); | 2008 __ mov(eax, isolate()->factory()->undefined_value()); |
| (...skipping 2885 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4894 *stack_depth = 0; | 4894 *stack_depth = 0; |
| 4895 *context_length = 0; | 4895 *context_length = 0; |
| 4896 return previous_; | 4896 return previous_; |
| 4897 } | 4897 } |
| 4898 | 4898 |
| 4899 #undef __ | 4899 #undef __ |
| 4900 | 4900 |
| 4901 } } // namespace v8::internal | 4901 } } // namespace v8::internal |
| 4902 | 4902 |
| 4903 #endif // V8_TARGET_ARCH_IA32 | 4903 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |