OLD | NEW |
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 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_X64 | 7 #if V8_TARGET_ARCH_X64 |
8 | 8 |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 1920 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1931 } | 1931 } |
1932 | 1932 |
1933 | 1933 |
1934 void FullCodeGenerator::VisitYield(Yield* expr) { | 1934 void FullCodeGenerator::VisitYield(Yield* expr) { |
1935 Comment cmnt(masm_, "[ Yield"); | 1935 Comment cmnt(masm_, "[ Yield"); |
1936 // Evaluate yielded value first; the initial iterator definition depends on | 1936 // Evaluate yielded value first; the initial iterator definition depends on |
1937 // this. It stays on the stack while we update the iterator. | 1937 // this. It stays on the stack while we update the iterator. |
1938 VisitForStackValue(expr->expression()); | 1938 VisitForStackValue(expr->expression()); |
1939 | 1939 |
1940 switch (expr->yield_kind()) { | 1940 switch (expr->yield_kind()) { |
1941 case Yield::SUSPEND: | 1941 case Yield::kSuspend: |
1942 // Pop value from top-of-stack slot; box result into result register. | 1942 // Pop value from top-of-stack slot; box result into result register. |
1943 EmitCreateIteratorResult(false); | 1943 EmitCreateIteratorResult(false); |
1944 __ Push(result_register()); | 1944 __ Push(result_register()); |
1945 // Fall through. | 1945 // Fall through. |
1946 case Yield::INITIAL: { | 1946 case Yield::kInitial: { |
1947 Label suspend, continuation, post_runtime, resume; | 1947 Label suspend, continuation, post_runtime, resume; |
1948 | 1948 |
1949 __ jmp(&suspend); | 1949 __ jmp(&suspend); |
1950 | 1950 |
1951 __ bind(&continuation); | 1951 __ bind(&continuation); |
1952 __ jmp(&resume); | 1952 __ jmp(&resume); |
1953 | 1953 |
1954 __ bind(&suspend); | 1954 __ bind(&suspend); |
1955 VisitForAccumulatorValue(expr->generator_object()); | 1955 VisitForAccumulatorValue(expr->generator_object()); |
1956 DCHECK(continuation.pos() > 0 && Smi::IsValid(continuation.pos())); | 1956 DCHECK(continuation.pos() > 0 && Smi::IsValid(continuation.pos())); |
(...skipping 13 matching lines...) Expand all Loading... |
1970 __ bind(&post_runtime); | 1970 __ bind(&post_runtime); |
1971 | 1971 |
1972 __ Pop(result_register()); | 1972 __ Pop(result_register()); |
1973 EmitReturnSequence(); | 1973 EmitReturnSequence(); |
1974 | 1974 |
1975 __ bind(&resume); | 1975 __ bind(&resume); |
1976 context()->Plug(result_register()); | 1976 context()->Plug(result_register()); |
1977 break; | 1977 break; |
1978 } | 1978 } |
1979 | 1979 |
1980 case Yield::FINAL: { | 1980 case Yield::kFinal: { |
1981 VisitForAccumulatorValue(expr->generator_object()); | 1981 VisitForAccumulatorValue(expr->generator_object()); |
1982 __ Move(FieldOperand(result_register(), | 1982 __ Move(FieldOperand(result_register(), |
1983 JSGeneratorObject::kContinuationOffset), | 1983 JSGeneratorObject::kContinuationOffset), |
1984 Smi::FromInt(JSGeneratorObject::kGeneratorClosed)); | 1984 Smi::FromInt(JSGeneratorObject::kGeneratorClosed)); |
1985 // Pop value from top-of-stack slot, box result into result register. | 1985 // Pop value from top-of-stack slot, box result into result register. |
1986 EmitCreateIteratorResult(true); | 1986 EmitCreateIteratorResult(true); |
1987 EmitUnwindBeforeReturn(); | 1987 EmitUnwindBeforeReturn(); |
1988 EmitReturnSequence(); | 1988 EmitReturnSequence(); |
1989 break; | 1989 break; |
1990 } | 1990 } |
1991 | 1991 |
1992 case Yield::DELEGATING: { | 1992 case Yield::kDelegating: { |
1993 VisitForStackValue(expr->generator_object()); | 1993 VisitForStackValue(expr->generator_object()); |
1994 | 1994 |
1995 // Initial stack layout is as follows: | 1995 // Initial stack layout is as follows: |
1996 // [sp + 1 * kPointerSize] iter | 1996 // [sp + 1 * kPointerSize] iter |
1997 // [sp + 0 * kPointerSize] g | 1997 // [sp + 0 * kPointerSize] g |
1998 | 1998 |
1999 Label l_catch, l_try, l_suspend, l_continuation, l_resume; | 1999 Label l_catch, l_try, l_suspend, l_continuation, l_resume; |
2000 Label l_next, l_call, l_loop; | 2000 Label l_next, l_call, l_loop; |
2001 Register load_receiver = LoadConvention::ReceiverRegister(); | 2001 Register load_receiver = LoadConvention::ReceiverRegister(); |
2002 Register load_name = LoadConvention::NameRegister(); | 2002 Register load_name = LoadConvention::NameRegister(); |
(...skipping 2833 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4836 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), | 4836 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), |
4837 Assembler::target_address_at(call_target_address, | 4837 Assembler::target_address_at(call_target_address, |
4838 unoptimized_code)); | 4838 unoptimized_code)); |
4839 return OSR_AFTER_STACK_CHECK; | 4839 return OSR_AFTER_STACK_CHECK; |
4840 } | 4840 } |
4841 | 4841 |
4842 | 4842 |
4843 } } // namespace v8::internal | 4843 } } // namespace v8::internal |
4844 | 4844 |
4845 #endif // V8_TARGET_ARCH_X64 | 4845 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |