dart2js Uri patch: avoid unnecessary code-unit to String conversions

results in:

H.Primitives_stringFromCharCode(C.JSString_methods.codeUnitAt$1("0123456789ABCDEF", $byte & 15)
-->
"0123456789ABCDEF"[$byte & 15]

dart2js does not know how to do this yet.

R=lrn@google.com

Review URL: https://codereview.chromium.org/1420303011 .
This commit is contained in:
Stephen Adams 2015-11-05 17:55:41 -08:00
parent 42b9d7b702
commit b3a4cc337c

View file

@ -558,12 +558,12 @@ class Uri {
((canonicalTable[byte >> 4] & (1 << (byte & 0x0f))) != 0)) {
result.writeCharCode(byte);
} else if (spaceToPlus && byte == _SPACE) {
result.writeCharCode(_PLUS);
result.write('+');
} else {
const String hexDigits = '0123456789ABCDEF';
result.writeCharCode(_PERCENT);
result.writeCharCode(hexDigits.codeUnitAt(byte >> 4));
result.writeCharCode(hexDigits.codeUnitAt(byte & 0x0f));
result.write('%');
result.write(hexDigits[(byte >> 4) & 0x0f]);
result.write(hexDigits[byte & 0x0f]);
}
}
return result.toString();