Skip to content

Commit

Permalink
second round of comments
Browse files Browse the repository at this point in the history
  • Loading branch information
codehag committed Jul 13, 2020
1 parent f880e51 commit 913646b
Showing 1 changed file with 18 additions and 25 deletions.
43 changes: 18 additions & 25 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -7897,7 +7897,7 @@ <h1>Objectives</h1>

<ul>
<li>
When WeakRef.prototype.deref is called, the referent (if *undefined* is not returned) is kept alive so that subsequent, synchronous accesses also return the object. This list is reset when synchronous work is done using the ClearKeptObjects abstract operation.
When `WeakRef.prototype.deref` is called, the referent (if *undefined* is not returned) is kept alive so that subsequent, synchronous accesses also return the object. This list is reset when synchronous work is done using the ClearKeptObjects abstract operation.
</li>

<li>
Expand All @@ -7918,7 +7918,7 @@ <h1>Objectives</h1>
<h1>Liveness</h1>

<p>
For some set of objects _S_, a <dfn>hypothetical WeakRef-oblivious</dfn> execution with respect to _S_ is an execution whereby WeakRef.prototype.deref being called on a WeakRef whose referent is an element of _S_ always returns *undefined*.
For some set of objects _S_, a <dfn>hypothetical WeakRef-oblivious</dfn> execution with respect to _S_ is an execution whereby `WeakRef.prototype.deref` being called on a WeakRef whose referent is an element of _S_ always returns *undefined*.
</p>
<emu-note>
WeakRef-obliviousness, together with liveness, capture two notions. One, that a WeakRef itself does not keep an object alive. Two, that cycles in liveness does not imply that an object is live. To be concrete, if determining _obj_'s liveness depends on determining the liveness of another WeakRef referent, _obj2_, _obj2_'s liveness cannot assume _obj_'s liveness, which would beg the question.
Expand Down Expand Up @@ -7992,7 +7992,7 @@ <h1>Execution</h1>
</p>

<p>
Because calling HostEnqueueFinalizationRegistryCleanupJob is optional, registered objects in a FinalizationRegistry do not necessarily hold that FinalizationRegistry live. Implementations may omit FinalizationRegistry callbacks for any reason, e.g., if the FinalizationRegistry itself becomes dead, or if the application is shutting down.
Because calling HostEnqueueFinalizationRegistryCleanupJob is optional, registered objects in a FinalizationRegistry do not necessarily hold that FinalizationRegistry live. Implementations may omit FinalizationRegistry callbacks for any reason, e.g., if the FinalizationRegistry itself becomes dead, or if the application is shutting down.
</p>
</emu-note>
<emu-note>
Expand All @@ -8012,7 +8012,7 @@ <h1>Host Hooks</h1>
<h1>HostEnqueueFinalizationRegistryCleanupJob ( _finalizationRegistry_ )</h1>

<p>
HostEnqueueFinalizationRegistryCleanupJob is an implementation-defined abstract operation that is expected to call CleanupFinalizationRegistry(_finalizationRegistry_) at some point in the future, if possible. The host's responsibility is to make this call at a time which does not interrupt synchronous ECMAScript code execution.
The abstract operation HostEnqueueFinalizationRegistryCleanupJob takes argument _finalizationRegistry_ (a FinalizationRegistry). HostEnqueueFinalizationRegistryCleanupJob is an implementation-defined abstract operation that is expected to call CleanupFinalizationRegistry(_finalizationRegistry_) at some point in the future, if possible. The host's responsibility is to make this call at a time which does not interrupt synchronous ECMAScript code execution.
</p>
</emu-clause>
</emu-clause>
Expand All @@ -8021,7 +8021,7 @@ <h1>HostEnqueueFinalizationRegistryCleanupJob ( _finalizationRegistry_ )</h1>
<emu-clause id="sec-clear-kept-objects" aoid=ClearKeptObjects>
<h1>ClearKeptObjects ( )</h1>
<p>
ECMAScript implementations are expected to call ClearKeptObjects when a synchronous sequence of ECMAScript execution completes.
The abstract operation CreateRealm takes no arguments. ECMAScript implementations are expected to call ClearKeptObjects when a synchronous sequence of ECMAScript execution completes.
</p>
<p>The following steps are performed:</p>
<emu-alg>
Expand All @@ -8032,6 +8032,7 @@ <h1>ClearKeptObjects ( )</h1>

<emu-clause id="sec-addtokeptobjects" aoid="AddToKeptObjects">
<h1>AddToKeptObjects ( _object_ )</h1>
<p> The abstract operation AddToKeptObjects takes argument _object_ (an object). The following steps are performed: </p>
<emu-alg>
1. Let _agent_ be the surrounding agent.
1. Append _object_ to _agent_.[[KeptAlive]].
Expand All @@ -8043,7 +8044,7 @@ <h1>AddToKeptObjects ( _object_ )</h1>

<emu-clause id="sec-cleanup-finalization-registry" aoid="CleanupFinalizationRegistry">
<h1> CleanupFinalizationRegistry ( _finalizationRegistry_ [ , _callback_ ] ) </h1>
<p> The following steps are performed: </p>
<p> The abstract operation CleanupFinalizationRegistry takes argument _finalizationRegistry_ (a finalization registry object) and optional argument _callback_ (a function object). The following steps are performed: </p>
<emu-alg>
1. Assert: _finalizationRegistry_ has [[Cells]] and [[CleanupCallback]] internal slots.
1. If _callback_ is not present or *undefined*, set _callback_ to _finalizationRegistry_.[[CleanupCallback]].
Expand Down Expand Up @@ -38772,10 +38773,10 @@ <h1>JSON [ @@toStringTag ]</h1>
</emu-clause>

<emu-clause id="sec-managing-memory">
<h1> Managing Memory </h1>
<h1>Managing Memory</h1>

<emu-clause id="sec-weak-ref-objects">
<h1> WeakRef Objects </h1>
<h1>WeakRef Objects</h1>
<p>
A WeakRef is an object that is used to refer to a target object without preserving it from garbage collection. WeakRefs can dereference to allow access to the target object, if the target object hasn't been reclaimed by garbage collection.
</p>
Expand All @@ -38800,15 +38801,14 @@ <h1>The WeakRef Constructor</h1>
</ul>

<emu-clause id="sec-weak-ref-target">
<h1> WeakRef ( _target_ ) </h1>
<h1>WeakRef ( _target_ )</h1>
<p>
When the `WeakRef` function is called with argument _target_, the following steps are taken:
</p>
<emu-alg>
1. If NewTarget is *undefined*, throw a *TypeError* exception.
1. If Type(_target_) is not Object, throw a *TypeError* exception.
1. Let _weakRef_ be ? OrdinaryCreateFromConstructor(NewTarget,
`"%WeakRef.prototype%"`, &laquo; [[WeakRefTarget]] &raquo;).
1. Let _weakRef_ be ? OrdinaryCreateFromConstructor(NewTarget, `"%WeakRef.prototype%"`, &laquo; [[WeakRefTarget]] &raquo;).
1. Perfom ! AddToKeptObjects(_target_).
1. Set _weakRef_.[[WeakRefTarget]] to _target_.
1. Return _weakRef_.
Expand Down Expand Up @@ -38843,8 +38843,7 @@ <h1>Properties of the WeakRef Prototype Object</h1>
<ul>
<li>is the intrinsic object <dfn>%WeakRef.prototype%</dfn>.</li>
<li>
has a [[Prototype]] internal slot whose value is the intrinsic
object %Object.prototype%.
has a [[Prototype]] internal slot whose value is %Object.prototype%.
</li>
<li>is an ordinary object.</li>
<li>does not have a [[WeakRefTarget]] internal slot.</li>
Expand Down Expand Up @@ -38909,7 +38908,7 @@ <h1>Properties of WeakRef Instances</h1>
</emu-clause>

<emu-clause id="sec-finalization-registry-objects">
<h1> FinalizationRegistry Objects </h1>
<h1>FinalizationRegistry Objects</h1>
<p>
A FinalizationRegistry is an object that manages registration and unregistration of cleanup operations that are performed when target objects are garbage collected.
</p>
Expand All @@ -38934,7 +38933,7 @@ <h1>The FinalizationRegistry Constructor</h1>
</ul>

<emu-clause id="sec-finalization-registry-cleanup-callback">
<h1> FinalizationRegistry ( _cleanupCallback_ ) </h1>
<h1>FinalizationRegistry ( _cleanupCallback_ )</h1>
<p>
When the `FinalizationRegistry` function is called with argument _cleanupCallback_, the following steps are taken:
</p>
Expand Down Expand Up @@ -38980,8 +38979,7 @@ <h1>Properties of the FinalizationRegistry Prototype Object</h1>
<ul>
<li>is the intrinsic object <dfn>%FinalizationRegistry.prototype%</dfn>.</li>
<li>
has a [[Prototype]] internal slot whose value is the intrinsic
object %Object.prototype%.
has a [[Prototype]] internal slot whose value is %Object.prototype%.
</li>
<li>is an ordinary object.</li>
<li>
Expand All @@ -38991,9 +38989,7 @@ <h1>Properties of the FinalizationRegistry Prototype Object</h1>

<emu-clause id="sec-finalization-registry.prototype.constructor">
<h1>FinalizationRegistry.prototype.constructor</h1>
<p>The initial value of
`FinalizationRegistry.prototype.constructor` is the intrinsic
object %FinalizationRegistry%.</p>
<p>The initial value of `FinalizationRegistry.prototype.constructor` is the intrinsic object %FinalizationRegistry%.</p>
</emu-clause>

<emu-clause id="sec-finalization-registry.prototype.register">
Expand Down Expand Up @@ -39028,11 +39024,8 @@ <h1>FinalizationRegistry.prototype.unregister ( _unregisterToken_ )</h1>
1. Perform ? RequireInternalSlot(_finalizationRegistry_, [[Cells]]).
1. If Type(_unregisterToken_) is not Object, throw a *TypeError* exception.
1. Let _removed_ be *false*.
1. For each Record { [[WeakRefTarget]], [[HeldValue]],
[[UnregisterToken]] } _cell_ that is an element of
_finalizationRegistry_.[[Cells]], do
1. If _cell_.[[UnregisterToken]] is not ~empty~ and
SameValue(_cell_.[[UnregisterToken]], _unregisterToken_) is *true*, then
1. For each Record { [[WeakRefTarget]], [[HeldValue]], [[UnregisterToken]] } _cell_ that is an element of _finalizationRegistry_.[[Cells]], do
1. If _cell_.[[UnregisterToken]] is not ~empty~ and SameValue(_cell_.[[UnregisterToken]], _unregisterToken_) is *true*, then
1. Remove _cell_ from _finalizationRegistry_.[[Cells]].
1. Set _removed_ to *true*.
1. Return _removed_.
Expand Down

0 comments on commit 913646b

Please sign in to comment.