fix: use WriteBarrierEarlyInit for WriteBarriers initialized before finishCreation

NodeVMModule::m_moduleWrapper and NodeVMSyntheticModule::m_syntheticEvaluationSteps
were using the regular WriteBarrier constructor (vm, this, value) in their
member initializer lists, which calls vm.writeBarrier(this, ...) before
the cell is markable (finishCreation has not been called yet).

Use WriteBarrierEarlyInit instead, consistent with the adjacent m_context
field and other similar patterns in the codebase.
This commit is contained in:
Sosuke Suzuki
2026-02-26 19:18:28 +09:00
parent 30e609e080
commit 03a2b34c19
2 changed files with 2 additions and 2 deletions

View File

@@ -154,7 +154,7 @@ NodeVMModule::NodeVMModule(JSC::VM& vm, JSC::Structure* structure, WTF::String i
: Base(vm, structure)
, m_identifier(WTF::move(identifier))
, m_context(context && context.isObject() ? asObject(context) : nullptr, JSC::WriteBarrierEarlyInit)
, m_moduleWrapper(vm, this, moduleWrapper)
, m_moduleWrapper(moduleWrapper, JSC::WriteBarrierEarlyInit)
{
}

View File

@@ -54,7 +54,7 @@ private:
NodeVMSyntheticModule(JSC::VM& vm, JSC::Structure* structure, WTF::String identifier, JSValue context, JSValue moduleWrapper, WTF::HashSet<String> exportNames, JSValue syntheticEvaluationSteps)
: Base(vm, structure, WTF::move(identifier), context, moduleWrapper)
, m_exportNames(WTF::move(exportNames))
, m_syntheticEvaluationSteps(vm, this, syntheticEvaluationSteps)
, m_syntheticEvaluationSteps(syntheticEvaluationSteps, JSC::WriteBarrierEarlyInit)
{
}