OLD | NEW |
---|---|
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/interpreter/interpreter.h" | 5 #include "src/interpreter/interpreter.h" |
6 | 6 |
7 #include <fstream> | 7 #include <fstream> |
8 | 8 |
9 #include "src/ast/prettyprinter.h" | 9 #include "src/ast/prettyprinter.h" |
10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
(...skipping 1667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1678 __ DispatchWide(OperandScale::kQuadruple); | 1678 __ DispatchWide(OperandScale::kQuadruple); |
1679 } | 1679 } |
1680 | 1680 |
1681 // Illegal | 1681 // Illegal |
1682 // | 1682 // |
1683 // An invalid bytecode aborting execution if dispatched. | 1683 // An invalid bytecode aborting execution if dispatched. |
1684 void Interpreter::DoIllegal(InterpreterAssembler* assembler) { | 1684 void Interpreter::DoIllegal(InterpreterAssembler* assembler) { |
1685 __ Abort(kInvalidBytecode); | 1685 __ Abort(kInvalidBytecode); |
1686 } | 1686 } |
1687 | 1687 |
1688 // SuspendGenerator <generator> | |
1689 // | |
1690 // Exports the register file and stores it into the generator. Also stores the | |
1691 // current context and the given state. | |
rmcilroy
2016/04/21 10:21:32
nit - s/the given state/the state given in the acc
neis
2016/04/21 11:30:15
Done.
| |
1692 void Interpreter::DoSuspendGenerator(InterpreterAssembler* assembler) { | |
1693 Node* generator_reg = __ BytecodeOperandReg(0); | |
1694 Node* generator = __ LoadRegister(generator_reg); | |
1695 | |
1696 Node* array = __ ExportRegisterFile(); | |
1697 Node* context = __ GetContext(); | |
1698 Node* state = __ GetAccumulator(); | |
1699 | |
1700 __ StoreObjectField(generator, JSGeneratorObject::kOperandStackOffset, array); | |
1701 __ StoreObjectField(generator, JSGeneratorObject::kContextOffset, context); | |
1702 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, state); | |
1703 | |
1704 __ Dispatch(); | |
1705 } | |
1706 | |
1707 // ResumeGenerator <generator> | |
1708 // | |
1709 // Imports the register file stored in the generator. Also loads the | |
1710 // generator's state, before overwriting it with kGeneratorExecuting. | |
rmcilroy
2016/04/21 10:21:32
nit - Also loads the generator's state and stores
neis
2016/04/21 11:30:15
Done.
| |
1711 void Interpreter::DoResumeGenerator(InterpreterAssembler* assembler) { | |
1712 Node* generator_reg = __ BytecodeOperandReg(0); | |
1713 Node* generator = __ LoadRegister(generator_reg); | |
1714 | |
1715 __ ImportRegisterFile( | |
1716 __ LoadObjectField(generator, JSGeneratorObject::kOperandStackOffset)); | |
1717 __ StoreObjectField(generator, JSGeneratorObject::kOperandStackOffset, | |
1718 __ HeapConstant(isolate_->factory()->empty_fixed_array())); | |
1719 | |
1720 Node* old_state = | |
1721 __ LoadObjectField(generator, JSGeneratorObject::kContinuationOffset); | |
1722 Node* new_state = __ Int32Constant(JSGeneratorObject::kGeneratorExecuting); | |
1723 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, | |
1724 __ SmiTag(new_state)); | |
1725 __ SetAccumulator(old_state); | |
1726 | |
1727 __ Dispatch(); | |
1728 } | |
1729 | |
1688 } // namespace interpreter | 1730 } // namespace interpreter |
1689 } // namespace internal | 1731 } // namespace internal |
1690 } // namespace v8 | 1732 } // namespace v8 |
OLD | NEW |