| 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_IA32 | 7 #if V8_TARGET_ARCH_IA32 |
| 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 1888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1899 } | 1899 } |
| 1900 | 1900 |
| 1901 | 1901 |
| 1902 void FullCodeGenerator::VisitYield(Yield* expr) { | 1902 void FullCodeGenerator::VisitYield(Yield* expr) { |
| 1903 Comment cmnt(masm_, "[ Yield"); | 1903 Comment cmnt(masm_, "[ Yield"); |
| 1904 // Evaluate yielded value first; the initial iterator definition depends on | 1904 // Evaluate yielded value first; the initial iterator definition depends on |
| 1905 // this. It stays on the stack while we update the iterator. | 1905 // this. It stays on the stack while we update the iterator. |
| 1906 VisitForStackValue(expr->expression()); | 1906 VisitForStackValue(expr->expression()); |
| 1907 | 1907 |
| 1908 switch (expr->yield_kind()) { | 1908 switch (expr->yield_kind()) { |
| 1909 case Yield::SUSPEND: | 1909 case Yield::kSuspend: |
| 1910 // Pop value from top-of-stack slot; box result into result register. | 1910 // Pop value from top-of-stack slot; box result into result register. |
| 1911 EmitCreateIteratorResult(false); | 1911 EmitCreateIteratorResult(false); |
| 1912 __ push(result_register()); | 1912 __ push(result_register()); |
| 1913 // Fall through. | 1913 // Fall through. |
| 1914 case Yield::INITIAL: { | 1914 case Yield::kInitial: { |
| 1915 Label suspend, continuation, post_runtime, resume; | 1915 Label suspend, continuation, post_runtime, resume; |
| 1916 | 1916 |
| 1917 __ jmp(&suspend); | 1917 __ jmp(&suspend); |
| 1918 | 1918 |
| 1919 __ bind(&continuation); | 1919 __ bind(&continuation); |
| 1920 __ jmp(&resume); | 1920 __ jmp(&resume); |
| 1921 | 1921 |
| 1922 __ bind(&suspend); | 1922 __ bind(&suspend); |
| 1923 VisitForAccumulatorValue(expr->generator_object()); | 1923 VisitForAccumulatorValue(expr->generator_object()); |
| 1924 DCHECK(continuation.pos() > 0 && Smi::IsValid(continuation.pos())); | 1924 DCHECK(continuation.pos() > 0 && Smi::IsValid(continuation.pos())); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1937 Operand(ebp, StandardFrameConstants::kContextOffset)); | 1937 Operand(ebp, StandardFrameConstants::kContextOffset)); |
| 1938 __ bind(&post_runtime); | 1938 __ bind(&post_runtime); |
| 1939 __ pop(result_register()); | 1939 __ pop(result_register()); |
| 1940 EmitReturnSequence(); | 1940 EmitReturnSequence(); |
| 1941 | 1941 |
| 1942 __ bind(&resume); | 1942 __ bind(&resume); |
| 1943 context()->Plug(result_register()); | 1943 context()->Plug(result_register()); |
| 1944 break; | 1944 break; |
| 1945 } | 1945 } |
| 1946 | 1946 |
| 1947 case Yield::FINAL: { | 1947 case Yield::kFinal: { |
| 1948 VisitForAccumulatorValue(expr->generator_object()); | 1948 VisitForAccumulatorValue(expr->generator_object()); |
| 1949 __ mov(FieldOperand(result_register(), | 1949 __ mov(FieldOperand(result_register(), |
| 1950 JSGeneratorObject::kContinuationOffset), | 1950 JSGeneratorObject::kContinuationOffset), |
| 1951 Immediate(Smi::FromInt(JSGeneratorObject::kGeneratorClosed))); | 1951 Immediate(Smi::FromInt(JSGeneratorObject::kGeneratorClosed))); |
| 1952 // Pop value from top-of-stack slot, box result into result register. | 1952 // Pop value from top-of-stack slot, box result into result register. |
| 1953 EmitCreateIteratorResult(true); | 1953 EmitCreateIteratorResult(true); |
| 1954 EmitUnwindBeforeReturn(); | 1954 EmitUnwindBeforeReturn(); |
| 1955 EmitReturnSequence(); | 1955 EmitReturnSequence(); |
| 1956 break; | 1956 break; |
| 1957 } | 1957 } |
| 1958 | 1958 |
| 1959 case Yield::DELEGATING: { | 1959 case Yield::kDelegating: { |
| 1960 VisitForStackValue(expr->generator_object()); | 1960 VisitForStackValue(expr->generator_object()); |
| 1961 | 1961 |
| 1962 // Initial stack layout is as follows: | 1962 // Initial stack layout is as follows: |
| 1963 // [sp + 1 * kPointerSize] iter | 1963 // [sp + 1 * kPointerSize] iter |
| 1964 // [sp + 0 * kPointerSize] g | 1964 // [sp + 0 * kPointerSize] g |
| 1965 | 1965 |
| 1966 Label l_catch, l_try, l_suspend, l_continuation, l_resume; | 1966 Label l_catch, l_try, l_suspend, l_continuation, l_resume; |
| 1967 Label l_next, l_call, l_loop; | 1967 Label l_next, l_call, l_loop; |
| 1968 Register load_receiver = LoadConvention::ReceiverRegister(); | 1968 Register load_receiver = LoadConvention::ReceiverRegister(); |
| 1969 Register load_name = LoadConvention::NameRegister(); | 1969 Register load_name = LoadConvention::NameRegister(); |
| (...skipping 2856 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4826 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), | 4826 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), |
| 4827 Assembler::target_address_at(call_target_address, | 4827 Assembler::target_address_at(call_target_address, |
| 4828 unoptimized_code)); | 4828 unoptimized_code)); |
| 4829 return OSR_AFTER_STACK_CHECK; | 4829 return OSR_AFTER_STACK_CHECK; |
| 4830 } | 4830 } |
| 4831 | 4831 |
| 4832 | 4832 |
| 4833 } } // namespace v8::internal | 4833 } } // namespace v8::internal |
| 4834 | 4834 |
| 4835 #endif // V8_TARGET_ARCH_IA32 | 4835 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |