WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
244182
JSC DFGFixup computes a wrong addSpeculation mode in DFGGraph::addImmediateShouldSpeculteInt32 when immediateValue is Double
https://bugs.webkit.org/show_bug.cgi?id=244182
Summary
JSC DFGFixup computes a wrong addSpeculation mode in DFGGraph::addImmediateSh...
EntryHi
Reported
2022-08-22 00:09:29 PDT
var values = [0, 1, 2, 3, 4, -5]; function foo( arg) { let actual = 0.2 + ( arg | arg ) | 0 print(actual) } for (var i = 0; i < values.length; ++i) { foo( values[i]); } With the above script as input to JSC, run JSC with the following parameters: ./jsc test.js --useConcurrentJIT=0 --jitPolicyScale=0 When the parameter passed to foo is -5, the correct result returned by foo should be -4, but JSC incorrectly returns -5. We found that the problem lies in DFGFixupPhase. When handling ValueAdd node, it will first perform attemptToMakeIntegerAdd. In this step, 0.2 is first converted to 0, and 0 and -5 are added to get the result -5. The correct case should be that 0.2 is added with -5 to get -4.8, and -4.8 is converted to an integer -4. In the fixup phase, whether 0.2 is converted to 0 depends on the result of DFGGraph::addImmediateShouldSpeculateInt32, which incorrectly returns SpeculateInt32AndTruncateConstants mode. When immediateValue is Double, it should return DontSpeculateInt32.
Attachments
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2022-08-29 00:10:16 PDT
<
rdar://problem/99264817
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug