Skip to content

Commit

Permalink
Add notes clarifying the extra detach checks
Browse files Browse the repository at this point in the history
  • Loading branch information
syg committed Aug 10, 2020
1 parent a0c64c3 commit 2875529
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -38109,6 +38109,7 @@ <h1>AtomicReadModifyWrite ( _typedArray_, _index_, _value_, _op_ )</h1>
1. If _typedArray_.[[ContentType]] is ~BigInt~, let _v_ be ? ToBigInt(_value_).
1. Otherwise, let _v_ be ? ToInteger(_value_).
1. If IsDetachedBuffer(_buffer_) is *true*, throw a *TypeError* exception.
1. NOTE: The above check is not redundant with the check in ValidateIntegerTypedArray because the call to ToBigInt or ToInteger on the preceding lines can have arbitrary side effects, which could cause the buffer to become detached.
1. Let _elementSize_ be the Element Size value specified in <emu-xref href="#table-the-typedarray-constructors"></emu-xref> for _arrayTypeName_.
1. Let _elementType_ be the Element Type value in <emu-xref href="#table-the-typedarray-constructors"></emu-xref> for _arrayTypeName_.
1. Let _offset_ be _typedArray_.[[ByteOffset]].
Expand All @@ -38124,6 +38125,7 @@ <h1>AtomicLoad ( _typedArray_, _index_ )</h1>
1. Let _buffer_ be ? ValidateIntegerTypedArray(_typedArray_).
1. Let _i_ be ? ValidateAtomicAccess(_typedArray_, _index_).
1. If IsDetachedBuffer(_buffer_) is *true*, throw a *TypeError* exception.
1. NOTE: The above check is not redundant with the check in ValidateIntegerTypedArray because the call to ValidateAtomicAccess on the preceding line can have arbitrary side effects, which could cause the buffer to become detached.
1. Let _arrayTypeName_ be _typedArray_.[[TypedArrayName]].
1. Let _elementSize_ be the Element Size value specified in <emu-xref href="#table-the-typedarray-constructors"></emu-xref> for _arrayTypeName_.
1. Let _elementType_ be the Element Type value in <emu-xref href="#table-the-typedarray-constructors"></emu-xref> for _arrayTypeName_.
Expand Down Expand Up @@ -38209,6 +38211,7 @@ <h1>Atomics.compareExchange ( _typedArray_, _index_, _expectedValue_, _replaceme
1. Let _expected_ be ? ToInteger(_expectedValue_).
1. Let _replacement_ be ? ToInteger(_replacementValue_).
1. If IsDetachedBuffer(_buffer_) is *true*, throw a *TypeError* exception.
1. NOTE: The above check is not redundant with the check in ValidateIntegerTypedArray because the call to ToBigInt or ToInteger on the preceding lines can have arbitrary side effects, which could cause the buffer to become detached.
1. Let _elementType_ be the Element Type value in <emu-xref href="#table-the-typedarray-constructors"></emu-xref> for _arrayTypeName_.
1. Let _isLittleEndian_ be the value of the [[LittleEndian]] field of the surrounding agent's Agent Record.
1. Let _expectedBytes_ be NumericToRawBytes(_elementType_, _expected_, _isLittleEndian_).
Expand Down Expand Up @@ -38278,6 +38281,7 @@ <h1>Atomics.store ( _typedArray_, _index_, _value_ )</h1>
1. If _arrayTypeName_ is *"BigUint64Array"* or *"BigInt64Array"*, let _v_ be ? ToBigInt(_value_).
1. Otherwise, let _v_ be ? ToInteger(_value_).
1. If IsDetachedBuffer(_buffer_) is *true*, throw a *TypeError* exception.
1. NOTE: The above check is not redundant with the check in ValidateIntegerTypedArray because the call to ToBigInt or ToInteger on the preceding lines can have arbitrary side effects, which could cause the buffer to become detached.
1. Let _elementSize_ be the Element Size value specified in <emu-xref href="#table-the-typedarray-constructors"></emu-xref> for _arrayTypeName_.
1. Let _elementType_ be the Element Type value in <emu-xref href="#table-the-typedarray-constructors"></emu-xref> for _arrayTypeName_.
1. Let _offset_ be _typedArray_.[[ByteOffset]].
Expand Down

0 comments on commit 2875529

Please sign in to comment.