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/compiler/bytecode-graph-builder.h" | 5 #include "src/compiler/bytecode-graph-builder.h" |
6 | 6 |
7 #include "src/compiler/bytecode-branch-analysis.h" | 7 #include "src/compiler/bytecode-branch-analysis.h" |
8 #include "src/compiler/linkage.h" | 8 #include "src/compiler/linkage.h" |
9 #include "src/compiler/operator-properties.h" | 9 #include "src/compiler/operator-properties.h" |
10 #include "src/interpreter/bytecodes.h" | 10 #include "src/interpreter/bytecodes.h" |
(...skipping 1706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1717 const interpreter::BytecodeArrayIterator& iterator) { | 1717 const interpreter::BytecodeArrayIterator& iterator) { |
1718 Node* control = | 1718 Node* control = |
1719 NewNode(common()->Return(), environment()->LookupAccumulator()); | 1719 NewNode(common()->Return(), environment()->LookupAccumulator()); |
1720 UpdateControlDependencyToLeaveFunction(control); | 1720 UpdateControlDependencyToLeaveFunction(control); |
1721 set_environment(nullptr); | 1721 set_environment(nullptr); |
1722 } | 1722 } |
1723 | 1723 |
1724 | 1724 |
1725 void BytecodeGraphBuilder::VisitForInPrepare( | 1725 void BytecodeGraphBuilder::VisitForInPrepare( |
1726 const interpreter::BytecodeArrayIterator& iterator) { | 1726 const interpreter::BytecodeArrayIterator& iterator) { |
1727 Node* prepare = nullptr; | 1727 FrameStateBeforeAndAfter states(this, iterator); |
1728 { | 1728 Node* receiver = environment()->LookupAccumulator(); |
1729 FrameStateBeforeAndAfter states(this, iterator); | 1729 Node* prepare = NewNode(javascript()->ForInPrepare(), receiver); |
1730 Node* receiver = environment()->LookupAccumulator(); | 1730 environment()->BindRegistersToProjections(iterator.GetRegisterOperand(0), |
1731 prepare = NewNode(javascript()->ForInPrepare(), receiver); | 1731 prepare, &states); |
1732 environment()->RecordAfterState(prepare, &states); | |
1733 } | |
1734 // Project cache_type, cache_array, cache_length into register | |
1735 // operands 1, 2, 3. | |
1736 for (int i = 0; i < 3; i++) { | |
1737 environment()->BindRegister(iterator.GetRegisterOperand(i), | |
1738 NewNode(common()->Projection(i), prepare)); | |
1739 } | |
1740 } | 1732 } |
1741 | 1733 |
1742 | 1734 |
1743 void BytecodeGraphBuilder::VisitForInDone( | 1735 void BytecodeGraphBuilder::VisitForInDone( |
1744 const interpreter::BytecodeArrayIterator& iterator) { | 1736 const interpreter::BytecodeArrayIterator& iterator) { |
1745 FrameStateBeforeAndAfter states(this, iterator); | 1737 FrameStateBeforeAndAfter states(this, iterator); |
1746 Node* index = environment()->LookupRegister(iterator.GetRegisterOperand(0)); | 1738 Node* index = environment()->LookupRegister(iterator.GetRegisterOperand(0)); |
1747 Node* cache_length = | 1739 Node* cache_length = |
1748 environment()->LookupRegister(iterator.GetRegisterOperand(1)); | 1740 environment()->LookupRegister(iterator.GetRegisterOperand(1)); |
1749 Node* exit_cond = NewNode(javascript()->ForInDone(), index, cache_length); | 1741 Node* exit_cond = NewNode(javascript()->ForInDone(), index, cache_length); |
1750 environment()->BindAccumulator(exit_cond, &states); | 1742 environment()->BindAccumulator(exit_cond, &states); |
1751 } | 1743 } |
1752 | 1744 |
1753 | 1745 |
1754 void BytecodeGraphBuilder::VisitForInNext( | 1746 void BytecodeGraphBuilder::VisitForInNext( |
1755 const interpreter::BytecodeArrayIterator& iterator) { | 1747 const interpreter::BytecodeArrayIterator& iterator) { |
1756 FrameStateBeforeAndAfter states(this, iterator); | 1748 FrameStateBeforeAndAfter states(this, iterator); |
1757 Node* receiver = | 1749 Node* receiver = |
1758 environment()->LookupRegister(iterator.GetRegisterOperand(0)); | 1750 environment()->LookupRegister(iterator.GetRegisterOperand(0)); |
1759 Node* cache_type = | 1751 Node* index = environment()->LookupRegister(iterator.GetRegisterOperand(1)); |
1760 environment()->LookupRegister(iterator.GetRegisterOperand(1)); | 1752 int catch_reg_pair_index = iterator.GetRegisterOperand(2).index(); |
1761 Node* cache_array = | 1753 Node* cache_type = environment()->LookupRegister( |
1762 environment()->LookupRegister(iterator.GetRegisterOperand(2)); | 1754 interpreter::Register(catch_reg_pair_index)); |
1763 Node* index = environment()->LookupRegister(iterator.GetRegisterOperand(3)); | 1755 Node* cache_array = environment()->LookupRegister( |
| 1756 interpreter::Register(catch_reg_pair_index + 1)); |
| 1757 |
1764 Node* value = NewNode(javascript()->ForInNext(), receiver, cache_array, | 1758 Node* value = NewNode(javascript()->ForInNext(), receiver, cache_array, |
1765 cache_type, index); | 1759 cache_type, index); |
1766 environment()->BindAccumulator(value, &states); | 1760 environment()->BindAccumulator(value, &states); |
1767 } | 1761 } |
1768 | 1762 |
1769 | 1763 |
1770 void BytecodeGraphBuilder::VisitForInStep( | 1764 void BytecodeGraphBuilder::VisitForInStep( |
1771 const interpreter::BytecodeArrayIterator& iterator) { | 1765 const interpreter::BytecodeArrayIterator& iterator) { |
1772 FrameStateBeforeAndAfter states(this, iterator); | 1766 FrameStateBeforeAndAfter states(this, iterator); |
1773 Node* index = environment()->LookupRegister(iterator.GetRegisterOperand(0)); | 1767 Node* index = environment()->LookupRegister(iterator.GetRegisterOperand(0)); |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2031 | 2025 |
2032 void BytecodeGraphBuilder::UpdateControlDependencyToLeaveFunction(Node* exit) { | 2026 void BytecodeGraphBuilder::UpdateControlDependencyToLeaveFunction(Node* exit) { |
2033 if (environment()->IsMarkedAsUnreachable()) return; | 2027 if (environment()->IsMarkedAsUnreachable()) return; |
2034 environment()->MarkAsUnreachable(); | 2028 environment()->MarkAsUnreachable(); |
2035 exit_controls_.push_back(exit); | 2029 exit_controls_.push_back(exit); |
2036 } | 2030 } |
2037 | 2031 |
2038 } // namespace compiler | 2032 } // namespace compiler |
2039 } // namespace internal | 2033 } // namespace internal |
2040 } // namespace v8 | 2034 } // namespace v8 |
OLD | NEW |