ecma262
ecma262 copied to clipboard
Normative: Spec liveness constraint for template objects
The Lit framework depends on the identity of template arrays being stable (and not being recreated) so long as the site might still get evaluated in the future.
This PR removes the incorrect note about observability of template array objects and tries to spec normative liveness constraints. Firstly, the collection of template objects is most definitely now observable because of WeakRefs. The intention IIRC was that so long as the template site could still be evaluated, we can't GC the template object, but if the template site could no longer be evaluated (what I understand to be meant by "the Parse Node is unreachable), then we can GC it.
Instead of depending on this misleading note about observability, this PR specs the liveness of Parse Nodes, and directly specs the removal from the template registry if the Parse Nodes are no longer live.
cc @leszekswirski and @justinfagnani
Also see v8:13190
Would appreciate reviews from Kevin and Waldemar, who've thought deeply about our liveness definition in the past.
What does it mean to "observe the identity" of a Parse Node in any valid Future Execution? If this means "same Parse Node" comparisons, then GetTemplateObject always observes the identities of all Parse Nodes in a Realm, so how can any cease to be live?
@waldemarhorwat I had intended "observe the identity" of a Parse Node to mean the "same Parse Node" comparison. But that indeed is buggy as written, because the template registry is specced as an associative list, this means GetTemplateObject observes the identity of every Parse Node in the [[TemplateMap]].
My intention here was to only count the Parse Node passed as the argument to GetTemplateObject as "observed". I am not sure what the best way to capture that intention is currently.