Skip to content

Conversation

@sjorsdonkers
Copy link
Contributor

Decouples, scope & context creation & entering

  • Moves the HandleScope out of the Scope as it is not possible to have 1 HandleScope per Context.
  • Exposes the main context's responsibility to enter and exit it's v8_context
  • Any additional Locals remaining during context creation have their lifetime limited (previously was page length, now just temp scope)

@sjorsdonkers sjorsdonkers force-pushed the Take-scope-out-of-scope branch from 54e8432 to 49a39e2 Compare May 27, 2025 18:58
@sjorsdonkers sjorsdonkers force-pushed the Take-scope-out-of-scope branch from 49a39e2 to 7075120 Compare May 27, 2025 19:06
@karlseguin
Copy link
Collaborator

I'm not sure I see the point. Does it let us add a feature that's otherwise hard to add or improve performance?

Having the Page know about HandleScope - a detail of V8 - sounds like a step backwards with respect to coupling.

@sjorsdonkers
Copy link
Contributor Author

The most important thing to me what these PRs work toward is changing the name Scope as I consider it misleading.
I understand your point that exposing the concept of an actual scope may work differently in other runtimes, but I don't know.
What I do know is that Context and Scope are orthogonal concepts for which we now have some enter boolean to determine whether we should create a scope.
This PR gives the main context the responsibility to enter it (which should be only in 1 place in a program), so that we do not hide away this important operation. Same for the HandleScope.
I don't think we should be preemptively trying to solve making a generic interface for a runtime, before we have at least 3 or so runtimes we would want to support, especially since we do not know if we will ever need to be generic. Since there is no way to tell (without exploring other runtimes) if the current Scope is a good abstraction I think we should not make the abstraction in this case (given the orthogonality of the concepts).
So better to fix it sooner than later, hence the PR.

@karlseguin karlseguin requested a review from krichprollsch May 28, 2025 11:41
@sjorsdonkers sjorsdonkers marked this pull request as draft June 2, 2025 06:26
@github-actions github-actions bot locked and limited conversation to collaborators Jun 2, 2025
@sjorsdonkers sjorsdonkers deleted the Take-scope-out-of-scope branch June 6, 2025 08:37
@sjorsdonkers sjorsdonkers restored the Take-scope-out-of-scope branch June 6, 2025 10:27
@sjorsdonkers sjorsdonkers deleted the Take-scope-out-of-scope branch August 4, 2025 09:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants