?uem/p1-90`The descriptions below in this section,
A read-modify-write modification function is a mathematical function that is represented as an
To aid verifying that a read-modify-write modification function's algorithm steps constitute a pure, mathematical function, the following editorial conventions are recommended:
A fixed-length ArrayBuffer is an ArrayBuffer whose byte length cannot change after creation.
A resizable ArrayBuffer is an ArrayBuffer whose byte length may change after creation via calls to
The kind of ArrayBuffer object that is created depends on the arguments passed to
The abstract operation AllocateArrayBuffer takes arguments ctor (a
The abstract operation ArrayBufferByteLength takes arguments arrayBuffer (an ArrayBuffer or SharedArrayBuffer) and order (
The abstract operation ArrayBufferCopyAndDetach takes arguments arrayBuffer (an
realloc.The abstract operation IsDetachedBuffer takes argument arrayBuffer (an ArrayBuffer or a SharedArrayBuffer) and returns a Boolean. It performs the following steps when called:
The abstract operation DetachArrayBuffer takes argument arrayBuffer (an ArrayBuffer) and optional argument key (anything) and returns either a
Detaching an ArrayBuffer instance disassociates the
The abstract operation CloneArrayBuffer takes arguments sourceBuffer (an ArrayBuffer or a SharedArrayBuffer), sourceByteOffset (a non-negative
The abstract operation GetArrayBufferMaxByteLengthOption takes argument options (an
The
The implementation of HostResizeArrayBuffer must conform to the following requirements:
The default implementation of HostResizeArrayBuffer is to return
The abstract operation IsFixedLengthArrayBuffer takes argument arrayBuffer (an ArrayBuffer or a SharedArrayBuffer) and returns a Boolean. It performs the following steps when called:
The abstract operation IsUnsignedElementType takes argument type (a
The abstract operation IsUnclampedIntegerElementType takes argument type (a
The abstract operation IsBigIntElementType takes argument type (a
The abstract operation IsNoTearConfiguration takes arguments type (a
The abstract operation RawBytesToNumeric takes arguments type (a
The abstract operation GetRawBytesFromSharedBlock takes arguments block (a
The abstract operation GetValueFromBuffer takes arguments arrayBuffer (an ArrayBuffer or SharedArrayBuffer), byteIndex (a non-negative
The abstract operation NumericToRawBytes takes arguments type (a
The abstract operation SetValueInBuffer takes arguments arrayBuffer (an ArrayBuffer or SharedArrayBuffer), byteIndex (a non-negative
The abstract operation GetModifySetValueInBuffer takes arguments arrayBuffer (an ArrayBuffer or a SharedArrayBuffer), byteIndex (a non-negative
The ArrayBuffer
extends clause of a class definition. Subclass super call to the ArrayBuffer ArrayBuffer.prototype.This function performs the following steps when called:
The ArrayBuffer
This function performs the following steps when called:
The initial value of ArrayBuffer.prototype is the
This property has the attributes { [[Writable]]:
ArrayBuffer[%Symbol.species%] is an
The value of the
The ArrayBuffer prototype object:
ArrayBuffer.prototype.byteLength is an
The initial value of ArrayBuffer.prototype.constructor is
ArrayBuffer.prototype.detached is an
ArrayBuffer.prototype.maxByteLength is an
ArrayBuffer.prototype.resizable is an
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
The initial value of the
This property has the attributes { [[Writable]]:
ArrayBuffer instances inherit properties from the
ArrayBuffer instances whose [[ArrayBufferData]] is
ArrayBuffer instances whose [[ArrayBufferDetachKey]] is set to a value other than
The following are guidelines for ECMAScript programmers working with
We recommend that programs be tested in their deployment environments where possible. The amount of available physical memory differs greatly between hardware devices. Similarly, virtual memory subsystems also differ greatly between hardware devices as well as operating systems. An application that runs without out-of-memory errors on a 64-bit desktop web browser could run out of memory on a 32-bit mobile web browser.
When choosing a value for the
Please note that successfully constructing a
The following are guidelines for ECMAScript implementers implementing
If a
If a
A fixed-length SharedArrayBuffer is a SharedArrayBuffer whose byte length cannot change after creation.
A growable SharedArrayBuffer is a SharedArrayBuffer whose byte length may increase after creation via calls to
The kind of SharedArrayBuffer object that is created depends on the arguments passed to
The abstract operation AllocateSharedArrayBuffer takes arguments ctor (a
The abstract operation IsSharedArrayBuffer takes argument obj (an ArrayBuffer or a SharedArrayBuffer) and returns a Boolean. It tests whether an object is a SharedArrayBuffer. It performs the following steps when called:
The abstract operation IsGrowableSharedArrayBuffer takes argument obj (an ArrayBuffer or a SharedArrayBuffer) and returns a Boolean. It tests whether an object is a
The
The implementation of HostGrowSharedArrayBuffer must conform to the following requirements:
The second requirement above is intentionally vague about how or when the current byte length of buffer is read. Because the byte length must be updated via an atomic read-modify-write operation on the underlying hardware, architectures that use load-link/store-conditional or load-exclusive/store-exclusive instruction pairs may wish to keep the paired instructions close in the instruction stream. As such,
This is in contrast with
The default implementation of HostGrowSharedArrayBuffer is to return
The SharedArrayBuffer
extends clause of a class definition. Subclass super call to the SharedArrayBuffer SharedArrayBuffer.prototype.Whenever a
Unlike an ArrayBuffer, a SharedArrayBuffer cannot become detached, and its internal [[ArrayBufferData]] slot is never
This function performs the following steps when called:
The SharedArrayBuffer
The initial value of SharedArrayBuffer.prototype is the
This property has the attributes { [[Writable]]:
SharedArrayBuffer[%Symbol.species%] is an
The value of the
The SharedArrayBuffer prototype object:
SharedArrayBuffer.prototype.byteLength is an
The initial value of SharedArrayBuffer.prototype.constructor is
This method performs the following steps when called:
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
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.
SharedArrayBuffer.prototype.growable is an
SharedArrayBuffer.prototype.maxByteLength is an
This method performs the following steps when called:
The initial value of the
This property has the attributes { [[Writable]]:
SharedArrayBuffer instances inherit properties from the
SharedArrayBuffer instances, unlike ArrayBuffer instances, are never detached.
The following are guidelines for ECMAScript programmers working with
We recommend that programs be tested in their deployment environments where possible. The amount of available physical memory differ greatly between hardware devices. Similarly, virtual memory subsystems also differ greatly between hardware devices as well as operating systems. An application that runs without out-of-memory errors on a 64-bit desktop web browser could run out of memory on a 32-bit mobile web browser.
When choosing a value for the
Please note that successfully constructing a
Not all loads of a u8[idx], are not synchronizing. In general, in the absence of explicit synchronization, one property access being in-bound does not imply a subsequent property access in the same length and byteLength getters on SharedArrayBuffer,
The following are guidelines for ECMAScript implementers implementing
We recommend
Because grow operations can happen in parallel with memory accesses on a
Grown memory must appear zeroed from the moment of its creation, including to any racy accesses in parallel. This can be accomplished via zero-filled-on-demand virtual memory pages, or careful synchronization if manually zeroing memory.
In practice it is difficult to implement
A DataView With Buffer Witness Record is a
DataView With Buffer Witness Records have the fields listed in
| Field Name | Value | Meaning |
|---|---|---|
| [[Object]] | a DataView | The DataView object whose buffer's byte length is loaded. |
| [[CachedBufferByteLength]] |
a non-negative |
The byte length of the object's [[ViewedArrayBuffer]] when the |
The abstract operation MakeDataViewWithBufferWitnessRecord takes arguments obj (a DataView) and order (
The abstract operation GetViewByteLength takes argument viewRecord (a
The abstract operation IsViewOutOfBounds takes argument viewRecord (a
The abstract operation GetViewValue takes arguments view (an
The abstract operation SetViewValue takes arguments view (an
The DataView
extends clause of a class definition. Subclass super call to the DataView DataView.prototype.This function performs the following steps when called:
The DataView
The initial value of DataView.prototype is the
This property has the attributes { [[Writable]]:
The DataView prototype object:
DataView.prototype.buffer is an
DataView.prototype.byteLength is an
DataView.prototype.byteOffset is an
The initial value of DataView.prototype.constructor is
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
The initial value of the
This property has the attributes { [[Writable]]:
DataView instances are
The value of the [[DataView]] internal slot is not used within this specification. The simple presence of that internal slot is used within the specification to identify objects created using the DataView
The Atomics object:
new operator.The Atomics object provides functions that operate indivisibly (atomically) on shared memory array cells as well as functions that let
For informative guidelines for programming and implementing shared memory in ECMAScript, please see the notes at the end of the
A Waiter Record is a Atomics.wait or Atomics.waitAsync.
A Waiter Record has fields listed in
| Field Name | Value | Meaning |
|---|---|---|
| [[AgentSignifier]] |
an |
The Atomics.wait or Atomics.waitAsync.
|
| [[PromiseCapability]] |
a |
If denoting a call to Atomics.waitAsync, the resulting promise, otherwise |
| [[TimeoutTime]] |
a non-negative |
The earliest time by which timeout may be triggered; computed using |
| [[Result]] |
|
The return value of the call. |
A WaiterList Record is used to explain waiting and notification of Atomics.wait, Atomics.waitAsync, and Atomics.notify.
A WaiterList Record has fields listed in
| Field Name | Value | Meaning |
|---|---|---|
| [[Waiters]] |
a |
The calls to Atomics.wait or Atomics.waitAsync that are waiting on the location with which this WaiterList is associated.
|
| [[MostRecentLeaveEvent]] |
a |
The event of the most recent leaving of its |
There can be multiple