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 #if V8_TARGET_ARCH_X64 | 5 #if V8_TARGET_ARCH_X64 |
6 | 6 |
7 #include "src/ast/scopes.h" | 7 #include "src/ast/scopes.h" |
8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 1767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1778 SetExpressionPosition(expr); | 1778 SetExpressionPosition(expr); |
1779 | 1779 |
1780 // Evaluate yielded value first; the initial iterator definition depends on | 1780 // Evaluate yielded value first; the initial iterator definition depends on |
1781 // this. It stays on the stack while we update the iterator. | 1781 // this. It stays on the stack while we update the iterator. |
1782 VisitForStackValue(expr->expression()); | 1782 VisitForStackValue(expr->expression()); |
1783 | 1783 |
1784 Label suspend, continuation, post_runtime, resume, exception; | 1784 Label suspend, continuation, post_runtime, resume, exception; |
1785 | 1785 |
1786 __ jmp(&suspend); | 1786 __ jmp(&suspend); |
1787 __ bind(&continuation); | 1787 __ bind(&continuation); |
1788 // When we arrive here, the stack top is the resume mode and | |
1789 // result_register() holds the input value (the argument given to the | |
1790 // respective resume operation). | |
1791 __ RecordGeneratorContinuation(); | 1788 __ RecordGeneratorContinuation(); |
1792 __ Pop(rbx); | 1789 // When we arrive here, rax holds the generator object. |
| 1790 __ movp(rbx, FieldOperand(rax, JSGeneratorObject::kResumeModeOffset)); |
| 1791 __ movp(rax, FieldOperand(rax, JSGeneratorObject::kInputOffset)); |
1793 STATIC_ASSERT(JSGeneratorObject::kNext < JSGeneratorObject::kReturn); | 1792 STATIC_ASSERT(JSGeneratorObject::kNext < JSGeneratorObject::kReturn); |
1794 STATIC_ASSERT(JSGeneratorObject::kThrow > JSGeneratorObject::kReturn); | 1793 STATIC_ASSERT(JSGeneratorObject::kThrow > JSGeneratorObject::kReturn); |
1795 __ SmiCompare(rbx, Smi::FromInt(JSGeneratorObject::kReturn)); | 1794 __ SmiCompare(rbx, Smi::FromInt(JSGeneratorObject::kReturn)); |
1796 __ j(less, &resume); | 1795 __ j(less, &resume); |
1797 __ Push(result_register()); | 1796 __ Push(result_register()); |
1798 __ j(greater, &exception); | 1797 __ j(greater, &exception); |
1799 EmitCreateIteratorResult(true); | 1798 EmitCreateIteratorResult(true); |
1800 EmitUnwindAndReturn(); | 1799 EmitUnwindAndReturn(); |
1801 | 1800 |
1802 __ bind(&exception); | 1801 __ bind(&exception); |
(...skipping 2078 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3881 DCHECK_EQ( | 3880 DCHECK_EQ( |
3882 isolate->builtins()->OnStackReplacement()->entry(), | 3881 isolate->builtins()->OnStackReplacement()->entry(), |
3883 Assembler::target_address_at(call_target_address, unoptimized_code)); | 3882 Assembler::target_address_at(call_target_address, unoptimized_code)); |
3884 return ON_STACK_REPLACEMENT; | 3883 return ON_STACK_REPLACEMENT; |
3885 } | 3884 } |
3886 | 3885 |
3887 } // namespace internal | 3886 } // namespace internal |
3888 } // namespace v8 | 3887 } // namespace v8 |
3889 | 3888 |
3890 #endif // V8_TARGET_ARCH_X64 | 3889 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |