build: enable V8 builtins PGO#50416
Conversation
|
We should backport this to supported release lines as a perf win once it's validated in a successful nightly build. |
deepak1556
left a comment
There was a problem hiding this comment.
Failures on linux are unrelated to this change, refs #48149 (comment)
Removes the gn arg that disabled V8 builtins profile-guided optimization and adds a V8 patch to warn instead of abort when the builtin PGO profile data does not match. Also strips the PGO-related flags from the generated mksnapshot_args so they are not passed through to downstream mksnapshot invocations.
Addresses review feedback: the v8_enable_javascript_promise_hooks flag is set to support Node.js async_hooks, not used directly by Electron.
80029ef to
93902d1
Compare
|
Release Notes Persisted
|
|
/trop run backport-to 42-x-y, 41-x-y, 40-x-y |
|
The backport process for this PR has been manually initiated - sending your PR to |
|
The backport process for this PR has been manually initiated - sending your PR to |
|
The backport process for this PR has been manually initiated - sending your PR to |
|
I have automatically backported this PR to "42-x-y", please check out #50573 |
|
I have automatically backported this PR to "41-x-y", please check out #50574 |
|
I have automatically backported this PR to "40-x-y", please check out #50575 |
Description of Change
Re-enables V8 builtins PGO, which was disabled in #38252 due to profile references breaking the shipped
mksnapshot_args. The CI-side mitigation for that has existed since the GHA migration (sed stripping inbuild-electron/action.yml), but the build-side disable was never reverted.What this does:
v8_builtins_profiling_log_file = ""fromall.gnso V8's default auto-selection kicks in (pickstools/builtins-pgo/profiles/x64.profilewhenchrome_pgo_phase == 2, i.e. release builds only)--abort-on-bad-builtin-profile-datato--warn-about-builtin-profile-datain mksnapshot invocationmksnapshot_argsstripping to also remove the orphaned--reorder-builtins/--warn-about-builtin-profile-dataflags (which crash/no-op without profile input)Why the warn flag is safe:
Electron sets
v8_enable_javascript_promise_hooks = true, which adds#ifdefbranches inbuiltins-microtask-queue-gen.ccandpromise-misc.tq. This changes the control-flow graph hash of 11 Promise/async builtins, so they mismatch V8's pre-generated profile (built with Chrome defaults). With--abort, this fails the build; with--warn, perpipeline.cc:ValidateProfileData, the builtin's profile data is set tonullptrand it compiles without PGO — identical to today's behavior for that builtin. No correctness risk.The 11 skipped builtins:
RunMicrotasks,AsyncFunctionEnter/Await,AsyncGeneratorYieldWithAwait/PrototypeNext/Await,FulfillPromise,NewPromiseCapability,PromiseConstructor/Resolve/PrototypeThen. The remaining ~490 builtins (Array, String, RegExp, Map/Set, TypedArray, iterators, etc.) all receive PGO.Validated: Release build succeeds,
mksnapshot.zipextracted to an isolated directory runs standalone and generatessnapshot_blob.binafter CI stripping is applied.Future work: For full coverage of the 11 Promise/async builtins, we could generate Electron-specific profiles by running
v8/tools/builtins-pgo/generate.pywith our V8 gn args against JetStream2 — roughly a 15-20 min CI job per arch that could trigger on Chromium rolls.Checklist
npm testpassesRelease Notes
Notes: Enabled profile-guided optimization for V8 builtins in release builds, improving JavaScript builtin performance (Array, String, RegExp, etc.).