script: Add cx_no_gc/cx/realm codegen option and demostrate them
#40582
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Companion to servo/mozjs#650
We added 3 new options to bindings.conf, each more powerful then the previous one, so one should use the least powerful as possible to keep things flexible:
1
cx_no_gcprepends argument&JSContext, which allows creating NoGC tokens and using functions that do not trigger GC.2.
cxprepends argument&mut JSContext, which allows everything that previous one allows, but it also allows calling GC triggering functions.3.
realmprepends argument&mut CurrentRealm, which can be deref_mut to&mut JSContext(so it can do everything that previous can), but it also ensures that there is current entered realm, which can be used for creation of InRealm.next steps: #40600
reviewable per commit
Testing: It's just refactoring
try run: https://github.com/sagudev/servo/actions/runs/19287700927