Changeset 229517 in webkit for trunk/Source/JavaScriptCore/b3/B3ReduceStrength.cpp
- Timestamp:
- Mar 11, 2018, 12:52:24 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/b3/B3ReduceStrength.cpp
r229513 r229517 1674 1674 case AboveEqual: 1675 1675 case BelowEqual: { 1676 auto* value = newComparisonVaueIfNecessary();1676 CanonicalizedComparison comparison = canonicalizeComparison(m_value); 1677 1677 TriState result = MixedTriState; 1678 switch ( value->opcode()) {1678 switch (comparison.opcode) { 1679 1679 case LessThan: 1680 result = value->child(1)->greaterThanConstant(value->child(0));1680 result = comparison.operands[1]->greaterThanConstant(comparison.operands[0]); 1681 1681 break; 1682 1682 case GreaterThan: 1683 result = value->child(1)->lessThanConstant(value->child(0));1683 result = comparison.operands[1]->lessThanConstant(comparison.operands[0]); 1684 1684 break; 1685 1685 case LessEqual: 1686 result = value->child(1)->greaterEqualConstant(value->child(0));1686 result = comparison.operands[1]->greaterEqualConstant(comparison.operands[0]); 1687 1687 break; 1688 1688 case GreaterEqual: 1689 result = value->child(1)->lessEqualConstant(value->child(0));1689 result = comparison.operands[1]->lessEqualConstant(comparison.operands[0]); 1690 1690 break; 1691 1691 case Above: 1692 result = value->child(1)->belowConstant(value->child(0));1692 result = comparison.operands[1]->belowConstant(comparison.operands[0]); 1693 1693 break; 1694 1694 case Below: 1695 result = value->child(1)->aboveConstant(value->child(0));1695 result = comparison.operands[1]->aboveConstant(comparison.operands[0]); 1696 1696 break; 1697 1697 case AboveEqual: 1698 result = value->child(1)->belowEqualConstant(value->child(0));1698 result = comparison.operands[1]->belowEqualConstant(comparison.operands[0]); 1699 1699 break; 1700 1700 case BelowEqual: 1701 result = value->child(1)->aboveEqualConstant(value->child(0));1701 result = comparison.operands[1]->aboveEqualConstant(comparison.operands[0]); 1702 1702 break; 1703 1703 default: … … 1706 1706 } 1707 1707 1708 if (auto* constant = m_proc.addBoolConstant( value->origin(), result)) {1708 if (auto* constant = m_proc.addBoolConstant(m_value->origin(), result)) { 1709 1709 replaceWithNewValue(constant); 1710 1710 break; 1711 1711 } 1712 1713 // Replace with newly created "value". Its opcode is flipped and operands are swapped from m_value.1714 if (m_value != value)1715 replaceWithNewValue(value);1712 if (comparison.opcode != m_value->opcode()) { 1713 replaceWithNew<Value>(comparison.opcode, m_value->origin(), comparison.operands[0], comparison.operands[1]); 1714 break; 1715 } 1716 1716 break; 1717 1717 } … … 2167 2167 } 2168 2168 2169 Value* newComparisonVaueIfNecessary() 2169 struct CanonicalizedComparison { 2170 Opcode opcode; 2171 Value* operands[2]; 2172 }; 2173 static CanonicalizedComparison canonicalizeComparison(Value* value) 2170 2174 { 2171 2175 auto flip = [] (Opcode opcode) { … … 2191 2195 } 2192 2196 }; 2193 if (shouldSwapBinaryOperands(m_value)) { 2194 m_changed = true; 2195 return m_proc.add<Value>(flip(m_value->opcode()), m_value->origin(), m_value->child(1), m_value->child(0)); 2196 } 2197 return m_value; 2197 if (shouldSwapBinaryOperands(value)) 2198 return { flip(value->opcode()), { value->child(1), value->child(0) } }; 2199 return { value->opcode(), { value->child(0), value->child(1) } }; 2198 2200 } 2199 2201
Note:
See TracChangeset
for help on using the changeset viewer.