You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Normative: Allow Atomics methods to work on ArrayBuffers.
Allow Atomics methods to work on ArrayBuffers in a fully deterministic
fashion. Atomics.wait still throws when used on ArrayBuffers, while
Atomics.notify always returns 0.
<p>The abstract operation GetModifySetValueInBuffer takes six parameters, a SharedArrayBuffer _arrayBuffer_, a nonnegative integer _byteIndex_, a TypedArray element type _type_, a Number or BigInt _value_, a read-modify-write modification function _op_, and optionally a Boolean _isLittleEndian_. This operation performs the following steps:</p>
36961
+
<p>The abstract operation GetModifySetValueInBuffer takes six parameters, an ArrayBuffer or SharedArrayBuffer _arrayBuffer_, a nonnegative integer _byteIndex_, a TypedArray element type _type_, a Number or BigInt _value_, a read-modify-write modification function _op_, and optionally a Boolean _isLittleEndian_. This operation performs the following steps:</p>
36962
36962
<emu-alg>
36963
-
1. Assert: IsSharedArrayBuffer(_arrayBuffer_) is *true*.
36964
36963
1. Assert: There are sufficient bytes in _arrayBuffer_ starting at _byteIndex_ to represent a value of _type_.
36965
36964
1. Assert: ! IsNonNegativeInteger(_byteIndex_) is *true*.
36966
36965
1. Assert: Type(_value_) is BigInt if ! IsBigIntElementType(_type_) is *true*; otherwise, Type(_value_) is Number.
36967
36966
1. Let _block_ be _arrayBuffer_.[[ArrayBufferData]].
36968
36967
1. Let _elementSize_ be the Element Size value specified in <emu-xref href="#table-the-typedarray-constructors"></emu-xref> for Element Type _type_.
36969
36968
1. If _isLittleEndian_ is not present, set _isLittleEndian_ to the value of the [[LittleEndian]] field of the surrounding agent's Agent Record.
36970
36969
1. Let _rawBytes_ be NumericToRawBytes(_type_, _value_, _isLittleEndian_).
36971
-
1. Let _execution_ be the [[CandidateExecution]] field of the surrounding agent's Agent Record.
36972
-
1. Let _eventList_ be the [[EventList]] field of the element in _execution_.[[EventsRecords]] whose [[AgentSignifier]] is AgentSignifier().
36973
-
1. Let _rawBytesRead_ be a List of length _elementSize_ of nondeterministically chosen byte values.
36974
-
1. NOTE: In implementations, _rawBytesRead_ is the result of a load-link, of a load-exclusive, or of an operand of a read-modify-write instruction on the underlying hardware. The nondeterminism is a semantic prescription of the memory model to describe observable behaviour of hardware with weak consistency.
1. Append Chosen Value Record { [[Event]]: _rmwEvent_, [[ChosenValue]]: _rawBytesRead_ } to _execution_.[[ChosenValues]].
36970
+
1. If IsSharedArrayBuffer(_arrayBuffer_) is *true*, then
36971
+
1. Let _execution_ be the [[CandidateExecution]] field of the surrounding agent's Agent Record.
36972
+
1. Let _eventList_ be the [[EventList]] field of the element in _execution_.[[EventsRecords]] whose [[AgentSignifier]] is AgentSignifier().
36973
+
1. Let _rawBytesRead_ be a List of length _elementSize_ of nondeterministically chosen byte values.
36974
+
1. NOTE: In implementations, _rawBytesRead_ is the result of a load-link, of a load-exclusive, or of an operand of a read-modify-write instruction on the underlying hardware. The nondeterminism is a semantic prescription of the memory model to describe observable behaviour of hardware with weak consistency.
<p>`Atomics.wait` puts the calling agent in a wait queue and puts it to sleep until it is notified or the sleep times out. The following steps are taken:</p>
37997
38000
<emu-alg>
37998
38001
1. Let _buffer_ be ? ValidateIntegerTypedArray(_typedArray_, *true*).
38002
+
1. If IsSharedArrayBuffer(_buffer_) is *false*, throw a *TypeError* exception.
37999
38003
1. Let _i_ be ? ValidateAtomicAccess(_typedArray_, _index_).
38000
38004
1. Let _arrayTypeName_ be _typedArray_.[[TypedArrayName]].
38001
38005
1. If _arrayTypeName_ is *"BigInt64Array"*, let _v_ be ? ToBigInt64(_value_).
0 commit comments