← All issues

[20] [JSC] DFG object allocation sinking shouldn't insert a check when given a PutByVal

Severity: Medium | Component: JSC DFG JIT | cdfa73f

Rated Medium because the diff removes a vestigial special-case in DFG allocation sinking that emitted IR violating the current graph invariants. In --validateGraph builds it tripped a GetButterfly validator rule; in release builds the miscompiled graph may reach later phases with inconsistent exit-state metadata.

A leftover if (node->op() == PutByVal) block in ObjectAllocationSinkingPhase::run() inserted a Check on the stored value before the synthesized PutHint. The block was a fix for a now-replaced array-sinking implementation and no longer matches the surrounding code's invariants.

Source/JavaScriptCore/dfg/DFGObjectAllocationSinkingPhase.cpp / DFGValidate.cpp

- if (node->op() == PutByVal) {
- Edge value = m_graph.varArgChild(node, 2);
- m_insertionSet.insertNode(nodeIndex + 1, SpecNone, Check, node->origin, Edge(value.node(), value.useKind()));
- }
- case GetButterfly:
- VALIDATE((node), !node->child1()->isPhantomAllocation());
- break;

Stale optimization-phase code path emitting nodes that violate the current DFG graph invariants after a surrounding algorithm was replaced.

The GetButterfly validator rule is dropped alongside, indicating the surrounding allocation-sinking machinery now legitimately produces shapes the old validator forbade.

🔒

The downstream consequences of an allocation-sinking phase emitting an invariant-violating graph node — and what that implies for release-build codegen — are analyzed in depth.

Subscribe to read more

🔒

Multiple reusable audit patterns identified, covering vestigial phase fixes, exit-state invariants, and validator-rule hygiene across the DFG.

Subscribe to read more