Skip to content

Commit

Permalink
Address remainder of bakkot review
Browse files Browse the repository at this point in the history
  • Loading branch information
syg committed Sep 22, 2023
1 parent 3cc5865 commit 6ce8b17
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -14732,7 +14732,7 @@ <h1>
<dl class="header">
</dl>
<emu-alg>
1. If IntegerIndexedObjectOutOfBounds(_iieoRecord_) is *true*, return 0.
1. If IsIntegerIndexedObjectOutOfBounds(_iieoRecord_) is *true*, return 0.
1. Let _length_ be IntegerIndexedObjectLength(_iieoRecord_).
1. If _length_ = 0, return 0.
1. Let _O_ be _iieoRecord_.[[Object]].
Expand Down Expand Up @@ -41105,20 +41105,17 @@ <h1>%TypedArray%.prototype.subarray ( _begin_, _end_ )</h1>
1. If _relativeBegin_ = -∞, let _beginIndex_ be 0.
1. Else if _relativeBegin_ &lt; 0, let _beginIndex_ be max(_srcLength_ + _relativeBegin_, 0).
1. Else, let _beginIndex_ be min(_relativeBegin_, _srcLength_).
1. Let _elementSize_ be TypedArrayElementSize(_O_).
1. Let _srcByteOffset_ be _O_.[[ByteOffset]].
1. Let _beginByteOffset_ be _srcByteOffset_ + _beginIndex_ × _elementSize_.
1. If _O_.[[ArrayLength]] is ~auto~ and _end_ is *undefined*, then
1. Let _newLength_ be *undefined*.
1. Let _argumentsList_ be « _buffer_, 𝔽(_beginByteOffset_) ».
1. Else,
1. If _end_ is *undefined*, let _relativeEnd_ be _srcLength_; else let _relativeEnd_ be ? ToIntegerOrInfinity(_end_).
1. If _relativeEnd_ = -∞, let _endIndex_ be 0.
1. Else if _relativeEnd_ &lt; 0, let _endIndex_ be max(_srcLength_ + _relativeEnd_, 0).
1. Else, let _endIndex_ be min(_relativeEnd_, _srcLength_).
1. Let _newLength_ be max(_endIndex_ - _beginIndex_, 0).
1. Let _elementSize_ be TypedArrayElementSize(_O_).
1. Let _srcByteOffset_ be _O_.[[ByteOffset]].
1. Let _beginByteOffset_ be _srcByteOffset_ + _beginIndex_ × _elementSize_.
1. If _newLength_ is *undefined*, then
1. Let _argumentsList_ be « _buffer_, 𝔽(_beginByteOffset_) ».
1. Else,
1. Let _argumentsList_ be « _buffer_, 𝔽(_beginByteOffset_), 𝔽(_newLength_) ».
1. Return ? TypedArraySpeciesCreate(_O_, _argumentsList_).
</emu-alg>
Expand Down Expand Up @@ -42735,7 +42732,7 @@ <h1>
<li>If the abstract operation completes normally with ~handled~, _buffer_.[[ArrayBufferByteLength]] is _newByteLength_.</li>
</ul>

<p>The default implementation of HostResizeArrayBuffer is to return ~unhandled~.</p>
<p>The default implementation of HostResizeArrayBuffer is to return NormalCompletion(~unhandled~).</p>
</emu-clause>

<emu-clause id="sec-isfixedlengtharraybuffer" type="abstract operation">
Expand Down Expand Up @@ -43055,7 +43052,7 @@ <h1>get ArrayBuffer [ @@species ]</h1>
</emu-alg>
<p>The value of the *"name"* property of this function is *"get [Symbol.species]"*.</p>
<emu-note>
<p>ArrayBuffer prototype methods normally use their *this* value's constructor to create a derived object. However, a subclass constructor may over-ride that default behaviour for the <emu-xref href="#sec-arraybuffer.prototype.slice" title></emu-xref> method by redefining its @@species property.</p>
<p><emu-xref href="#sec-arraybuffer.prototype.slice" title></emu-xref> normally uses its *this* value's constructor to create a derived object. However, a subclass constructor may over-ride that default behaviour for the <emu-xref href="#sec-arraybuffer.prototype.slice" title></emu-xref> method by redefining its @@species property.</p>
</emu-note>
</emu-clause>
</emu-clause>
Expand Down Expand Up @@ -43202,7 +43199,7 @@ <h1>Resizable ArrayBuffer Guidelines</h1>
<p>The following are guidelines for ECMAScript implementers implementing resizable ArrayBuffer.</p>
<p>Resizable ArrayBuffer can be implemented as copying upon resize, as in-place growth via reserving virtual memory up front, or as a combination of both for different values of the constructor's *"maxByteLength"* option.</p>
<p>If a host is multi-tenanted (i.e. it runs many ECMAScript applications simultaneously), such as a web browser, and its implementations choose to implement in-place growth by reserving virtual memory, we recommend that both 32-bit and 64-bit implementations throw for values of *"maxByteLength"* ≥ 1GiB to 1.5GiB. This is to reduce the likelihood a single application can exhaust the virtual memory address space and to reduce interoperability risk.</p>
<p>If a host does not have virtual memory, such as those running on embedded devices without an MMU, or if a host only implements resizing by copying, it may accept any Number value for the *"maxByteLength"* option. However, we recommend a *RangeError* be thrown if a memory block of the requested size can never be allocated. For example, if the requested size is greater than the maximium amount of usable memory on the device.</p>
<p>If a host does not have virtual memory, such as those running on embedded devices without an MMU, or if a host only implements resizing by copying, it may accept any <emu-not-ref>Number value for</emu-not-ref> the *"maxByteLength"* option. However, we recommend a *RangeError* be thrown if a memory block of the requested size can never be allocated. For example, if the requested size is greater than the maximium amount of usable memory on the device.</p>
</emu-note>
</emu-clause>
</emu-clause>
Expand All @@ -43213,7 +43210,7 @@ <h1>SharedArrayBuffer Objects</h1>
<emu-clause id="sec-fixed-length-and-growable-sharedarraybuffer-objects">
<h1>Fixed-length and Growable SharedArrayBuffer Objects</h1>
<p>A <dfn>fixed-length SharedArrayBuffer</dfn> is a SharedArrayBuffer whose byte length cannot change after creation.</p>
<p>A <dfn>growable SharedArrayBuffer</dfn> is a SharedArshrayBuffer whose byte length may increase after creation via calls to <emu-xref href="#sec-sharedarraybuffer.prototype.grow" title></emu-xref>.</p>
<p>A <dfn>growable SharedArrayBuffer</dfn> is a SharedArrayBuffer whose byte length may increase after creation via calls to <emu-xref href="#sec-sharedarraybuffer.prototype.grow" title></emu-xref>.</p>
<p>The kind of SharedArrayBuffer object that is created depends on the arguments passed to <emu-xref href="#sec-sharedarraybuffer-length" title></emu-xref>.</p>
</emu-clause>

Expand Down Expand Up @@ -43297,7 +43294,7 @@ <h1>
<p>This is in contrast with HostResizeArrayBuffer, which is guaranteed that the value of _newByteLength_ is ≥ 0 and ≤ _buffer_.[[ArrayBufferMaxByteLength]].</p>
</emu-note>

<p>The default implementation of HostGrowSharedArrayBuffer is to return ~unhandled~.</p>
<p>The default implementation of HostGrowSharedArrayBuffer is to return NormalCompletion(~unhandled~).</p>
</emu-clause>
</emu-clause>

Expand Down Expand Up @@ -43396,6 +43393,7 @@ <h1>SharedArrayBuffer.prototype.grow ( _newLength_ )</h1>
1. Let _currentByteLengthRawBytes_ be GetRawBytesFromSharedBlock(_byteLengthBlock_, 0, ~biguint64~, *true*, ~seq-cst~).
1. Let _newByteLengthRawBytes_ be NumericToRawBytes(~biguint64~, ℤ(_newByteLength_), _isLittleEndian_).
1. Repeat,
1. NOTE: This is a compare-and-exchange loop to ensure that parallel, racing grows of the same buffer are totally ordered, are not lost, and do not silently do nothing. The loop exits if it was able to attempt to grow uncontended.
1. Let _currentByteLength_ be ℝ(RawBytesToNumeric(~biguint64~, _currentByteLengthRawBytes_, _isLittleEndian_)).
1. If _newByteLength_ = _currentByteLength_, return *undefined*.
1. If _newByteLength_ &lt; _currentByteLength_ or _newByteLength_ > _O_.[[ArrayBufferMaxByteLength]], throw a *RangeError* exception.
Expand All @@ -43408,7 +43406,7 @@ <h1>SharedArrayBuffer.prototype.grow ( _newLength_ )</h1>
</emu-alg>
<emu-note>
<p>Spurious failures of the compare-exchange to update the length are prohibited. If the bounds checking for the new length passes and the implementation is not out of memory, a ReadModifyWriteSharedMemory event (i.e. a successful compare-exchange) is always added into the candidate execution.</p>
<p>Parallel calls to SharedArrayBuffer.prototype.grow are totally ordered. For example, consider two racing calls: `sab.grow(10)` and `sab.grow(20)`. One of the two calls is guaranteed to win the race. The call to `sab.grow(10)` will never shrink `sab` even if `sab.grow(20)` happened first.</p>
<p>Parallel calls to SharedArrayBuffer.prototype.grow are totally ordered. For example, consider two racing calls: `sab.grow(10)` and `sab.grow(20)`. One of the two calls is guaranteed to win the race. The call to `sab.grow(10)` will never shrink `sab` even if `sab.grow(20)` happened first; in that case it will instead throw a RangeError.</p>
</emu-note>
</emu-clause>

Expand Down Expand Up @@ -50744,10 +50742,12 @@ <h1>Host Hooks</h1>
<p><b>HostEnsureCanCompileStrings(...)</b></p>
<p><b>HostFinalizeImportMeta(...)</b></p>
<p><b>HostGetImportMetaProperties(...)</b></p>
<p><b>HostGrowSharedArrayBuffer(...)</b></p>
<p><b>HostHasSourceTextAvailable(...)</b></p>
<p><b>HostLoadImportedModule(...)</b></p>
<p><b>HostMakeJobCallback(...)</b></p>
<p><b>HostPromiseRejectionTracker(...)</b></p>
<p><b>HostResizeArrayBuffer(...)</b></p>
<p><b>InitializeHostDefinedRealm(...)</b></p>
</emu-annex>

Expand Down

0 comments on commit 6ce8b17

Please sign in to comment.