From 211df380655d3fd0c76b9b7f8be399040ca0b7a5 Mon Sep 17 00:00:00 2001 From: stephana Date: Fri, 20 Nov 2015 07:13:27 -0800 Subject: [PATCH] Revert of Fix UB in SkDivBits (patchset #4 id:50001 of https://codereview.chromium.org/1455163004/ ) Reason for revert: This likely causes unit tests to break in depsroll. See error: http://build.chromium.org/p/tryserver.chromium.win/builders/win_chromium_rel_ng/builds/137723/steps/cc_unittests%20%28with%20patch%29/logs/stdio RUN ] ImageScaledRenderSurface.ImageRenderSurfaceScaled_Software [4616:3480:1119/165044:41067403:ERROR:pixel_comparator.cc(175)] Percentage of pixels with an error: 11.3967 [4616:3480:1119/165044:41067403:ERROR:pixel_comparator.cc(177)] Percentage of pixels with errors not greater than 0: 0 [4616:3480:1119/165044:41067403:ERROR:pixel_comparator.cc(180)] Average absolute error (excluding identical pixels): R=0.0600565 G=238.962 B=238.934 A=0 [4616:3480:1119/165044:41067403:ERROR:pixel_comparator.cc(185)] Largest absolute error: R=1 G=255 B=255 A=0 [4616:3480:1119/165044:41067403:ERROR:pixel_comparator.cc(203)] Error Bounding Box : 47,47 206x206 [4616:3480:1119/165044:41067419:ERROR:pixel_test_utils.cc(79)] Pixels do not match! [4616:3480:1119/165044:41067419:ERROR:pixel_test_utils.cc(80)] Actual: data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAAEsCAYAAAB5fY51AAAJ1klEQVR4nO3dwXEbxxaG0eYr76kMaEVAMQJYEUiOQHIEJCMQlQGcAZWBMjAcgZiB4QygCPAWKLloWiIBzgx6/u5zNtp4MVWs+nwB9PQ92W632wIQ4H+1HwBgX4IFxBAsIIZgATEEC4ghWEAMwQJiCBYQQ7CAGIIFxBAsIIZgATEEC4ghWEAMwQJiCBYQQ7CAGIIFxBAsIIZgATEEC4ghWEAMwQJiCBYQQ7CAGIIFxBAsIIZgATEEC4ghWEAMwQJiCBYQQ7CAGIIFxBAsIIZgATEEC4ghWEAMwQJiCBYQQ7CAGIIFxBAsIIZgATEEC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jvWqDeLdd7y/U7xNWmaLCQpJm3VbN2OO8UWEhSdfbqj8cT9cGwXvBrBFYSNo0Y2x8ccnC6quOToYYuBJCxmPbqhl7nD8qLMh4aFu1v90krApAhQVZfnhk1u+bXV7SxlAIAgvy/PiEWVeFILAAyOAbFgAZBBYAGQQWABkEFgAZBBYAGQQWABkEFgAZBBYAGQQWABkEFgAZBBYAGQQWABkEFgAZBBYAGQQWABkEFgAZBBYAGQQWABkEFgAZBBYAGQQWABkEFgAZBBYAGQQWABkEFgAZBBYAGQQWABkEFgAZBBYAGQQWABkEFgAZBBYAGQQWABkEFgAZBBYAGQQWABkEFgAZBBYAGQQWABkEFgAZBBYAGQQWABkEFgAZBBYAGQQWABkEFgAZ/wfucCe/0zz35wAAAABJRU5ErkJggg== e:\b\build\slave\win\build\src\cc\test\layer_tree_pixel_test.cc(116): error: Value of: MatchesPNGFile(*result_bitmap_, ref_file_path, *pixel_comparator_) Actual: false Expected: true [ FAILED ] ImageScaledRenderSurface.ImageRenderSurfaceScaled_Software (57 ms) Original issue's description: > Fix UB in SkDivBits > > DIVBITS_ITER was shifting bits up into the sign bit, which is a no-no. > This turns numer into a uint32_t to make those defined, and adds a few notes. > > x >= 0 is always true for unsigned x, so we needed a few small logic refactors. > > BUG=skia:3562 > > Committed: https://skia.googlesource.com/skia/+/988adddd48322bfa3e3cb0c017cfce71fbbf1123 > > Committed: https://skia.googlesource.com/skia/+/6c7b104b4c08ae2332a6ce3c8c906da4e8c51e5f TBR=caryclark@google.com,mtklein@google.com,mtklein@chromium.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia:3562 Review URL: https://codereview.chromium.org/1467513002 --- BUILD.public | 2 +- src/core/SkMath.cpp | 44 ++++++++++++++------------------------------ tools/dm_flags.json | 4 +++- tools/dm_flags.py | 5 +++++ 4 files changed, 23 insertions(+), 32 deletions(-) diff --git a/BUILD.public b/BUILD.public index e76d879bce..a029a9fa02 100644 --- a/BUILD.public +++ b/BUILD.public @@ -439,7 +439,7 @@ cc_test( "--nogpu", "--verbose", # TODO(mtklein): maybe investigate why these fail? - "--match ~FontMgr ~Scalar ~Canvas ~Codec_stripes ~Codec_Dimensions ~Codec ~Stream ~skps ~RecordDraw_TextBounds", + "--match ~FontMgr ~Scalar ~Canvas ~Codec_stripes ~Codec_Dimensions ~Codec ~Stream ~skps ~Math ~RecordDraw_TextBounds", "--resourcePath %s/resources" % BASE_DIR, "--images %s/resources" % BASE_DIR, ], diff --git a/src/core/SkMath.cpp b/src/core/SkMath.cpp index 9ca1569de6..af93d7ecb2 100644 --- a/src/core/SkMath.cpp +++ b/src/core/SkMath.cpp @@ -45,38 +45,21 @@ int SkCLZ_portable(uint32_t x) { /////////////////////////////////////////////////////////////////////////////// +#define DIVBITS_ITER(n) \ + case n: \ + if ((numer = (numer << 1) - denom) >= 0) \ + result |= 1 << (n - 1); else numer += denom -#define DIVBITS_ITER(k) \ - case k: \ - if (numer*2 >= denom) { \ - numer = numer*2 - denom; \ - result |= 1 << (k-1); \ - } else { \ - numer *= 2; \ - } - -// NOTE: if you're thinking of editing this method, consider replacing it with -// a simple shift and divide. This legacy method predated reliable hardware division. -int32_t SkDivBits(int32_t n, int32_t d, int shift_bias) { - SkASSERT(d != 0); - if (n == 0) { +int32_t SkDivBits(int32_t numer, int32_t denom, int shift_bias) { + SkASSERT(denom != 0); + if (numer == 0) { return 0; } - // Make numer and denom positive, and sign hold the resulting sign - // We'll be left-shifting numer, so it's important it's a uint32_t. - // We put denom in a uint32_t just to keep things simple. - int32_t sign = SkExtractSign(n ^ d); -#if defined(SK_SUPPORT_LEGACY_DIVBITS_UB) - // Blink layout tests are baselined to Clang optimizing through the UB. - int32_t numer = SkAbs32(n); - int32_t denom = SkAbs32(d); -#else - uint32_t numer = SkAbs32(n); - uint32_t denom = SkAbs32(d); -#endif - - // It's probably a bug to use n or d below here. + // make numer and denom positive, and sign hold the resulting sign + int32_t sign = SkExtractSign(numer ^ denom); + numer = SkAbs32(numer); + denom = SkAbs32(denom); int nbits = SkCLZ(numer) - 1; int dbits = SkCLZ(denom) - 1; @@ -95,9 +78,10 @@ int32_t SkDivBits(int32_t n, int32_t d, int shift_bias) { SkFixed result = 0; // do the first one - if (numer >= denom) { - numer -= denom; + if ((numer -= denom) >= 0) { result = 1; + } else { + numer += denom; } // Now fall into our switch statement if there are more bits to compute diff --git a/tools/dm_flags.json b/tools/dm_flags.json index 3c557865dc..be6bc3d747 100644 --- a/tools/dm_flags.json +++ b/tools/dm_flags.json @@ -1221,7 +1221,9 @@ "_", "image", "_", - "interlaced3.png" + "interlaced3.png", + "--match", + "~Math" ], "Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-Valgrind": [ "--matrix", diff --git a/tools/dm_flags.py b/tools/dm_flags.py index 5341b221da..7c901891ca 100755 --- a/tools/dm_flags.py +++ b/tools/dm_flags.py @@ -169,6 +169,11 @@ def get_args(bot): if 'Valgrind' in bot: # skia:3021 match.append('~Threaded') + # skia:3562 + if ('TSAN' in bot or + 'Test-Mac10.8-Clang-MacMini4.1-CPU-SSE4-x86_64-Release' in bot): + match.append('~Math') + if 'GalaxyS3' in bot: # skia:1699 match.append('~WritePixels')