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 1673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1684 | 1684 |
1685 | 1685 |
1686 // Return | 1686 // Return |
1687 // | 1687 // |
1688 // Return the value in the accumulator. | 1688 // Return the value in the accumulator. |
1689 void Interpreter::DoReturn(compiler::InterpreterAssembler* assembler) { | 1689 void Interpreter::DoReturn(compiler::InterpreterAssembler* assembler) { |
1690 __ Return(); | 1690 __ Return(); |
1691 } | 1691 } |
1692 | 1692 |
1693 | 1693 |
1694 // ForInPrepare <cache_type> <cache_array> <cache_length> | 1694 // ForInPrepare <first_register> |
oth
2016/01/13 15:28:58
cache_info_triple?
rmcilroy
2016/01/18 09:40:49
Done.
| |
1695 // | 1695 // |
1696 // Returns state for for..in loop execution based on the object in the | 1696 // Returns state for for..in loop execution based on the object in the |
1697 // accumulator. The registers |cache_type|, |cache_array|, and | 1697 // accumulator. The result is output in registers |first_register| to |
1698 // |cache_length| represent output parameters. | 1698 // |first_register + 2|, with the registers holding cache_type, cache_array, and |
1699 // cache_length respectively. | |
1699 void Interpreter::DoForInPrepare(compiler::InterpreterAssembler* assembler) { | 1700 void Interpreter::DoForInPrepare(compiler::InterpreterAssembler* assembler) { |
1700 Node* object = __ GetAccumulator(); | 1701 Node* object = __ GetAccumulator(); |
1701 Node* result_triple = __ CallRuntime(Runtime::kForInPrepare, object); | 1702 Node* result_triple = __ CallRuntime(Runtime::kForInPrepare, object); |
1702 | 1703 |
1703 // Set output registers: | 1704 // Set output registers: |
1704 // 0 == cache_type, 1 == cache_array, 2 == cache_length | 1705 // 0 == cache_type, 1 == cache_array, 2 == cache_length |
1706 Node* output_register = __ BytecodeOperandReg(0); | |
1705 for (int i = 0; i < 3; i++) { | 1707 for (int i = 0; i < 3; i++) { |
1706 Node* cache_info = __ Projection(i, result_triple); | 1708 Node* cache_info = __ Projection(i, result_triple); |
1707 Node* cache_info_reg = __ BytecodeOperandReg(i); | 1709 __ StoreRegister(cache_info, output_register); |
1708 __ StoreRegister(cache_info, cache_info_reg); | 1710 output_register = __ NextRegister(output_register); |
1709 } | 1711 } |
1710 | 1712 |
1711 __ Dispatch(); | 1713 __ Dispatch(); |
1712 } | 1714 } |
1713 | 1715 |
1714 | 1716 |
1715 // ForInNext <receiver> <cache_type> <cache_array> <index> | 1717 // ForInNext <receiver> <index> <cache_register_pair> |
1716 // | 1718 // |
1717 // Returns the next enumerable property in the the accumulator. | 1719 // Returns the next enumerable property in the the accumulator. |
1718 void Interpreter::DoForInNext(compiler::InterpreterAssembler* assembler) { | 1720 void Interpreter::DoForInNext(compiler::InterpreterAssembler* assembler) { |
1719 Node* receiver_reg = __ BytecodeOperandReg(0); | 1721 Node* receiver_reg = __ BytecodeOperandReg(0); |
1720 Node* receiver = __ LoadRegister(receiver_reg); | 1722 Node* receiver = __ LoadRegister(receiver_reg); |
1721 Node* cache_type_reg = __ BytecodeOperandReg(1); | 1723 Node* index_reg = __ BytecodeOperandReg(1); |
1724 Node* index = __ LoadRegister(index_reg); | |
1725 Node* cache_type_reg = __ BytecodeOperandReg(2); | |
1722 Node* cache_type = __ LoadRegister(cache_type_reg); | 1726 Node* cache_type = __ LoadRegister(cache_type_reg); |
1723 Node* cache_array_reg = __ BytecodeOperandReg(2); | 1727 Node* cache_array_reg = __ NextRegister(cache_type_reg); |
1724 Node* cache_array = __ LoadRegister(cache_array_reg); | 1728 Node* cache_array = __ LoadRegister(cache_array_reg); |
1725 Node* index_reg = __ BytecodeOperandReg(3); | |
1726 Node* index = __ LoadRegister(index_reg); | |
1727 Node* result = __ CallRuntime(Runtime::kForInNext, receiver, cache_array, | 1729 Node* result = __ CallRuntime(Runtime::kForInNext, receiver, cache_array, |
1728 cache_type, index); | 1730 cache_type, index); |
1729 __ SetAccumulator(result); | 1731 __ SetAccumulator(result); |
1730 __ Dispatch(); | 1732 __ Dispatch(); |
1731 } | 1733 } |
1732 | 1734 |
1733 | 1735 |
1734 // ForInDone <index> <cache_length> | 1736 // ForInDone <index> <cache_length> |
1735 // | 1737 // |
1736 // Returns true if the end of the enumerable properties has been reached. | 1738 // Returns true if the end of the enumerable properties has been reached. |
(...skipping 18 matching lines...) Expand all Loading... | |
1755 Node* index_reg = __ BytecodeOperandReg(0); | 1757 Node* index_reg = __ BytecodeOperandReg(0); |
1756 Node* index = __ LoadRegister(index_reg); | 1758 Node* index = __ LoadRegister(index_reg); |
1757 Node* result = __ CallRuntime(Runtime::kForInStep, index); | 1759 Node* result = __ CallRuntime(Runtime::kForInStep, index); |
1758 __ SetAccumulator(result); | 1760 __ SetAccumulator(result); |
1759 __ Dispatch(); | 1761 __ Dispatch(); |
1760 } | 1762 } |
1761 | 1763 |
1762 } // namespace interpreter | 1764 } // namespace interpreter |
1763 } // namespace internal | 1765 } // namespace internal |
1764 } // namespace v8 | 1766 } // namespace v8 |
OLD | NEW |