-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DFG should update backwards propogation after fixup.
https://bugs.webkit.org/show_bug.cgi?id=257949 rdar://110661900 Reviewed by Keith Miller. PureInt means that we cannot observe a difference between this value when represented as a double or when represented as a UInt32. Today, PureInt is not a proven property, but rather a speculation guide. The DFG fixup phase is responsible for inserting speculations and fixing up edges to ensure that we can prove the properties that we want. UInt32ToNumber speculates that a value fits in an Int32. DoubleRep takes an Int32 and stuffs the bits appropriately to turn it into a double. ValueAdd is expecting a DoubleRep because it has a double argument. In FixupPhase, we remove UInt32ToNumber because we see that it is PureInt. If it is actually PureInt, then this is fine. But DoubleRep can observe it as non-PureInt, and DoubleRep not inserted until well after BackwardsPropogationPhase has run. We add a separate phase that runs after fixup, and pessimizes these speculation properties. Then, we are free to use them as proven properties. Finally, we move any checks in fixup that use these properties to strength reduction. * JSTests/stress/propogate-PureInt-double-use.js: Added. (opt): (noInline.opt.o): (noInline.o.main): * Source/JavaScriptCore/dfg/DFGBackwardsPropagationPhase.cpp: (JSC::DFG::BackwardsPropagationPhase::BackwardsPropagationPhase): (JSC::DFG::BackwardsPropagationPhase::propagate): (JSC::DFG::performBackwardsPropagation): (JSC::DFG::performBackwardsPropagationAfterFixup): * Source/JavaScriptCore/dfg/DFGBackwardsPropagationPhase.h: * Source/JavaScriptCore/dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * Source/JavaScriptCore/dfg/DFGPlan.cpp: (JSC::DFG::Plan::compileInThreadImpl): * Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::compileUInt32ToNumber): * Source/JavaScriptCore/dfg/DFGStrengthReductionPhase.cpp: (JSC::DFG::StrengthReductionPhase::handleNode): fix . Canonical link: https://commits.webkit.org/265833@main
- Loading branch information
Justin Michaud
committed
Jul 7, 2023
1 parent
aff1c9e
commit 2f72624
Showing
7 changed files
with
73 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
function opt(v) | ||
{ | ||
let a = (-1 >>> v) | ||
let b = (a + -0.2) | ||
let c = b | 0 | ||
return c | ||
} | ||
noInline(opt) | ||
|
||
function o(v) { | ||
opt(v) | ||
} | ||
noInline(o) | ||
|
||
function main() { | ||
for (let i = 0; i < 10000; i++) | ||
o(0) | ||
for (let i = 0; i < 10000; ++i) | ||
opt(32) | ||
if (opt(32) != -2) | ||
throw "wrong value" | ||
} | ||
noInline(main) | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters