-
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.
Could round rather than truncate in compileClampDoubleToByte?
https://bugs.webkit.org/show_bug.cgi?id=72054 rdar://113734964 Reviewed by Yusuke Suzuki. Right now there's a difference between our non-optimizing code and our C++ code for ClampedUint8Arrays. In the C++ code we correctly do a round to nearest (ties to even) but in the optimizing JITs we do a round to inifinity. This patch fixes our optimizing code to round to nearest too. * Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::clampDoubleToByte): (JSC::DFG::compileClampDoubleToByte): * Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::compileCompareStrictEq): Canonical link: https://commits.webkit.org/267100@main
- Loading branch information
Showing
3 changed files
with
26 additions
and
7 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,15 @@ | ||
let array = new Uint8ClampedArray(1); | ||
function foo(value) { | ||
array[0] = value; | ||
} | ||
noInline(foo); | ||
|
||
for (let i = 0; i < 1e6; ++i) { | ||
foo(2.5); | ||
if (array[0] != 2) | ||
throw new Error(i); | ||
|
||
foo(3.5); | ||
if (array[0] != 4) | ||
throw new Error(i); | ||
} |
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