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