| 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 1691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1702 | 1702 |
| 1703 | 1703 |
| 1704 // Return | 1704 // Return |
| 1705 // | 1705 // |
| 1706 // Return the value in the accumulator. | 1706 // Return the value in the accumulator. |
| 1707 void Interpreter::DoReturn(compiler::InterpreterAssembler* assembler) { | 1707 void Interpreter::DoReturn(compiler::InterpreterAssembler* assembler) { |
| 1708 __ Return(); | 1708 __ Return(); |
| 1709 } | 1709 } |
| 1710 | 1710 |
| 1711 | 1711 |
| 1712 // ForInPrepare <cache_type> <cache_array> <cache_length> | 1712 // ForInPrepare <cache_info_triple> |
| 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 result is output in registers |cache_info_triple| to |
| 1716 // |cache_length| represent output parameters. | 1716 // |cache_info_triple + 2|, with the registers holding cache_type, cache_array, |
| 1717 // and cache_length respectively. |
| 1717 void Interpreter::DoForInPrepare(compiler::InterpreterAssembler* assembler) { | 1718 void Interpreter::DoForInPrepare(compiler::InterpreterAssembler* assembler) { |
| 1718 Node* object = __ GetAccumulator(); | 1719 Node* object = __ GetAccumulator(); |
| 1719 Node* result_triple = __ CallRuntime(Runtime::kForInPrepare, object); | 1720 Node* result_triple = __ CallRuntime(Runtime::kForInPrepare, object); |
| 1720 | 1721 |
| 1721 // Set output registers: | 1722 // Set output registers: |
| 1722 // 0 == cache_type, 1 == cache_array, 2 == cache_length | 1723 // 0 == cache_type, 1 == cache_array, 2 == cache_length |
| 1724 Node* output_register = __ BytecodeOperandReg(0); |
| 1723 for (int i = 0; i < 3; i++) { | 1725 for (int i = 0; i < 3; i++) { |
| 1724 Node* cache_info = __ Projection(i, result_triple); | 1726 Node* cache_info = __ Projection(i, result_triple); |
| 1725 Node* cache_info_reg = __ BytecodeOperandReg(i); | 1727 __ StoreRegister(cache_info, output_register); |
| 1726 __ StoreRegister(cache_info, cache_info_reg); | 1728 output_register = __ NextRegister(output_register); |
| 1727 } | 1729 } |
| 1728 | 1730 |
| 1729 __ Dispatch(); | 1731 __ Dispatch(); |
| 1730 } | 1732 } |
| 1731 | 1733 |
| 1732 | 1734 |
| 1733 // ForInNext <receiver> <cache_type> <cache_array> <index> | 1735 // ForInNext <receiver> <index> <cache_info_pair> |
| 1734 // | 1736 // |
| 1735 // Returns the next enumerable property in the the accumulator. | 1737 // Returns the next enumerable property in the the accumulator. |
| 1736 void Interpreter::DoForInNext(compiler::InterpreterAssembler* assembler) { | 1738 void Interpreter::DoForInNext(compiler::InterpreterAssembler* assembler) { |
| 1737 Node* receiver_reg = __ BytecodeOperandReg(0); | 1739 Node* receiver_reg = __ BytecodeOperandReg(0); |
| 1738 Node* receiver = __ LoadRegister(receiver_reg); | 1740 Node* receiver = __ LoadRegister(receiver_reg); |
| 1739 Node* cache_type_reg = __ BytecodeOperandReg(1); | 1741 Node* index_reg = __ BytecodeOperandReg(1); |
| 1742 Node* index = __ LoadRegister(index_reg); |
| 1743 Node* cache_type_reg = __ BytecodeOperandReg(2); |
| 1740 Node* cache_type = __ LoadRegister(cache_type_reg); | 1744 Node* cache_type = __ LoadRegister(cache_type_reg); |
| 1741 Node* cache_array_reg = __ BytecodeOperandReg(2); | 1745 Node* cache_array_reg = __ NextRegister(cache_type_reg); |
| 1742 Node* cache_array = __ LoadRegister(cache_array_reg); | 1746 Node* cache_array = __ LoadRegister(cache_array_reg); |
| 1743 Node* index_reg = __ BytecodeOperandReg(3); | |
| 1744 Node* index = __ LoadRegister(index_reg); | |
| 1745 Node* result = __ CallRuntime(Runtime::kForInNext, receiver, cache_array, | 1747 Node* result = __ CallRuntime(Runtime::kForInNext, receiver, cache_array, |
| 1746 cache_type, index); | 1748 cache_type, index); |
| 1747 __ SetAccumulator(result); | 1749 __ SetAccumulator(result); |
| 1748 __ Dispatch(); | 1750 __ Dispatch(); |
| 1749 } | 1751 } |
| 1750 | 1752 |
| 1751 | 1753 |
| 1752 // ForInDone <index> <cache_length> | 1754 // ForInDone <index> <cache_length> |
| 1753 // | 1755 // |
| 1754 // Returns true if the end of the enumerable properties has been reached. | 1756 // Returns true if the end of the enumerable properties has been reached. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1773 Node* index_reg = __ BytecodeOperandReg(0); | 1775 Node* index_reg = __ BytecodeOperandReg(0); |
| 1774 Node* index = __ LoadRegister(index_reg); | 1776 Node* index = __ LoadRegister(index_reg); |
| 1775 Node* result = __ CallRuntime(Runtime::kForInStep, index); | 1777 Node* result = __ CallRuntime(Runtime::kForInStep, index); |
| 1776 __ SetAccumulator(result); | 1778 __ SetAccumulator(result); |
| 1777 __ Dispatch(); | 1779 __ Dispatch(); |
| 1778 } | 1780 } |
| 1779 | 1781 |
| 1780 } // namespace interpreter | 1782 } // namespace interpreter |
| 1781 } // namespace internal | 1783 } // namespace internal |
| 1782 } // namespace v8 | 1784 } // namespace v8 |
| OLD | NEW |