| 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 1718 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1729 } | 1729 } | 
| 1730 | 1730 | 
| 1731 // SuspendGenerator <generator> | 1731 // SuspendGenerator <generator> | 
| 1732 // | 1732 // | 
| 1733 // Exports the register file and stores it into the generator.  Also stores the | 1733 // Exports the register file and stores it into the generator.  Also stores the | 
| 1734 // current context and the state given in the accumulator into the generator. | 1734 // current context and the state given in the accumulator into the generator. | 
| 1735 void Interpreter::DoSuspendGenerator(InterpreterAssembler* assembler) { | 1735 void Interpreter::DoSuspendGenerator(InterpreterAssembler* assembler) { | 
| 1736   Node* generator_reg = __ BytecodeOperandReg(0); | 1736   Node* generator_reg = __ BytecodeOperandReg(0); | 
| 1737   Node* generator = __ LoadRegister(generator_reg); | 1737   Node* generator = __ LoadRegister(generator_reg); | 
| 1738 | 1738 | 
| 1739   Node* array = __ ExportRegisterFile(); | 1739   Node* array = | 
|  | 1740       __ LoadObjectField(generator, JSGeneratorObject::kOperandStackOffset); | 
| 1740   Node* context = __ GetContext(); | 1741   Node* context = __ GetContext(); | 
| 1741   Node* state = __ GetAccumulator(); | 1742   Node* state = __ GetAccumulator(); | 
| 1742 | 1743 | 
| 1743   __ StoreObjectField(generator, JSGeneratorObject::kOperandStackOffset, array); | 1744   __ ExportRegisterFile(array); | 
| 1744   __ StoreObjectField(generator, JSGeneratorObject::kContextOffset, context); | 1745   __ StoreObjectField(generator, JSGeneratorObject::kContextOffset, context); | 
| 1745   __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, state); | 1746   __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, state); | 
| 1746 | 1747 | 
| 1747   __ Dispatch(); | 1748   __ Dispatch(); | 
| 1748 } | 1749 } | 
| 1749 | 1750 | 
| 1750 // ResumeGenerator <generator> | 1751 // ResumeGenerator <generator> | 
| 1751 // | 1752 // | 
| 1752 // Imports the register file stored in the generator. Also loads the | 1753 // Imports the register file stored in the generator. Also loads the | 
| 1753 // generator's state and stores it in the accumulator, before overwriting it | 1754 // generator's state and stores it in the accumulator, before overwriting it | 
| 1754 // with kGeneratorExecuting. | 1755 // with kGeneratorExecuting. | 
| 1755 void Interpreter::DoResumeGenerator(InterpreterAssembler* assembler) { | 1756 void Interpreter::DoResumeGenerator(InterpreterAssembler* assembler) { | 
| 1756   Node* generator_reg = __ BytecodeOperandReg(0); | 1757   Node* generator_reg = __ BytecodeOperandReg(0); | 
| 1757   Node* generator = __ LoadRegister(generator_reg); | 1758   Node* generator = __ LoadRegister(generator_reg); | 
| 1758 | 1759 | 
| 1759   __ ImportRegisterFile( | 1760   __ ImportRegisterFile( | 
| 1760       __ LoadObjectField(generator, JSGeneratorObject::kOperandStackOffset)); | 1761       __ LoadObjectField(generator, JSGeneratorObject::kOperandStackOffset)); | 
| 1761   __ StoreObjectField(generator, JSGeneratorObject::kOperandStackOffset, |  | 
| 1762       __ HeapConstant(isolate_->factory()->empty_fixed_array())); |  | 
| 1763 | 1762 | 
| 1764   Node* old_state = | 1763   Node* old_state = | 
| 1765       __ LoadObjectField(generator, JSGeneratorObject::kContinuationOffset); | 1764       __ LoadObjectField(generator, JSGeneratorObject::kContinuationOffset); | 
| 1766   Node* new_state = __ Int32Constant(JSGeneratorObject::kGeneratorExecuting); | 1765   Node* new_state = __ Int32Constant(JSGeneratorObject::kGeneratorExecuting); | 
| 1767   __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, | 1766   __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, | 
| 1768       __ SmiTag(new_state)); | 1767       __ SmiTag(new_state)); | 
| 1769   __ SetAccumulator(old_state); | 1768   __ SetAccumulator(old_state); | 
| 1770 | 1769 | 
| 1771   __ Dispatch(); | 1770   __ Dispatch(); | 
| 1772 } | 1771 } | 
| 1773 | 1772 | 
| 1774 }  // namespace interpreter | 1773 }  // namespace interpreter | 
| 1775 }  // namespace internal | 1774 }  // namespace internal | 
| 1776 }  // namespace v8 | 1775 }  // namespace v8 | 
| OLD | NEW | 
|---|