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 1773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1784 } | 1784 } |
1785 | 1785 |
1786 // Nop | 1786 // Nop |
1787 // | 1787 // |
1788 // No operation. | 1788 // No operation. |
1789 void Interpreter::DoNop(InterpreterAssembler* assembler) { __ Dispatch(); } | 1789 void Interpreter::DoNop(InterpreterAssembler* assembler) { __ Dispatch(); } |
1790 | 1790 |
1791 // SuspendGenerator <generator> | 1791 // SuspendGenerator <generator> |
1792 // | 1792 // |
1793 // Exports the register file and stores it into the generator. Also stores the | 1793 // Exports the register file and stores it into the generator. Also stores the |
1794 // current context and the state given in the accumulator into the generator. | 1794 // current context, the state given in the accumulator, and the current bytecode |
| 1795 // offset (for debugging purposes) into the generator. |
1795 void Interpreter::DoSuspendGenerator(InterpreterAssembler* assembler) { | 1796 void Interpreter::DoSuspendGenerator(InterpreterAssembler* assembler) { |
1796 Node* generator_reg = __ BytecodeOperandReg(0); | 1797 Node* generator_reg = __ BytecodeOperandReg(0); |
1797 Node* generator = __ LoadRegister(generator_reg); | 1798 Node* generator = __ LoadRegister(generator_reg); |
1798 | 1799 |
1799 Label if_stepping(assembler, Label::kDeferred), ok(assembler); | 1800 Label if_stepping(assembler, Label::kDeferred), ok(assembler); |
1800 Node* step_action_address = __ ExternalConstant( | 1801 Node* step_action_address = __ ExternalConstant( |
1801 ExternalReference::debug_last_step_action_address(isolate_)); | 1802 ExternalReference::debug_last_step_action_address(isolate_)); |
1802 Node* step_action = __ Load(MachineType::Int8(), step_action_address); | 1803 Node* step_action = __ Load(MachineType::Int8(), step_action_address); |
1803 STATIC_ASSERT(StepIn > StepNext); | 1804 STATIC_ASSERT(StepIn > StepNext); |
1804 STATIC_ASSERT(StepFrame > StepNext); | 1805 STATIC_ASSERT(StepFrame > StepNext); |
1805 STATIC_ASSERT(LastStepAction == StepFrame); | 1806 STATIC_ASSERT(LastStepAction == StepFrame); |
1806 Node* step_next = __ Int32Constant(StepNext); | 1807 Node* step_next = __ Int32Constant(StepNext); |
1807 __ BranchIfInt32LessThanOrEqual(step_next, step_action, &if_stepping, &ok); | 1808 __ BranchIfInt32LessThanOrEqual(step_next, step_action, &if_stepping, &ok); |
1808 __ Bind(&ok); | 1809 __ Bind(&ok); |
1809 | 1810 |
1810 Node* array = | 1811 Node* array = |
1811 __ LoadObjectField(generator, JSGeneratorObject::kOperandStackOffset); | 1812 __ LoadObjectField(generator, JSGeneratorObject::kOperandStackOffset); |
1812 Node* context = __ GetContext(); | 1813 Node* context = __ GetContext(); |
1813 Node* state = __ GetAccumulator(); | 1814 Node* state = __ GetAccumulator(); |
1814 | 1815 |
1815 __ ExportRegisterFile(array); | 1816 __ ExportRegisterFile(array); |
1816 __ StoreObjectField(generator, JSGeneratorObject::kContextOffset, context); | 1817 __ StoreObjectField(generator, JSGeneratorObject::kContextOffset, context); |
1817 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, state); | 1818 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, state); |
1818 | 1819 |
| 1820 Node* offset = __ SmiTag(__ BytecodeOffset()); |
| 1821 __ StoreObjectField(generator, JSGeneratorObject::kInputOrDebugPosOffset, |
| 1822 offset); |
| 1823 |
1819 __ Dispatch(); | 1824 __ Dispatch(); |
1820 | 1825 |
1821 __ Bind(&if_stepping); | 1826 __ Bind(&if_stepping); |
1822 { | 1827 { |
1823 Node* context = __ GetContext(); | 1828 Node* context = __ GetContext(); |
1824 __ CallRuntime(Runtime::kDebugRecordAsyncFunction, context, generator); | 1829 __ CallRuntime(Runtime::kDebugRecordAsyncFunction, context, generator); |
1825 __ Goto(&ok); | 1830 __ Goto(&ok); |
1826 } | 1831 } |
1827 } | 1832 } |
1828 | 1833 |
(...skipping 15 matching lines...) Expand all Loading... |
1844 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, | 1849 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, |
1845 __ SmiTag(new_state)); | 1850 __ SmiTag(new_state)); |
1846 __ SetAccumulator(old_state); | 1851 __ SetAccumulator(old_state); |
1847 | 1852 |
1848 __ Dispatch(); | 1853 __ Dispatch(); |
1849 } | 1854 } |
1850 | 1855 |
1851 } // namespace interpreter | 1856 } // namespace interpreter |
1852 } // namespace internal | 1857 } // namespace internal |
1853 } // namespace v8 | 1858 } // namespace v8 |
OLD | NEW |