| 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 1688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1699 const interpreter::BytecodeArrayIterator& iterator) { | 1699 const interpreter::BytecodeArrayIterator& iterator) { |
| 1700 Node* control = | 1700 Node* control = |
| 1701 NewNode(common()->Return(), environment()->LookupAccumulator()); | 1701 NewNode(common()->Return(), environment()->LookupAccumulator()); |
| 1702 UpdateControlDependencyToLeaveFunction(control); | 1702 UpdateControlDependencyToLeaveFunction(control); |
| 1703 set_environment(nullptr); | 1703 set_environment(nullptr); |
| 1704 } | 1704 } |
| 1705 | 1705 |
| 1706 | 1706 |
| 1707 void BytecodeGraphBuilder::VisitForInPrepare( | 1707 void BytecodeGraphBuilder::VisitForInPrepare( |
| 1708 const interpreter::BytecodeArrayIterator& iterator) { | 1708 const interpreter::BytecodeArrayIterator& iterator) { |
| 1709 Node* prepare = nullptr; | 1709 FrameStateBeforeAndAfter states(this, iterator); |
| 1710 { | 1710 Node* receiver = environment()->LookupAccumulator(); |
| 1711 FrameStateBeforeAndAfter states(this, iterator); | 1711 Node* prepare = NewNode(javascript()->ForInPrepare(), receiver); |
| 1712 Node* receiver = environment()->LookupAccumulator(); | 1712 environment()->BindRegistersToProjections(iterator.GetRegisterOperand(0), |
| 1713 prepare = NewNode(javascript()->ForInPrepare(), receiver); | 1713 prepare, &states); |
| 1714 environment()->RecordAfterState(prepare, &states); | |
| 1715 } | |
| 1716 // Project cache_type, cache_array, cache_length into register | |
| 1717 // operands 1, 2, 3. | |
| 1718 for (int i = 0; i < 3; i++) { | |
| 1719 environment()->BindRegister(iterator.GetRegisterOperand(i), | |
| 1720 NewNode(common()->Projection(i), prepare)); | |
| 1721 } | |
| 1722 } | 1714 } |
| 1723 | 1715 |
| 1724 | 1716 |
| 1725 void BytecodeGraphBuilder::VisitForInDone( | 1717 void BytecodeGraphBuilder::VisitForInDone( |
| 1726 const interpreter::BytecodeArrayIterator& iterator) { | 1718 const interpreter::BytecodeArrayIterator& iterator) { |
| 1727 FrameStateBeforeAndAfter states(this, iterator); | 1719 FrameStateBeforeAndAfter states(this, iterator); |
| 1728 Node* index = environment()->LookupRegister(iterator.GetRegisterOperand(0)); | 1720 Node* index = environment()->LookupRegister(iterator.GetRegisterOperand(0)); |
| 1729 Node* cache_length = | 1721 Node* cache_length = |
| 1730 environment()->LookupRegister(iterator.GetRegisterOperand(1)); | 1722 environment()->LookupRegister(iterator.GetRegisterOperand(1)); |
| 1731 Node* exit_cond = NewNode(javascript()->ForInDone(), index, cache_length); | 1723 Node* exit_cond = NewNode(javascript()->ForInDone(), index, cache_length); |
| 1732 environment()->BindAccumulator(exit_cond, &states); | 1724 environment()->BindAccumulator(exit_cond, &states); |
| 1733 } | 1725 } |
| 1734 | 1726 |
| 1735 | 1727 |
| 1736 void BytecodeGraphBuilder::VisitForInNext( | 1728 void BytecodeGraphBuilder::VisitForInNext( |
| 1737 const interpreter::BytecodeArrayIterator& iterator) { | 1729 const interpreter::BytecodeArrayIterator& iterator) { |
| 1738 FrameStateBeforeAndAfter states(this, iterator); | 1730 FrameStateBeforeAndAfter states(this, iterator); |
| 1739 Node* receiver = | 1731 Node* receiver = |
| 1740 environment()->LookupRegister(iterator.GetRegisterOperand(0)); | 1732 environment()->LookupRegister(iterator.GetRegisterOperand(0)); |
| 1741 Node* cache_type = | 1733 Node* index = environment()->LookupRegister(iterator.GetRegisterOperand(1)); |
| 1742 environment()->LookupRegister(iterator.GetRegisterOperand(1)); | 1734 int catch_reg_pair_index = iterator.GetRegisterOperand(2).index(); |
| 1743 Node* cache_array = | 1735 Node* cache_type = environment()->LookupRegister( |
| 1744 environment()->LookupRegister(iterator.GetRegisterOperand(2)); | 1736 interpreter::Register(catch_reg_pair_index)); |
| 1745 Node* index = environment()->LookupRegister(iterator.GetRegisterOperand(3)); | 1737 Node* cache_array = environment()->LookupRegister( |
| 1738 interpreter::Register(catch_reg_pair_index + 1)); |
| 1739 |
| 1746 Node* value = NewNode(javascript()->ForInNext(), receiver, cache_array, | 1740 Node* value = NewNode(javascript()->ForInNext(), receiver, cache_array, |
| 1747 cache_type, index); | 1741 cache_type, index); |
| 1748 environment()->BindAccumulator(value, &states); | 1742 environment()->BindAccumulator(value, &states); |
| 1749 } | 1743 } |
| 1750 | 1744 |
| 1751 | 1745 |
| 1752 void BytecodeGraphBuilder::VisitForInStep( | 1746 void BytecodeGraphBuilder::VisitForInStep( |
| 1753 const interpreter::BytecodeArrayIterator& iterator) { | 1747 const interpreter::BytecodeArrayIterator& iterator) { |
| 1754 FrameStateBeforeAndAfter states(this, iterator); | 1748 FrameStateBeforeAndAfter states(this, iterator); |
| 1755 Node* index = environment()->LookupRegister(iterator.GetRegisterOperand(0)); | 1749 Node* index = environment()->LookupRegister(iterator.GetRegisterOperand(0)); |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2003 | 1997 |
| 2004 void BytecodeGraphBuilder::UpdateControlDependencyToLeaveFunction(Node* exit) { | 1998 void BytecodeGraphBuilder::UpdateControlDependencyToLeaveFunction(Node* exit) { |
| 2005 if (environment()->IsMarkedAsUnreachable()) return; | 1999 if (environment()->IsMarkedAsUnreachable()) return; |
| 2006 environment()->MarkAsUnreachable(); | 2000 environment()->MarkAsUnreachable(); |
| 2007 exit_controls_.push_back(exit); | 2001 exit_controls_.push_back(exit); |
| 2008 } | 2002 } |
| 2009 | 2003 |
| 2010 } // namespace compiler | 2004 } // namespace compiler |
| 2011 } // namespace internal | 2005 } // namespace internal |
| 2012 } // namespace v8 | 2006 } // namespace v8 |
| OLD | NEW |