author | Jeff Walden <jwalden@mit.edu> |
Mon, 05 Nov 2018 18:55:56 -0800 | |
changeset 502400 | 297ca8fa0cef4dbe4e40daa4e0a22c565f641f76 |
parent 502399 | 69d5172ed03d640c0bc223ac053773b29ce55272 |
child 502401 | 97e52e72ecfe5058bd9b760d1157e2005f893858 |
push id | 10290 |
push user | ffxbld-merge |
push date | Mon, 03 Dec 2018 16:23:23 +0000 |
treeherder | mozilla-beta@700bed2445e6 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | arai |
bugs | 1504463 |
milestone | 65.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/js/src/frontend/TokenStream.cpp +++ b/js/src/frontend/TokenStream.cpp @@ -827,22 +827,23 @@ TokenStreamChars<Utf8Unit, AnyCharsAcces // 0x1F'FFFF is the maximum value that can fit in 3+6+6+6 unconstrained // bits in a four-byte UTF-8 code unit sequence. constexpr size_t MaxHexSize = sizeof("0x1F" "FFFF"); // including '\0' char codePointCharsArray[MaxHexSize]; char* codePointStr = codePointCharsArray + ArrayLength(codePointCharsArray); *--codePointStr = '\0'; - uint32_t copy = codePoint; - while (copy) { + // Note that by do-while looping here rather than while-looping, this + // writes a '0' when |codePoint == 0|. + do { MOZ_ASSERT(codePointCharsArray < codePointStr); - *--codePointStr = toHexChar(copy & 0xF); - copy >>= 4; - } + *--codePointStr = toHexChar(codePoint & 0xF); + codePoint >>= 4; + } while (codePoint); MOZ_ASSERT(codePointCharsArray + 2 <= codePointStr); *--codePointStr = 'x'; *--codePointStr = '0'; internalEncodingError(codePointLength, JSMSG_FORBIDDEN_UTF8_CODE_POINT, codePointStr, reason); }