Change TypeLookup values from simple index (usize) to a TypeMeta

TypeMeta constains the index and the subtype. This allows retrieving the subtype
based on the actual value being bound, as opposed to the struct type. (I.e. it
returns the correct subtype when a Zig class is a proxy for another using the
Self declaration).

Internally store the subtype as an enum. Reduces @sizeOf(TaggedAnyOpaque) from
32 to 16.

Finally, sub_type renamed to subtype for consistency with v8.
This commit is contained in:
Karl Seguin
2025-04-18 09:56:08 +08:00
parent 1c08b3e5e4
commit 615453a687
3 changed files with 66 additions and 20 deletions

20
src/runtime/subtype.zig Normal file
View File

@@ -0,0 +1,20 @@
pub const SubType = enum {
@"error",
array,
arraybuffer,
dataview,
date,
generator,
iterator,
map,
node,
promise,
proxy,
regexp,
set,
typedarray,
wasmvalue,
weakmap,
weakset,
webassemblymemory,
};