Changeset 285452 in webkit
- Timestamp:
- Nov 8, 2021, 5:08:35 PM (5 years ago)
- Location:
- branches/safari-612-branch
- Files:
-
- 1 added
- 3 edited
-
JSTests/ChangeLog (modified) (1 diff)
-
JSTests/stress/Uint8ClampedArrayClampsInt52Positive.js (added)
-
Source/JavaScriptCore/ChangeLog (modified) (1 diff)
-
Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/safari-612-branch/JSTests/ChangeLog
r285315 r285452 1 2021-11-08 Kocsen Chung <kocsen_chung@apple.com> 2 3 Cherry-pick r282212. rdar://problem/85165960 4 5 Differential testing: incorrect constant propagation around Uint8ClampedArray 6 https://bugs.webkit.org/show_bug.cgi?id=229869 7 8 JSTests: 9 10 Reviewed by Saam Barati. 11 12 * stress/Uint8ClampedArrayClampsInt52Positive.js: Added. 13 (let.x.123.test): 14 (noInline.test.int32pos1): 15 (255.int32pos2): 16 (1.int32neg1): 17 (0.int32neg2): 18 (0.int52pos1): 19 (255.int52pos2): 20 (255.int52neg1): 21 (0.int52neg2): 22 (0.int52neg3): 23 (0.int52pos3): 24 (255.int8): 25 26 Source/JavaScriptCore: 27 28 We casted int52 values to int32 before clamping, which caused any value with the 32nd bit 29 set to be interpreted as negative. The fix is to check the full-size value when deciding to clamp. 30 31 Reviewed by Saam Barati. 32 33 * ftl/FTLLowerDFGToB3.cpp: 34 (JSC::FTL::DFG::LowerDFGToB3::compileCompareStrictEq): 35 36 37 git-svn-id: https://svn.webkit.org/repository/webkit/trunk@282212 268f45cc-cd09-0410-ab3c-d52691b4dbfc 38 39 2021-09-09 Justin Michaud <justin_michaud@apple.com> 40 41 Differential testing: incorrect constant propagation around Uint8ClampedArray 42 https://bugs.webkit.org/show_bug.cgi?id=229869 43 44 Reviewed by Saam Barati. 45 46 * stress/Uint8ClampedArrayClampsInt52Positive.js: Added. 47 (let.x.123.test): 48 (noInline.test.int32pos1): 49 (255.int32pos2): 50 (1.int32neg1): 51 (0.int32neg2): 52 (0.int52pos1): 53 (255.int52pos2): 54 (255.int52neg1): 55 (0.int52neg2): 56 (0.int52neg3): 57 (0.int52pos3): 58 (255.int8): 59 1 60 2021-11-04 Russell Epstein <repstein@apple.com> 2 61 -
branches/safari-612-branch/Source/JavaScriptCore/ChangeLog
r285332 r285452 1 2021-11-08 Kocsen Chung <kocsen_chung@apple.com> 2 3 Cherry-pick r282212. rdar://problem/85165960 4 5 Differential testing: incorrect constant propagation around Uint8ClampedArray 6 https://bugs.webkit.org/show_bug.cgi?id=229869 7 8 JSTests: 9 10 Reviewed by Saam Barati. 11 12 * stress/Uint8ClampedArrayClampsInt52Positive.js: Added. 13 (let.x.123.test): 14 (noInline.test.int32pos1): 15 (255.int32pos2): 16 (1.int32neg1): 17 (0.int32neg2): 18 (0.int52pos1): 19 (255.int52pos2): 20 (255.int52neg1): 21 (0.int52neg2): 22 (0.int52neg3): 23 (0.int52pos3): 24 (255.int8): 25 26 Source/JavaScriptCore: 27 28 We casted int52 values to int32 before clamping, which caused any value with the 32nd bit 29 set to be interpreted as negative. The fix is to check the full-size value when deciding to clamp. 30 31 Reviewed by Saam Barati. 32 33 * ftl/FTLLowerDFGToB3.cpp: 34 (JSC::FTL::DFG::LowerDFGToB3::compileCompareStrictEq): 35 36 37 git-svn-id: https://svn.webkit.org/repository/webkit/trunk@282212 268f45cc-cd09-0410-ab3c-d52691b4dbfc 38 39 2021-09-09 Justin Michaud <justin_michaud@apple.com> 40 41 Differential testing: incorrect constant propagation around Uint8ClampedArray 42 https://bugs.webkit.org/show_bug.cgi?id=229869 43 44 We casted int52 values to int32 before clamping, which caused any value with the 32nd bit 45 set to be interpreted as negative. The fix is to check the full-size value when deciding to clamp. 46 47 Reviewed by Saam Barati. 48 49 * ftl/FTLLowerDFGToB3.cpp: 50 (JSC::FTL::DFG::LowerDFGToB3::compileCompareStrictEq): 51 1 52 2021-11-04 Russell Epstein <repstein@apple.com> 2 53 -
branches/safari-612-branch/Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp
r285294 r285452 17858 17858 LValue getIntTypedArrayStoreOperand(Edge edge, bool isClamped = false) 17859 17859 { 17860 LValue intValue; 17860 LValue valueAsInt32; 17861 LValue value; 17862 LValue zero; 17863 LValue byteMax; 17864 17861 17865 switch (edge.useKind()) { 17862 17866 case Int52RepUse: 17863 17867 case Int32Use: { 17864 if (edge.useKind() == Int32Use) 17865 intValue = lowInt32(edge); 17866 else 17867 intValue = m_out.castToInt32(lowStrictInt52(edge)); 17868 17868 if (edge.useKind() == Int32Use) { 17869 value = lowInt32(edge); 17870 valueAsInt32 = value; 17871 zero = m_out.int32Zero; 17872 byteMax = m_out.constInt32(255); 17873 } else { 17874 value = lowStrictInt52(edge); 17875 valueAsInt32 = m_out.castToInt32(value); 17876 zero = m_out.int64Zero; 17877 byteMax = m_out.constInt64(255); 17878 } 17879 17869 17880 if (isClamped) { 17870 17881 LBasicBlock atLeastZero = m_out.newBlock(); … … 17874 17885 intValues.append(m_out.anchor(m_out.int32Zero)); 17875 17886 m_out.branch( 17876 m_out.lessThan( intValue, m_out.int32Zero),17887 m_out.lessThan(value, zero), 17877 17888 unsure(continuation), unsure(atLeastZero)); 17878 17889 … … 17880 17891 17881 17892 intValues.append(m_out.anchor(m_out.select( 17882 m_out.greaterThan( intValue, m_out.constInt32(255)),17893 m_out.greaterThan(value, byteMax), 17883 17894 m_out.constInt32(255), 17884 intValue)));17895 valueAsInt32))); 17885 17896 m_out.jump(continuation); 17886 17897 17887 17898 m_out.appendTo(continuation, lastNext); 17888 intValue= m_out.phi(Int32, intValues);17899 valueAsInt32 = m_out.phi(Int32, intValues); 17889 17900 } 17890 17901 break; … … 17916 17927 17917 17928 m_out.appendTo(continuation, lastNext); 17918 intValue= m_out.phi(Int32, intValues);17929 valueAsInt32 = m_out.phi(Int32, intValues); 17919 17930 } else 17920 intValue= doubleToInt32(doubleValue);17931 valueAsInt32 = doubleToInt32(doubleValue); 17921 17932 break; 17922 17933 } … … 17926 17937 } 17927 17938 17928 return intValue;17939 return valueAsInt32; 17929 17940 } 17930 17941
Note:
See TracChangeset
for help on using the changeset viewer.