-
Notifications
You must be signed in to change notification settings - Fork 76
Chore: Update V8 flag initialization to use V8 API #458
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Rachel Green <[email protected]>
static wasm::own<wasm::Engine> engine; | ||
|
||
std::call_once(init, []() { | ||
::v8::internal::v8_flags.liftoff = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But why? It was written years ago, but at the time loading Wasm module wouldn't complete before all compilation phases completed, so Liftoff compilation was wasteful. Is that not the case anymore?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the callout on this. I discussed with Matt and we do want to keep this disabled - Updated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keeping it SGTM, but I think it would be helpful to add a comment that provides some context on why we set it. Internal bug b/278233034 contains some pointers to past discussions. I'd suggest something like: "Disable Liftoff compiler to force optimized JIT up-front."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, this is based on tests from years ago, but TurboFan was always blocking loading of Wasm modules, and this flag doesn't affect that. What it does is that it skips Liftoff compilation that would be discarded in favor of TurboFan anyway... It would be good to verify that's still the case, though.
There are some docs for V8 here: https://v8.dev/docs/wasm-compilation-pipeline
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We want Turbofan to block on loading of Wasm modules, right? Thanks for the docs link, it aligns with discussion above: --no-liftoff
sets the "TurboFan only" mode. If liftoff is enabled, calls can immediately use the compiled code, and then re-compilation with TurboFan is triggered in the background only after a certain threshold of calls.
Signed-off-by: Rachel Green <[email protected]>
Signed-off-by: Rachel Green <[email protected]>
Signed-off-by: Rachel Green <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also worth documenting in the PR description that V8 team recommends setting flags this way rather than directly referencing v8::internal::v8_flags.
static wasm::own<wasm::Engine> engine; | ||
|
||
std::call_once(init, []() { | ||
::v8::internal::v8_flags.liftoff = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keeping it SGTM, but I think it would be helpful to add a comment that provides some context on why we set it. Internal bug b/278233034 contains some pointers to past discussions. I'd suggest something like: "Disable Liftoff compiler to force optimized JIT up-front."
Signed-off-by: Rachel Green <[email protected]>
This change aligns with the V8 team's recommendation of setting flags this way through their API, rather than directly referencing v8::internal::v8_flags.