Revert "[kernel] Create Source.sourceCode as view of the binary bytes"

This reverts commit a07a0333c3.

Reason for revert: Seems to increase AOT build times significantly (see b/251787563).

Original change's description:
> [kernel] Create Source.sourceCode as view of the binary bytes
>
> This saves about 400MB heap when loading a 900MB .dill file.
>
> Change-Id: I5a09b06764cb493aab8dade2afb4665e12688133
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255802
> Reviewed-by: Jens Johansen <jensj@google.com>
> Commit-Queue: Stephen Adams <sra@google.com>

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: Ia7edd7d5e711a33bd037f6edbe52ba2fb561709c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/263101
Reviewed-by: Ivan Inozemtsev <iinozemtsev@google.com>
Reviewed-by: Morgan :) <davidmorgan@google.com>
Commit-Queue: Ilya Yanok <yanok@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Reviewed-by: Ilya Yanok <yanok@google.com>
This commit is contained in:
Ilya Yanok 2022-10-10 11:20:19 +00:00 committed by Commit Queue
parent 651d566124
commit 174f3d3be2

View file

@ -244,18 +244,6 @@ class BinaryBuilder {
return readBytes(readUInt30());
}
Uint8List readOrViewByteList() {
int length = readUInt30();
List<int> source = _bytes;
if (source is Uint8List) {
Uint8List view =
source.buffer.asUint8List(source.offsetInBytes + _byteOffset, length);
_byteOffset += length;
return view;
}
return readBytes(length);
}
String readString() {
return readStringEntry(readUInt30());
}
@ -939,7 +927,7 @@ class BinaryBuilder {
String uriString = readString();
Uri uri = Uri.parse(uriString);
_sourceUriTable[i] = uri;
Uint8List sourceCode = readOrViewByteList();
Uint8List sourceCode = readByteList();
int lineCount = readUInt30();
List<int> lineStarts = new List<int>.filled(
lineCount,