| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_PPC | 5 #if V8_TARGET_ARCH_PPC |
| 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 1714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1725 context()->Plug(r3); | 1725 context()->Plug(r3); |
| 1726 break; | 1726 break; |
| 1727 case KEYED_PROPERTY: | 1727 case KEYED_PROPERTY: |
| 1728 EmitKeyedPropertyAssignment(expr); | 1728 EmitKeyedPropertyAssignment(expr); |
| 1729 break; | 1729 break; |
| 1730 } | 1730 } |
| 1731 } | 1731 } |
| 1732 | 1732 |
| 1733 | 1733 |
| 1734 void FullCodeGenerator::VisitYield(Yield* expr) { | 1734 void FullCodeGenerator::VisitYield(Yield* expr) { |
| 1735 Comment cmnt(masm_, "[ Yield"); | 1735 // Resumable functions are not supported. |
| 1736 SetExpressionPosition(expr); | 1736 UNREACHABLE(); |
| 1737 | |
| 1738 // Evaluate yielded value first; the initial iterator definition depends on | |
| 1739 // this. It stays on the stack while we update the iterator. | |
| 1740 VisitForStackValue(expr->expression()); | |
| 1741 | |
| 1742 Label suspend, continuation, post_runtime, resume, exception; | |
| 1743 | |
| 1744 __ b(&suspend); | |
| 1745 __ bind(&continuation); | |
| 1746 // When we arrive here, r3 holds the generator object. | |
| 1747 __ RecordGeneratorContinuation(); | |
| 1748 __ LoadP(r4, FieldMemOperand(r3, JSGeneratorObject::kResumeModeOffset)); | |
| 1749 __ LoadP(r3, FieldMemOperand(r3, JSGeneratorObject::kInputOrDebugPosOffset)); | |
| 1750 STATIC_ASSERT(JSGeneratorObject::kNext < JSGeneratorObject::kReturn); | |
| 1751 STATIC_ASSERT(JSGeneratorObject::kThrow > JSGeneratorObject::kReturn); | |
| 1752 __ CmpSmiLiteral(r4, Smi::FromInt(JSGeneratorObject::kReturn), r0); | |
| 1753 __ blt(&resume); | |
| 1754 __ Push(result_register()); | |
| 1755 __ bgt(&exception); | |
| 1756 EmitCreateIteratorResult(true); | |
| 1757 EmitUnwindAndReturn(); | |
| 1758 | |
| 1759 __ bind(&exception); | |
| 1760 __ CallRuntime(expr->rethrow_on_exception() ? Runtime::kReThrow | |
| 1761 : Runtime::kThrow); | |
| 1762 | |
| 1763 __ bind(&suspend); | |
| 1764 OperandStackDepthIncrement(1); // Not popped on this path. | |
| 1765 VisitForAccumulatorValue(expr->generator_object()); | |
| 1766 DCHECK(continuation.pos() > 0 && Smi::IsValid(continuation.pos())); | |
| 1767 __ LoadSmiLiteral(r4, Smi::FromInt(continuation.pos())); | |
| 1768 __ StoreP(r4, FieldMemOperand(r3, JSGeneratorObject::kContinuationOffset), | |
| 1769 r0); | |
| 1770 __ StoreP(cp, FieldMemOperand(r3, JSGeneratorObject::kContextOffset), r0); | |
| 1771 __ mr(r4, cp); | |
| 1772 __ RecordWriteField(r3, JSGeneratorObject::kContextOffset, r4, r5, | |
| 1773 kLRHasBeenSaved, kDontSaveFPRegs); | |
| 1774 __ addi(r4, fp, Operand(StandardFrameConstants::kExpressionsOffset)); | |
| 1775 __ cmp(sp, r4); | |
| 1776 __ beq(&post_runtime); | |
| 1777 __ push(r3); // generator object | |
| 1778 __ CallRuntime(Runtime::kSuspendJSGeneratorObject, 1); | |
| 1779 RestoreContext(); | |
| 1780 __ bind(&post_runtime); | |
| 1781 PopOperand(result_register()); | |
| 1782 EmitReturnSequence(); | |
| 1783 | |
| 1784 __ bind(&resume); | |
| 1785 context()->Plug(result_register()); | |
| 1786 } | 1737 } |
| 1787 | 1738 |
| 1788 void FullCodeGenerator::PushOperands(Register reg1, Register reg2) { | 1739 void FullCodeGenerator::PushOperands(Register reg1, Register reg2) { |
| 1789 OperandStackDepthIncrement(2); | 1740 OperandStackDepthIncrement(2); |
| 1790 __ Push(reg1, reg2); | 1741 __ Push(reg1, reg2); |
| 1791 } | 1742 } |
| 1792 | 1743 |
| 1793 void FullCodeGenerator::PushOperands(Register reg1, Register reg2, | 1744 void FullCodeGenerator::PushOperands(Register reg1, Register reg2, |
| 1794 Register reg3) { | 1745 Register reg3) { |
| 1795 OperandStackDepthIncrement(3); | 1746 OperandStackDepthIncrement(3); |
| (...skipping 1831 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3627 | 3578 |
| 3628 DCHECK(Assembler::IsCrSet(Assembler::instr_at(cmp_address))); | 3579 DCHECK(Assembler::IsCrSet(Assembler::instr_at(cmp_address))); |
| 3629 | 3580 |
| 3630 DCHECK(interrupt_address == | 3581 DCHECK(interrupt_address == |
| 3631 isolate->builtins()->OnStackReplacement()->entry()); | 3582 isolate->builtins()->OnStackReplacement()->entry()); |
| 3632 return ON_STACK_REPLACEMENT; | 3583 return ON_STACK_REPLACEMENT; |
| 3633 } | 3584 } |
| 3634 } // namespace internal | 3585 } // namespace internal |
| 3635 } // namespace v8 | 3586 } // namespace v8 |
| 3636 #endif // V8_TARGET_ARCH_PPC | 3587 #endif // V8_TARGET_ARCH_PPC |
| OLD | NEW |