Skip to content

Pass a jsg::Lock to wrap and unwrap so we can get the isolate from it #4244

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

Merged
merged 9 commits into from
Jun 10, 2025

Conversation

erikcorry
Copy link
Contributor

@erikcorry erikcorry commented Jun 4, 2025

In #4208 we reduced the use of context->GetCurrent since is is only a wrapper around v8::Isolate::GetCurrent.

However, discussion there raised the issue that v8::Isolate::GetCurrent is potentially slow and messy since it gets the isolate from thread-local storage. It was agreed that it would be better to pass the jsg::Lock (which has the isolate) to those functions that need it. This change implements that suggestion.

@erikcorry erikcorry requested review from a team as code owners June 4, 2025 09:13
Copy link
Contributor

windsurf-bot bot commented Jun 4, 2025

The total size of the files in this PR is too large.

@erikcorry erikcorry changed the title Pass a jsg::Lock to wrap and unwrap so we can get the isolate from it  Pass a jsg::Lock to wrap and unwrap so we can get the isolate from it Jun 4, 2025
Copy link

github-actions bot commented Jun 4, 2025

The generated output of @cloudflare/workers-types matches the snapshot in types/generated-snapshot 🎉

@erikcorry erikcorry force-pushed the erikcorry/wrap-unwrap-with-lock branch from 9eb09d6 to 7ac507e Compare June 4, 2025 11:59
@erikcorry erikcorry force-pushed the erikcorry/wrap-unwrap-with-lock branch from eccc68a to ce30c20 Compare June 10, 2025 12:24
Copy link
Collaborator

@jasnell jasnell left a comment

Choose a reason for hiding this comment

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

Overall LGTM (though I recognize there still might be some details remaining to get it to pass CI before it lands)

@erikcorry erikcorry merged commit 08edebb into main Jun 10, 2025
37 of 40 checks passed
@erikcorry erikcorry deleted the erikcorry/wrap-unwrap-with-lock branch June 10, 2025 14:50
erikcorry added a commit that referenced this pull request Jun 10, 2025
…#4244)

* Pass a jsg::Lock to wrap and unwrap so we can get the isolate from it

In #4208 we reduced the use of context->GetCurrent since is is only a wrapper around v8::Isolate::GetCurrent.

However, discussion there raised the issue that v8::Isolate::GetCurrent is potentially slow and messy since it gets the isolate from thread-local storage. It was agreed that it would be better to pass the jsg::Lock (which has the isolate) to those functions that need it. This change implements that suggestion.
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.

4 participants