[vm/aot] Remove special casing of td views, allow external/internal typed data to be fast as well in string decoding

This improves the binary protobuf decoding benchmark by 6% on x64/arm64
and 17% on arm32.

Issue https://github.com/dart-lang/sdk/issues/35154

Change-Id: I23ba48b79b6e2a7698707f81ae4122cb9590ed2c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98844
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
This commit is contained in:
Martin Kustermann 2019-04-08 15:06:03 +00:00 committed by commit-bot@chromium.org
parent 8e4dcf48c4
commit 27a58d455d
2 changed files with 2 additions and 4 deletions

View file

@ -1857,8 +1857,7 @@ int _scanOneByteCharacters(List<int> units, int from, int endIndex) {
final to = endIndex;
// Special case for _Uint8ArrayView.
final cid = ClassID.getID(units);
if (identical(cid, ClassID.cidUint8ArrayView)) {
if (units is Uint8List) {
if (from >= 0 && to >= 0 && to <= units.length) {
for (int i = from; i < to; i++) {
final unit = units[i];

View file

@ -224,8 +224,7 @@ abstract class _StringBase implements String {
var s = _OneByteString._allocate(len);
// Special case for _Uint8ArrayView.
final cid = ClassID.getID(charCodes);
if (identical(cid, ClassID.cidUint8ArrayView)) {
if (charCodes is Uint8List) {
if (start >= 0 && len >= 0) {
for (int i = 0; i < len; i++) {
s._setAt(i, charCodes[start + i]);