| 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/code-factory.h" | 7 #include "src/code-factory.h" |
| 8 #include "src/compiler.h" | 8 #include "src/compiler.h" |
| 9 #include "src/compiler/interpreter-assembler.h" | 9 #include "src/compiler/interpreter-assembler.h" |
| 10 #include "src/factory.h" | 10 #include "src/factory.h" |
| (...skipping 1698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1709 } | 1709 } |
| 1710 | 1710 |
| 1711 | 1711 |
| 1712 // ForInPrepare <cache_type> <cache_array> <cache_length> | 1712 // ForInPrepare <cache_type> <cache_array> <cache_length> |
| 1713 // | 1713 // |
| 1714 // Returns state for for..in loop execution based on the object in the | 1714 // Returns state for for..in loop execution based on the object in the |
| 1715 // accumulator. The registers |cache_type|, |cache_array|, and | 1715 // accumulator. The registers |cache_type|, |cache_array|, and |
| 1716 // |cache_length| represent output parameters. | 1716 // |cache_length| represent output parameters. |
| 1717 void Interpreter::DoForInPrepare(compiler::InterpreterAssembler* assembler) { | 1717 void Interpreter::DoForInPrepare(compiler::InterpreterAssembler* assembler) { |
| 1718 Node* object = __ GetAccumulator(); | 1718 Node* object = __ GetAccumulator(); |
| 1719 Node* result = __ CallRuntime(Runtime::kInterpreterForInPrepare, object); | 1719 Node* result_triple = __ CallRuntime(Runtime::kForInPrepare, object); |
| 1720 |
| 1721 // Set output registers: |
| 1722 // 0 == cache_type, 1 == cache_array, 2 == cache_length |
| 1720 for (int i = 0; i < 3; i++) { | 1723 for (int i = 0; i < 3; i++) { |
| 1721 // 0 == cache_type, 1 == cache_array, 2 == cache_length | 1724 Node* cache_info = __ Projection(i, result_triple); |
| 1722 Node* cache_info = __ LoadFixedArrayElement(result, i); | |
| 1723 Node* cache_info_reg = __ BytecodeOperandReg(i); | 1725 Node* cache_info_reg = __ BytecodeOperandReg(i); |
| 1724 __ StoreRegister(cache_info, cache_info_reg); | 1726 __ StoreRegister(cache_info, cache_info_reg); |
| 1725 } | 1727 } |
| 1726 __ SetAccumulator(result); | 1728 |
| 1727 __ Dispatch(); | 1729 __ Dispatch(); |
| 1728 } | 1730 } |
| 1729 | 1731 |
| 1730 | 1732 |
| 1731 // ForInNext <receiver> <cache_type> <cache_array> <index> | 1733 // ForInNext <receiver> <cache_type> <cache_array> <index> |
| 1732 // | 1734 // |
| 1733 // Returns the next enumerable property in the the accumulator. | 1735 // Returns the next enumerable property in the the accumulator. |
| 1734 void Interpreter::DoForInNext(compiler::InterpreterAssembler* assembler) { | 1736 void Interpreter::DoForInNext(compiler::InterpreterAssembler* assembler) { |
| 1735 Node* receiver_reg = __ BytecodeOperandReg(0); | 1737 Node* receiver_reg = __ BytecodeOperandReg(0); |
| 1736 Node* receiver = __ LoadRegister(receiver_reg); | 1738 Node* receiver = __ LoadRegister(receiver_reg); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1771 Node* index_reg = __ BytecodeOperandReg(0); | 1773 Node* index_reg = __ BytecodeOperandReg(0); |
| 1772 Node* index = __ LoadRegister(index_reg); | 1774 Node* index = __ LoadRegister(index_reg); |
| 1773 Node* result = __ CallRuntime(Runtime::kForInStep, index); | 1775 Node* result = __ CallRuntime(Runtime::kForInStep, index); |
| 1774 __ SetAccumulator(result); | 1776 __ SetAccumulator(result); |
| 1775 __ Dispatch(); | 1777 __ Dispatch(); |
| 1776 } | 1778 } |
| 1777 | 1779 |
| 1778 } // namespace interpreter | 1780 } // namespace interpreter |
| 1779 } // namespace internal | 1781 } // namespace internal |
| 1780 } // namespace v8 | 1782 } // namespace v8 |
| OLD | NEW |