You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor: move the builtin layer's isolate state into RuntimeState
BuiltinLoader kept two Isolate*-keyed process-wide maps (isolateToPrimordials,
isolateToBuiltinRequire) and NsBuiltinModules a third (isolateToRealm), each
behind its own mutex -- the same shape RuntimeState exists to remove. The
primordials lookup runs on every builtin call, so that one took a lock on a hot
path to reach state that was never actually shared.
All three become per-runtime state: a BuiltinRealm holding the two handles as
v8::Globals, and RealmState, which was already a per-runtime struct with a
destructor. Reaching either is now an isolate data-slot read plus a vector
index, and both are released with the runtime while its isolate is alive.
GetRealm can now return null (the runtime has begun tearing down), so its four
callers degrade rather than resurrect state teardown already released;
Instantiate keeps its contract of leaving an exception pending.
With nothing left to release per isolate, disposeIsolate and IsolateDisposer
are deleted along with the DestroyRuntime call site. RealmState and the
BuiltinLoader handles are consequently destroyed at m_state->Clear() instead;
neither destructor runs JS or touches anything torn down in between, and
~RealmState only deletes v8::Persistents, which never call into V8.
0 commit comments