Changeset 269107 in webkit
- Timestamp:
- Oct 28, 2020, 10:32:26 AM (6 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 3 edited
-
JSTests/ChangeLog (modified) (1 diff)
-
JSTests/stress/bounds-checking-in-cold-loop.js (added)
-
Source/JavaScriptCore/ChangeLog (modified) (1 diff)
-
Source/JavaScriptCore/dfg/DFGIntegerRangeOptimizationPhase.cpp (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/JSTests/ChangeLog
r268956 r269107 1 2020-10-28 Robin Morisset <rmorisset@apple.com> 2 3 DFGIntegerRangeOptimization is wrong for Upsilon (as 'shadow' nodes are not in SSA form) 4 https://bugs.webkit.org/show_bug.cgi?id=218073 5 6 Reviewed by Saam Barati. 7 8 The only testcase I managed to get for this bug loops forever when not crashing. 9 So I use a 1s timeout through --watchdog=1000. 10 11 * stress/bounds-checking-in-cold-loop.js: Added. 12 (true.vm.ftlTrue): 13 1 14 2020-10-24 Yusuke Suzuki <ysuzuki@apple.com> 2 15 -
trunk/Source/JavaScriptCore/ChangeLog
r269054 r269107 1 2020-10-28 Robin Morisset <rmorisset@apple.com> 2 3 DFGIntegerRangeOptimization is wrong for Upsilon (as 'shadow' nodes are not in SSA form) 4 https://bugs.webkit.org/show_bug.cgi?id=218073 5 6 Reviewed by Saam Barati. 7 8 In DFGIntegerRangeOptimization, when visiting an Upsilon node, we call setEquivalence, that calls setRelationship. 9 But despite its name, this function does not overwrite a pre-existing relationship, it simply replaces it by an over-approximation of the intersection of the old and new relationship (see the filter method). 10 Since the old relationship is always (by definition) an over-approximation of this intersection, it will often do nothing at all if it cannot find a closer approximation. 11 This is a problem specifically for Upsilon nodes, because several of them can store to the same "shadow node" corresponding to a given Phi, so they are the only case where there can already be a completely different relationship for the same nodes (coming from a different Upsilon). 12 13 The fix is very simple thanks to a suggestion by Phil: we just remove all relationships referring to the shadow node just before executing an Upsilon. 14 This is correct since the upsilon effectively kills that shadow node, before making it live again with a different value, and we already aggressively prune the relationshipMaps by liveness. 15 16 * dfg/DFGIntegerRangeOptimizationPhase.cpp: 17 1 18 2020-10-27 Michael Catanzaro <mcatanzaro@gnome.org> 2 19 -
trunk/Source/JavaScriptCore/dfg/DFGIntegerRangeOptimizationPhase.cpp
r267726 r269107 1504 1504 1505 1505 case Upsilon: { 1506 setEquivalence( 1507 node->child1().node(), 1508 NodeFlowProjection(node->phi(), NodeFlowProjection::Shadow)); 1506 auto shadowNode = NodeFlowProjection(node->phi(), NodeFlowProjection::Shadow); 1507 // We must first remove all relationships involving the shadow node, because setEquivalence does not overwrite them. 1508 // Overwriting is only required here because the shadowNodes are not in SSA form (can be written to by several Upsilons). 1509 // Another way to think of it, is that we are maintaining the invariant that relationshipMaps are pruned by liveness. 1510 kill(shadowNode); 1511 setEquivalence(node->child1().node(), shadowNode); 1509 1512 break; 1510 1513 } … … 1519 1522 default: 1520 1523 break; 1524 } 1525 } 1526 1527 void kill(NodeFlowProjection node) 1528 { 1529 m_relationships.remove(node); 1530 1531 for (auto& relationships : m_relationships.values()) { 1532 unsigned i = 0, j = 0; 1533 while (i < relationships.size()) { 1534 const Relationship& rel = relationships[i++]; 1535 ASSERT(rel.left() != node); 1536 if (rel.right() != node) 1537 relationships[j++] = rel; 1538 } 1539 relationships.shrink(j); 1521 1540 } 1522 1541 } … … 1561 1580 1562 1581 if (DFGIntegerRangeOptimizationPhaseInternal::verbose) 1563 dataLog (" Setting: ", relationship, " (ttl = ", timeToLive, ")\n");1582 dataLogLn(" Setting: ", relationship, " (ttl = ", timeToLive, ")"); 1564 1583 1565 1584 auto result = relationshipMap.add( … … 1643 1662 ASSERT(filtered.left() == relationship.left()); 1644 1663 otherRelationship = filtered; 1664 if (DFGIntegerRangeOptimizationPhaseInternal::verbose) 1665 dataLogLn(" filtered: ", filtered); 1645 1666 found = true; 1646 1667 } … … 1700 1721 } 1701 1722 } 1702 1723 1703 1724 if (!found) 1704 1725 relationships.append(relationship);
Note:
See TracChangeset
for help on using the changeset viewer.