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 "src/ast/prettyprinter.h" | 7 #include "src/ast/prettyprinter.h" |
8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
9 #include "src/compiler.h" | 9 #include "src/compiler.h" |
10 #include "src/factory.h" | 10 #include "src/factory.h" |
(...skipping 1815 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1826 __ SetAccumulator(result); | 1826 __ SetAccumulator(result); |
1827 __ Dispatch(); | 1827 __ Dispatch(); |
1828 } | 1828 } |
1829 | 1829 |
1830 | 1830 |
1831 // ForInStep <index> | 1831 // ForInStep <index> |
1832 // | 1832 // |
1833 // Increments the loop counter in register |index| and stores the result | 1833 // Increments the loop counter in register |index| and stores the result |
1834 // in the accumulator. | 1834 // in the accumulator. |
1835 void Interpreter::DoForInStep(InterpreterAssembler* assembler) { | 1835 void Interpreter::DoForInStep(InterpreterAssembler* assembler) { |
1836 // TODO(oth): Implement directly rather than making a runtime call. | |
1837 Node* index_reg = __ BytecodeOperandReg(0); | 1836 Node* index_reg = __ BytecodeOperandReg(0); |
1838 Node* index = __ LoadRegister(index_reg); | 1837 Node* index = __ LoadRegister(index_reg); |
1839 Node* context = __ GetContext(); | 1838 Node* one = __ SmiConstant(Smi::FromInt(1)); |
1840 Node* result = __ CallRuntime(Runtime::kForInStep, context, index); | 1839 Node* result = __ SmiAdd(index, one); |
1841 __ SetAccumulator(result); | 1840 __ SetAccumulator(result); |
1842 __ Dispatch(); | 1841 __ Dispatch(); |
1843 } | 1842 } |
1844 | 1843 |
1845 } // namespace interpreter | 1844 } // namespace interpreter |
1846 } // namespace internal | 1845 } // namespace internal |
1847 } // namespace v8 | 1846 } // namespace v8 |
OLD | NEW |