Let's make ScriptWrappable inherit from GarbageCollectedFinalized.
Currently, EventTarget inherits from GarbageCollectedFinalized. Almost everything wrappable inherits from EventTarget, however, not exactly everything.
This is causing a non-negligible disadvantage. We currently need
- WrapperTypeInfo::trace_function
- WrapperTypeInfo::trace_wrappers_function
to trace Oilpan objects and V8 objects. Given there are 1,000 WrapperTypeInfos, we're wasting about 16k bytes just because ScriptWrappable is not GarbageCollected.
Also there will be more chances of optimizations because
- GarbageCollected must be the top of inheritance.
- ScriptWrappable will be the top, too.
- Thus, (void*)script_wrallable == (void*)any_wrappable_type
This means
- ScriptWrappable::ToImpl<T> will be simplified.
- Generated V8T::ToImpl will be no need.
(The offset will be always zero.)
There would be more wins.
Comment 1 by yukishiino@chromium.org
, Oct 11 2017