[DDC] Rework representation of Enums to be less redundant #59972
Labels
area-web
Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop.
P2
A bug or feature request we're likely to work on
web-dev-compiler
Enums' representation was updated to better match the VM's hot reload semantics in 6edbfd9.
The new representation now diverges significantly from how they're represented in kernel nodes:
name
name
fields are appended to the canonicalized enum fields later (after types have been linked but after canonicalization)index
field is represented as a static lookup on the enclosing Enum'svalues
field.Our changes introduce some low hanging fruit optimization opportunities:
index
iterates throughvalues
, which is a list, usingindexOf
. We could make this a map for faster lookups.extendEnum
function effectively immediately accesses and initializes const enum fields in the const table. We should just emit these once ahead of time - likely in a separate enum handler (separate from normal consts).The text was updated successfully, but these errors were encountered: