-
Notifications
You must be signed in to change notification settings - Fork 29.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
src: remove usages on ScriptCompiler::CompileFunctionInContext #44198
src: remove usages on ScriptCompiler::CompileFunctionInContext #44198
Conversation
V8 APIs like HostImportModuleDynamicallyCallback and ScriptCompiler::CompileFunction is moving away from ScriptOrModule. Replaces ScriptCompiler::CompileFunctionInContext with ScriptCompiler::CompileFunction to remove the usages on the optional out param ScriptOrModule.
Review requested:
|
Fixes nodejs/node-v8#214 ? |
Why is it draft? |
I was verifying that the lifetime of CompiledFnEntry is still correct with this change. But I found that even without this change, the following script can cause an OOM quite quickly: const vm = require('vm');
function work() {
const context = vm.createContext({});
const fn = vm.compileFunction(`
import('foo').then(() => {});
`, [], {
parsingContext: context,
importModuleDynamically: async (specifier, fn, importAssertions) => {
const m = new vm.SyntheticModule(['x'], () => {
m.setExport('x', 1);
}, {
context,
});
await m.link(() => {});
await m.evaluate();
return m;
},
});
fn();
}
(function main() {
work()
// yielding to give chance to the evaluation of promises.
setTimeout(main, 1);
})(); The reference in the As this change is not worsening the condition, I'm marking it ready for review in order to land https://chromium-review.googlesource.com/c/v8/v8/+/3172764, with which we can get rid of the current id-based host-defined-options lookups. (Opened issue #44211 to track this problem) |
@nodejs/vm would you mind taking a look at this PR? thank you! |
V8 APIs like HostImportModuleDynamicallyCallback and ScriptCompiler::CompileFunction is moving away from ScriptOrModule. Replaces ScriptCompiler::CompileFunctionInContext with ScriptCompiler::CompileFunction to remove the usages on the optional out param ScriptOrModule. PR-URL: #44198 Fixes: nodejs/node-v8#214 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Landed in eefe553. Thank you for the review! |
V8 APIs like HostImportModuleDynamicallyCallback and ScriptCompiler::CompileFunction is moving away from ScriptOrModule. Replaces ScriptCompiler::CompileFunctionInContext with ScriptCompiler::CompileFunction to remove the usages on the optional out param ScriptOrModule. PR-URL: #44198 Fixes: nodejs/node-v8#214 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
V8 APIs like HostImportModuleDynamicallyCallback and ScriptCompiler::CompileFunction is moving away from ScriptOrModule. Replaces ScriptCompiler::CompileFunctionInContext with ScriptCompiler::CompileFunction to remove the usages on the optional out param ScriptOrModule. PR-URL: #44198 Fixes: nodejs/node-v8#214 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
V8 APIs like HostImportModuleDynamicallyCallback and ScriptCompiler::CompileFunction is moving away from ScriptOrModule. Replaces ScriptCompiler::CompileFunctionInContext with ScriptCompiler::CompileFunction to remove the usages on the optional out param ScriptOrModule. PR-URL: nodejs#44198 Fixes: nodejs/node-v8#214 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Usages of `v8::ScriptOrModule` were removed in nodejs#44198 so the flag can be disabled by default.
Usages of `v8::ScriptOrModule` were removed in nodejs#44198 so the flag can be disabled by default. PR-URL: nodejs#50616 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Richard Lau <rlau@redhat.com>
Usages of `v8::ScriptOrModule` were removed in nodejs#44198 so the flag can be disabled by default. PR-URL: nodejs#50616 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Richard Lau <rlau@redhat.com>
V8 APIs like HostImportModuleDynamicallyCallback and
ScriptCompiler::CompileFunction are moving away from ScriptOrModule.
Replaces ScriptCompiler::CompileFunctionInContext with
ScriptCompiler::CompileFunction to remove the usages on the optional
out param ScriptOrModule.
Fixes: nodejs/node-v8#214