script: Implement efficient TreeIterator without rooting when possible#42781
script: Implement efficient TreeIterator without rooting when possible#42781yezhizhen merged 10 commits intoservo:mainfrom
Conversation
|
This is related to this discussion #general > Can we lazily unroot DomRoot<_>? and pinging @sagudev and @webbeef to have a look at this idea. |
I think
Unsafe is globally forbiden, but you can allow it locally using |
|
Ok I guess we can live currently with just capturing &JSContext using the NoGC. Is there a way to construct a NoGC or only from JSContext? |
It's only possible from JSContext. |
|
Ok I think I found a nice solution now without the Unsafe code. |
dfecae9 to
c42c633
Compare
|
Ok we now use it in one way the new iterator and see if wpt tests find anything. |
|
🔨 Triggering try run (#22394203015) for Linux (WPT) |
|
Test results for linux-wpt from try job (#22394203015): Flaky unexpected result (22)
Stable unexpected results that are known to be intermittent (21)
Stable unexpected results (2)
|
|
|
|
To me these failures look unrelated so this is ready to review. |
|
🔨 Triggering try run (#22396385173) for Linux (WPT) |
|
Test results for linux-wpt from try job (#22396385173): Flaky unexpected result (24)
Stable unexpected results that are known to be intermittent (20)
Stable unexpected results (2)
|
|
|
|
@Narfinger It seems like these tests might be consistently failing? |
|
Yes. I can investigate when I find some time. |
|
🔨 Triggering try run (#22400581426) for Linux (WPT) |
|
Test results for linux-wpt from try job (#22400581426): Flaky unexpected result (25)
Stable unexpected results that are known to be intermittent (24)
|
|
✨ Try run (#22400581426) succeeded. |
|
Great stuff and it really highlights the importance of &mut JSContext. I am a bit worried because one of invariant of servo is that if you have &DomObject it is rooted somewhere (implicit root). While this work brakes this invariant it's OK ,because for the life of the ref we also have NoGC. But it is something we (me) need to consider when doing phase 2 &mut JSContext. |
a857845 to
38deda1
Compare
Signed-off-by: Narfinger <[email protected]>
Signed-off-by: Narfinger <[email protected]>
Signed-off-by: Narfinger <[email protected]>
Signed-off-by: Narfinger <[email protected]>
Signed-off-by: Narfinger <[email protected]>
Signed-off-by: Narfinger <[email protected]>
Signed-off-by: Narfinger <[email protected]>
Signed-off-by: Narfinger <[email protected]>
Signed-off-by: Narfinger <[email protected]>
Signed-off-by: Narfinger <[email protected]>
In the same vein as #42781 we implement a UnrootedSimpleNodeIterator that takes a no_gc and does not root the required nodes. We include an example usage in 'dom/text.rs' WholeText. This requires #42781 to be merged first. --------- Signed-off-by: Narfinger <[email protected]>
This implements an two types:
We:
We use the new TreeIterator in 'script/dom/document.rs' Open.
Testing: WPT tests should catch this but careful review is required.