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_ARM | 5 #if V8_TARGET_ARCH_ARM |
6 | 6 |
7 #include "src/full-codegen/full-codegen.h" | 7 #include "src/full-codegen/full-codegen.h" |
8 #include "src/ast/compile-time-value.h" | 8 #include "src/ast/compile-time-value.h" |
9 #include "src/ast/scopes.h" | 9 #include "src/ast/scopes.h" |
10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
(...skipping 1747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1758 context()->Plug(r0); | 1758 context()->Plug(r0); |
1759 break; | 1759 break; |
1760 case KEYED_PROPERTY: | 1760 case KEYED_PROPERTY: |
1761 EmitKeyedPropertyAssignment(expr); | 1761 EmitKeyedPropertyAssignment(expr); |
1762 break; | 1762 break; |
1763 } | 1763 } |
1764 } | 1764 } |
1765 | 1765 |
1766 | 1766 |
1767 void FullCodeGenerator::VisitYield(Yield* expr) { | 1767 void FullCodeGenerator::VisitYield(Yield* expr) { |
1768 Comment cmnt(masm_, "[ Yield"); | 1768 // Resumable functions are not supported. |
1769 SetExpressionPosition(expr); | 1769 UNREACHABLE(); |
1770 | |
1771 // Evaluate yielded value first; the initial iterator definition depends on | |
1772 // this. It stays on the stack while we update the iterator. | |
1773 VisitForStackValue(expr->expression()); | |
1774 | |
1775 Label suspend, continuation, post_runtime, resume, exception; | |
1776 | |
1777 __ jmp(&suspend); | |
1778 __ bind(&continuation); | |
1779 // When we arrive here, r0 holds the generator object. | |
1780 __ RecordGeneratorContinuation(); | |
1781 __ ldr(r1, FieldMemOperand(r0, JSGeneratorObject::kResumeModeOffset)); | |
1782 __ ldr(r0, FieldMemOperand(r0, JSGeneratorObject::kInputOrDebugPosOffset)); | |
1783 STATIC_ASSERT(JSGeneratorObject::kNext < JSGeneratorObject::kReturn); | |
1784 STATIC_ASSERT(JSGeneratorObject::kThrow > JSGeneratorObject::kReturn); | |
1785 __ cmp(r1, Operand(Smi::FromInt(JSGeneratorObject::kReturn))); | |
1786 __ b(lt, &resume); | |
1787 __ Push(result_register()); | |
1788 __ b(gt, &exception); | |
1789 EmitCreateIteratorResult(true); | |
1790 EmitUnwindAndReturn(); | |
1791 | |
1792 __ bind(&exception); | |
1793 __ CallRuntime(expr->rethrow_on_exception() ? Runtime::kReThrow | |
1794 : Runtime::kThrow); | |
1795 | |
1796 __ bind(&suspend); | |
1797 OperandStackDepthIncrement(1); // Not popped on this path. | |
1798 VisitForAccumulatorValue(expr->generator_object()); | |
1799 DCHECK(continuation.pos() > 0 && Smi::IsValid(continuation.pos())); | |
1800 __ mov(r1, Operand(Smi::FromInt(continuation.pos()))); | |
1801 __ str(r1, FieldMemOperand(r0, JSGeneratorObject::kContinuationOffset)); | |
1802 __ str(cp, FieldMemOperand(r0, JSGeneratorObject::kContextOffset)); | |
1803 __ mov(r1, cp); | |
1804 __ RecordWriteField(r0, JSGeneratorObject::kContextOffset, r1, r2, | |
1805 kLRHasBeenSaved, kDontSaveFPRegs); | |
1806 __ add(r1, fp, Operand(StandardFrameConstants::kExpressionsOffset)); | |
1807 __ cmp(sp, r1); | |
1808 __ b(eq, &post_runtime); | |
1809 __ push(r0); // generator object | |
1810 __ CallRuntime(Runtime::kSuspendJSGeneratorObject, 1); | |
1811 RestoreContext(); | |
1812 __ bind(&post_runtime); | |
1813 PopOperand(result_register()); | |
1814 EmitReturnSequence(); | |
1815 | |
1816 __ bind(&resume); | |
1817 context()->Plug(result_register()); | |
1818 } | 1770 } |
1819 | 1771 |
1820 void FullCodeGenerator::PushOperands(Register reg1, Register reg2) { | 1772 void FullCodeGenerator::PushOperands(Register reg1, Register reg2) { |
1821 OperandStackDepthIncrement(2); | 1773 OperandStackDepthIncrement(2); |
1822 __ Push(reg1, reg2); | 1774 __ Push(reg1, reg2); |
1823 } | 1775 } |
1824 | 1776 |
1825 void FullCodeGenerator::PopOperands(Register reg1, Register reg2) { | 1777 void FullCodeGenerator::PopOperands(Register reg1, Register reg2) { |
1826 OperandStackDepthDecrement(2); | 1778 OperandStackDepthDecrement(2); |
1827 __ Pop(reg1, reg2); | 1779 __ Pop(reg1, reg2); |
(...skipping 1867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3695 DCHECK(interrupt_address == | 3647 DCHECK(interrupt_address == |
3696 isolate->builtins()->OnStackReplacement()->entry()); | 3648 isolate->builtins()->OnStackReplacement()->entry()); |
3697 return ON_STACK_REPLACEMENT; | 3649 return ON_STACK_REPLACEMENT; |
3698 } | 3650 } |
3699 | 3651 |
3700 | 3652 |
3701 } // namespace internal | 3653 } // namespace internal |
3702 } // namespace v8 | 3654 } // namespace v8 |
3703 | 3655 |
3704 #endif // V8_TARGET_ARCH_ARM | 3656 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |