deno
f04489ca - qjs_v8_compat: track 'bytecode consumed' to skip Module::evaluate re-entry

Commit
198 days ago
qjs_v8_compat: track 'bytecode consumed' to skip Module::evaluate re-entry deno_core's lazy_load_esm_module path checks `if status == Instantiated` and re-calls handle_local.evaluate(scope) when true. For modules that QuickJS already evaluated transitively during the entry point's JS_EvalFunction, this re-eval is redundant: the module body has run and any rejection is final. Re-running JS_EvalFunction on the same bytecode would also corrupt refcount tracking. Add a parallel ESM_BYTECODE_CONSUMED set + helpers mark_esm_bytecode_consumed / esm_bytecode_consumed / lookup_esm_module_def_only. Module::evaluate now treats either status == Evaluated or esm_bytecode_consumed == true as "already done" and returns a fresh resolved-promise without touching the bytecode. Mark-on-consume side is wired through compile_module's existing ESM_MODULE_DEFS path; namespace queries continue to work via lookup_esm_module_def_only after the bytecode JSValue is consumed. Net behavior change: prevents the cycle where lazy_load_esm_module fires from inside an entry's body and trips a redundant JS_EvalFunction on a module QuickJS already evaluated.
Author
Parents
Loading