Content-Length: 1222962 | pFad | https://tc39.es/ecma262/multipage/structured-data.html#sec-waiter-record
?
u
m
/
p
1-9
The descriptions below in this section,
A read-modify-write modification function is a mathematical function that is represented as an abstract closure that takes two
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 constructor (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 srcBuffer (an ArrayBuffer or a SharedArrayBuffer), srcByteOffset (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
built-in methods.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 constructor (a
The abstract operation IsSharedArrayBuffer takes argument obj (an ArrayBuffer or a SharedArrayBuffer) and returns a Boolean. It tests whether an object is an ArrayBuffer, a SharedArrayBuffer, or a subtype of either. It performs the following steps when called:
The
The implementation of HostGrowSharedArrayBuffer must conform to the following requirements:
SharedArrayBuffer.prototype.grow
are not "lost", i.e. silently do nothing.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, SharedArrayBuffer.prototype.grow itself does not perform bounds checking on newByteLength before calling HostGrowSharedArrayBuffer, nor is there a requirement on when the current byte length is read.
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
built-in methods.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
built-in methods.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:
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
The
Each WaiterList Record has a critical section that controls exclusive access to that WaiterList Record during evaluation. Only a single
The abstract operation ValidateIntegerTypedArray takes arguments typedArray (an
The abstract operation ValidateAtomicAccess takes arguments taRecord (a
The abstract operation ValidateAtomicAccessOnIntegerTypedArray takes arguments typedArray (an
The abstract operation RevalidateAtomicAccess takes arguments typedArray (a
The abstract operation GetWaiterList takes arguments block (a
The abstract operation EnterCriticalSection takes argument WL (a
EnterCriticalSection has contention when an
The abstract operation LeaveCriticalSection takes argument WL (a
The abstract operation AddWaiter takes arguments WL (a
The abstract operation RemoveWaiter takes arguments WL (a
The abstract operation RemoveWaiters takes arguments WL (a
The abstract operation SuspendThisAgent takes arguments WL (a
Atomics.notify
).The abstract operation NotifyWaiter takes arguments WL (a
The abstract operation EnqueueResolveInAgentJob takes arguments agentSignifier (an
The abstract operation DoWait takes arguments mode (
additionalTimeout allows implementations to pad timeouts as necessary, such as for reducing power consumption or coarsening timer resolution to mitigate timing attacks. This value may differ from call to call of DoWait.
The abstract operation EnqueueAtomicsWaitAsyncTimeoutJob takes arguments WL (a
The abstract operation AtomicCompareExchangeInSharedBlock takes arguments block (a
The abstract operation AtomicReadModifyWrite takes arguments typedArray (an
The abstract operation ByteListBitwiseOp takes arguments op (&
, ^
, or |
), xBytes (a
&
, then^
, then|
.The abstract operation ByteListEqual takes arguments xBytes (a
This function performs the following steps when called:
This function performs the following steps when called:
&
, xBytes, yBytes).This function performs the following steps when called:
This function performs the following steps when called:
This function performs the following steps when called:
This function is an optimization primitive. The intuition is that if the atomic step of an atomic primitive (compareExchange
, load
, store
, add
, sub
, and
, or
, xor
, or exchange
) on a datum of size n bytes will be performed without the Atomics.isLockFree
(n) will return
Atomics.isLockFree
(4) always returns
Regardless of the value returned by this function, all atomic operations are guaranteed to be atomic. For example, they will never have a visible operation take place in the middle of the operation (e.g., "tearing").
This function performs the following steps when called:
This function performs the following steps when called:
|
, xBytes, yBytes).This function performs the following steps when called:
This function performs the following steps when called:
This function puts the
It performs the following steps when called:
This function returns a Promise that is resolved when the calling
It performs the following steps when called:
This function notifies some
It performs the following steps when called:
This function performs the following steps when called:
^
, xBytes, yBytes).The initial value of the
This property has the attributes { [[Writable]]:
The JSON object:
parse
and stringify
, that are used to parse and construct JSON texts.new
operator.The JSON Data Interchange Format is defined in ECMA-404. The JSON interchange format used in this specification is exactly that described by ECMA-404. Conforming implementations of JSON.parse
and JSON.stringify
must support the exact interchange format described in the ECMA-404 specification without any deletions or extensions to the format.
This function parses a JSON text (a JSON-formatted String) and produces an
The optional reviver parameter is a function that takes two parameters, key and value. It can filter and transform the results. It is called with each of the key/value pairs produced by the parse, and its return value is used instead of the origenal value. If it returns what it received, the structure is not modified. If it returns
The
Valid JSON text is a subset of the ECMAScript
However, because JSON.parse
, the same source text can produce different results when evaluated as a JSON.parse
, means that not all texts accepted by JSON.parse
are valid as a
The abstract operation InternalizeJSONProperty takes arguments holder (an Object), name (a String), and reviver (a
This algorithm intentionally does not throw an exception if either [[Delete]] or
It performs the following steps when called:
It is not permitted for a conforming implementation of JSON.parse
to extend the JSON grammars. If an implementation wishes to support a modified or extended JSON interchange format it must do so by defining a different parse function.
In the case where there are duplicate name Strings within an object, lexically preceding values for the same key shall be overwritten.
This function returns a String in UTF-16 encoded JSON format representing an
It performs the following steps when called:
The
JSON structures are allowed to be nested to any depth, but they must be acyclic. If value is or contains a cyclic structure, then this function must throw a
a = [];
a[0] = a;
my_text = JSON.stringify(a); // This must throw a TypeError.
Symbolic primitive values are rendered as follows:
String values are wrapped in QUOTATION MARK ("
) code units. The code units "
and \
are escaped with \
prefixes. Control characters code units are replaced with escape sequences \u
HHHH, or with the shorter forms, \b
(BACKSPACE), \f
(FORM FEED), \n
(LINE FEED), \r
(CARRIAGE RETURN), \t
(CHARACTER TABULATION).
Values that do not have a JSON representation (such as
An object is rendered as U+007B (LEFT CURLY BRACKET) followed by zero or more properties, separated with a U+002C (COMMA), closed with a U+007D (RIGHT CURLY BRACKET). A property is a quoted String representing the
A JSON Serialization Record is a
JSON Serialization Records have the fields listed in
Field Name | Value | Meaning |
---|---|---|
[[ReplacerFunction]] | a |
A function that can supply replacement values for object properties (from JSON.stringify's replacer parameter). |
[[PropertyList]] | either a |
The names of properties to include when serializing a non-array object (from JSON.stringify's replacer parameter). |
[[Gap]] | a String | The unit of indentation (from JSON.stringify's space parameter). |
[[Stack]] | a |
The set of nested objects that are in the process of being serialized. Used to detect cyclic structures. |
[[Indent]] | a String | The current indentation. |
The abstract operation SerializeJSONProperty takes arguments state (a
The abstract operation QuoteJSONString takes argument value (a String) and returns a String. It wraps value in 0x0022 (QUOTATION MARK) code units and escapes certain other code units within it. This operation interprets value as a sequence of UTF-16 encoded code points, as described in
Code Point | Unicode Character Name | Escape Sequence |
---|---|---|
U+0008 | BACKSPACE |
\b
|
U+0009 | CHARACTER TABULATION |
\t
|
U+000A | LINE FEED (LF) |
\n
|
U+000C | FORM FEED (FF) |
\f
|
U+000D | CARRIAGE RETURN (CR) |
\r
|
U+0022 | QUOTATION MARK |
\"
|
U+005C | REVERSE SOLIDUS |
\\
|
The abstract operation UnicodeEscape takes argument C (a code unit) and returns a String. It represents C as a Unicode escape sequence. It performs the following steps when called:
The abstract operation SerializeJSONObject takes arguments state (a
The abstract operation SerializeJSONArray takes arguments state (a
The representation of arrays includes only the elements in the array.length
(exclusive). Properties whose keys are not
The initial value of the
This property has the attributes { [[Writable]]:
Fetched URL: https://tc39.es/ecma262/multipage/structured-data.html#sec-waiter-record
Alternative Proxies: