Skip to content
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

Rolling to V8 10.0.139.6 #915

Merged
merged 2 commits into from
Mar 9, 2022
Merged

Rolling to V8 10.0.139.6 #915

merged 2 commits into from
Mar 9, 2022

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Mar 8, 2022

Changes:

  • V8::shutdown_platform() -> V8::dispose_platform()
  • v8::HostImportModuleDynamicallyCallback has new arguments
  • v8::Global::get() has been removed. Use v8::Global::open()
  • v8::script_compiler::compile_function_in_context -> v8::script_compiler::compile_function

Comment on lines 236 to 249
/// Clears all references to the v8::Platform. This should be invoked after
/// V8 was disposed.
pub fn shutdown_platform() {
/// V8 was disposed. If it is called if V8 is not disposed, it will panic.
pub fn dispose_platform() {
let mut global_state_guard = GLOBAL_STATE.lock().unwrap();
// First shutdown platform, then drop platform
unsafe { v8__V8__ShutdownPlatform() };
// First check that the global state is disposed. If it is we dispose the
// platform. We then drop the platform.
*global_state_guard = match *global_state_guard {
Disposed(_) => PlatformShutdown,
Disposed(_) => {
unsafe { v8__V8__DisposePlatform() };
PlatformShutdown
}
_ => panic!("Invalid global state"),
};
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please pay extra attention to this change. I updated the order of operations to be more correct. Previously we'd dispose the platform before checking if it is ready to be disposed. Now we check the global state before attempting disposal.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, though it appears that v8 already tracks a similar state-machine internally.

Do we wrap this only so we can throw rust-side panics rather than v8's FATAL ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think so. @piscisaureus or @ry would have to confirm.

@lucacasonato lucacasonato merged commit b91d363 into main Mar 9, 2022
@lucacasonato lucacasonato deleted the autoroll branch March 9, 2022 13:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants