Changeset 274539 in webkit
- Timestamp:
- Mar 16, 2021, 5:23:06 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 3 edited
-
JSTests/ChangeLog (modified) (1 diff)
-
JSTests/stress/allocation-sinking-scope-materialization-order.js (added)
-
Source/JavaScriptCore/ChangeLog (modified) (1 diff)
-
Source/JavaScriptCore/dfg/DFGObjectAllocationSinkingPhase.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/JSTests/ChangeLog
r274505 r274539 1 2021-03-16 Saam Barati <sbarati@apple.com> 2 3 Object allocation sinking phase should prioritize materializations with no dependencies before materializations with no reverse dependencies 4 https://bugs.webkit.org/show_bug.cgi?id=221069 5 <rdar://problem/73686589> 6 7 Reviewed by Yusuke Suzuki. 8 9 * stress/allocation-sinking-scope-materialization-order.js: Added. 10 (var3.var2.x): 11 (var3): 12 1 13 2021-03-16 Commit Queue <commit-queue@webkit.org> 2 14 -
trunk/Source/JavaScriptCore/ChangeLog
r274538 r274539 1 2021-03-16 Saam Barati <sbarati@apple.com> 2 3 Object allocation sinking phase should prioritize materializations with no dependencies before materializations with no reverse dependencies 4 https://bugs.webkit.org/show_bug.cgi?id=221069 5 <rdar://problem/73686589> 6 7 Reviewed by Yusuke Suzuki. 8 9 Suppose we have two scope objects, A and B. Let's say A points to B, so B is 10 A's parent scope. A then depends on B. B has no dependencies here. When deciding 11 an order to materialize scope objects, we should always do it in reverse dependency 12 order. So above, we should materialize B, then A. 13 14 Inside object allocation sinking phase, when at an object materialization 15 site, we do track both dependencies and reverse dependencies. In the above 16 object graph, we'd attempt to materialize the objects in the right order, 17 always picking things with no dependencies first (and updating the list of 18 dependencies as we materialzed objects). 19 20 The code was using an std::list to track things to materialize, and it had 21 notions for materializing something first, and materializing something last. 22 However, there was a bug in how the code managed to insert things when 23 it first inserted last followed by inserting first. This patch simplifies 24 the code and makes it do the right thing. 25 26 * dfg/DFGObjectAllocationSinkingPhase.cpp: 27 1 28 2021-03-16 Mark Lam <mark.lam@apple.com> 2 29 -
trunk/Source/JavaScriptCore/dfg/DFGObjectAllocationSinkingPhase.cpp
r272580 r274539 1580 1580 // materialized first - amongst the remaining unmaterialized 1581 1581 // nodes 1582 StdList<Allocation> toMaterialize; 1583 auto firstPos = toMaterialize.begin(); 1582 Vector<Allocation> toMaterialize; 1583 toMaterialize.resize(escapees.size()); 1584 size_t firstIndex = 0; 1585 size_t lastIndex = toMaterialize.size(); 1584 1586 auto materializeFirst = [&] (Allocation&& allocation) { 1587 RELEASE_ASSERT(firstIndex < lastIndex); 1585 1588 materialize(allocation.identifier()); 1586 // We need to insert *after* the current position 1587 if (firstPos != toMaterialize.end()) 1588 ++firstPos; 1589 firstPos = toMaterialize.insert(firstPos, WTFMove(allocation)); 1589 toMaterialize[firstIndex] = WTFMove(allocation); 1590 ++firstIndex; 1590 1591 }; 1591 1592 … … 1593 1594 // materialized last - amongst the remaining unmaterialized 1594 1595 // nodes 1595 auto lastPos = toMaterialize.end();1596 1596 auto materializeLast = [&] (Allocation&& allocation) { 1597 1597 materialize(allocation.identifier()); 1598 lastPos = toMaterialize.insert(lastPos, WTFMove(allocation)); 1598 RELEASE_ASSERT(firstIndex < lastIndex); 1599 RELEASE_ASSERT(lastIndex); 1600 --lastIndex; 1601 toMaterialize[lastIndex] = WTFMove(allocation); 1599 1602 }; 1600 1603 … … 1654 1657 escapees.remove(identifier); 1655 1658 } 1659 1660 RELEASE_ASSERT(firstIndex == lastIndex); 1656 1661 1657 1662 materialized.clear();
Note:
See TracChangeset
for help on using the changeset viewer.