DescriptionShared token objects
Instead of one array for literal and identifier tokens for each TokenStream, share one array among all TokenStreams in an isolate.
The shared array and the token-to-index map is stored in the object store until the embedder is done loading. Then the map is thrown away (and the array remains shared, referred to by the TokenStreams).
When new files get loaded, a new shared array is created. For temporary scripts, e.g. when evaluating one-shot functions, the token arrays are not shared.
This eliminates many duplicate LiteralToken and identifier tokens. Looking at the core libraries:
Before: 30877 identifiers and 9618 literal tokens
After: 12899 identifiers and 6371 literal tokens
BUG=
R=asiva@google.com
Committed: https://github.com/dart-lang/sdk/commit/59dce43dfebd40b5881c8c1ae3dd30622897f0f8
Patch Set 1 #Patch Set 2 : cleanup #
Total comments: 8
Patch Set 3 : catch up #
Messages
Total messages: 7 (3 generated)
|