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