ECMA-262 (12th Edition) ECMAScript 2021 Language Specification - page 9

 

  Главная      Manuals     ECMA-262 (12th Edition) ECMAScript 2021 Language Specification

 

Search            copyright infringement  

 

 

 

 

 

 

 

 

 

 

 

Content      ..     7      8      9      10     ..

 

 

 

ECMA-262 (12th Edition) ECMAScript 2021 Language Specification - page 9

 

 

A Module Namespace Object is a 

module namespace exotic object

 that provides runtime property-based access to a

module's exported bindings. There is no 

constructor

 function for Module Namespace Objects. Instead, such an object

is created for each module that is imported by an 

ImportDeclaration

 that includes a 

NameSpaceImport

.

In addition to the properties specified in 

10.4.6

 each Module Namespace Object has the following own property:

The initial value of the 

@@toStringTag

 property is the String value 

"Module"

.

This property has the attributes { [[Writable]]: 

false

, [[Enumerable]]: 

false

, [[Configurable]]: 

false

 }.

The memory consistency model, or 

memory model

, specifies the possible orderings of 

Shared Data Block

 events, arising

via accessing TypedArray instances backed by a SharedArrayBuffer and via methods on the Atomics object. When the
program has no data races (defined below), the ordering of events appears as sequentially consistent, i.e., as an
interleaving of actions from each 

agent

. When the program has data races, shared memory operations may appear

sequentially inconsistent. For example, programs may exhibit causality-violating behaviour and other astonishments.
These astonishments arise from compiler transforms and the design of CPUs (e.g., out-of-order execution and
speculation). The memory model defines both the precise conditions under which a program exhibits sequentially
consistent behaviour as well as the possible values read from data races. To wit, there is no undefined behaviour.

The memory model is defined as relational constraints on events introduced by 

abstract operations

 on

SharedArrayBuffer or by methods on the Atomics object during an evaluation.

NOTE

Shared memory accesses (reads and writes) are divided into two groups, atomic accesses and data accesses, defined
below. Atomic accesses are sequentially consistent, i.e., there is a strict total ordering of events agreed upon by all
agents in an 

agent cluster

. Non-atomic accesses do not have a strict total ordering agreed upon by all agents, i.e.,

unordered.

NOTE 1

This section provides an axiomatic model on events introduced by the 

abstract operations

 on

SharedArrayBuffers. It bears stressing that the model is not expressible algorithmically, unlike
the rest of this specification. The nondeterministic introduction of events by 

abstract operations

 is

the interface between the operational semantics of ECMAScript evaluation and the axiomatic
semantics of the memory model. The semantics of these events is defined by considering graphs
of all events in an evaluation. These are neither Static Semantics nor Runtime Semantics. There is
no demonstrated algorithmic implementation, but instead a set of constraints that determine if a
particular event graph is allowed or disallowed.

No orderings weaker than sequentially consistent and stronger than unordered, such as release-
acquire, are supported.

28.3.1  @@toStringTag

29  Memory Model

29.1  Memory Model Fundamentals

799

object specified and supplied by an ECMAScript implementation

NOTE

primitive value used when a variable has not been assigned a value

type whose sole value is the 

undefined

 value

primitive value that represents the intentional absence of any object value

type whose sole value is the 

null

 value

member of the Boolean type

NOTE

type consisting of the primitive values 

true

 and 

false

member of the Object type that is an instance of the standard built-in Boolean 

constructor

NOTE

Standard built-in objects are defined in this specification. An ECMAScript implementation may
specify and supply additional kinds of built-in objects. A 

built-in 

constructor

 is a built-in object

that is also a 

constructor

.

There are only two Boolean values, 

true

 and 

false

.

A Boolean object is created by using the Boolean 

constructor

 in a 

new

new

 expression, supplying a

Boolean value as an argument. The resulting object has an internal slot whose value is the
Boolean value. A Boolean object can be coerced to a Boolean value.

4.4.12  built-in object

4.4.13  undefined value

4.4.14  Undefined type

4.4.15  null value

4.4.16  Null type

4.4.17  Boolean value

4.4.18  Boolean type

4.4.19  Boolean object

4.4.20  String value

54

primitive value that is a finite ordered sequence of zero or more 16-bit unsigned 

integer

 values

NOTE

set of all possible String values

member of the Object type that is an instance of the standard built-in String 

constructor

NOTE

primitive value corresponding to a double-precision 64-bit binary format 

IEEE 754-2019

 value

NOTE

set of all possible Number values including the special “Not-a-Number” (NaN) value, positive infinity, and negative
infinity

member of the Object type that is an instance of the standard built-in Number 

constructor

NOTE

Number value

 that is the positive infinite 

Number value

A String value is a member of the String type. Each 

integer

 value in the sequence usually

represents a single 16-bit unit of UTF-16 text. However, ECMAScript does not place any
restrictions or requirements on the values except that they must be 16-bit unsigned integers.

A String object is created by using the String 

constructor

 in a 

new

new

 expression, supplying a String

value as an argument. The resulting object has an internal slot whose value is the String value. A
String object can be coerced to a String value by calling the String 

constructor

 as a function

(

22.1.1.1

).

Number value

 is a member of the Number type and is a direct representation of a number.

A Number object is created by using the Number 

constructor

 in a 

new

new

 expression, supplying a

Number value

 as an argument. The resulting object has an internal slot whose value is the

Number value

. A Number object can be coerced to a 

Number value

 by calling the Number

constructor

 as a function (

21.1.1.1

).

4.4.21  String type

4.4.22  String object

4.4.23  Number value

4.4.24  Number type

4.4.25  Number object

4.4.26  Infinity

55

Number value

 that is an 

IEEE 754-2019

 “Not-a-Number” value

primitive value corresponding to an arbitrary-precision 

integer

 value

set of all possible BigInt values

member of the Object type that is an instance of the standard built-in BigInt 

constructor

primitive value that represents a unique, non-String Object property key

set of all possible Symbol values

member of the Object type that is an instance of the standard built-in Symbol 

constructor

member of the Object type that may be invoked as a subroutine

NOTE

built-in object that is a function

NOTE

part of an object that associates a key (either a String value or a Symbol value) and a value

In addition to its properties, a function contains executable code and state that determine how it
behaves when invoked. A function's code may or may not be written in ECMAScript.

Examples of built-in functions include 

parseInt

parseInt

 and 

Math.exp

Math.exp

. A 

host

 or implementation

may provide additional built-in functions that are not described in this specification.

4.4.27  NaN

4.4.28  BigInt value

4.4.29  BigInt type

4.4.30  BigInt object

4.4.31  Symbol value

4.4.32  Symbol type

4.4.33  Symbol object

4.4.34  function

4.4.35  built-in function

4.4.36  property

56

NOTE

function that is the value of a property

NOTE

method that is a built-in function

NOTE

internal value that defines some characteristic of a property

property that is directly contained by its object

property of an object that is not an own property but is a property (either own or inherited) of the object's prototype

The remainder of this specification is organized as follows:

Clause 

5

 defines the notational conventions used throughout the specification.

Clauses 

6

 through 

10

 define the execution environment within which ECMAScript programs operate.

Clauses 

11

 through 

17

 define the actual ECMAScript programming language including its syntactic encoding and the

execution semantics of all language features.

Clauses 

18

 through 

28

 define the ECMAScript standard library. They include the definitions of all of the standard

objects that are available for use by ECMAScript programs as they execute.

Clause 

29

 describes the memory consistency model of accesses on SharedArrayBuffer-backed memory and methods

Depending upon the form of the property the value may be represented either directly as a data
value (a primitive value, an object, or a 

function object

) or indirectly by a pair of accessor

functions.

When a function is called as a method of an object, the object is passed to the function as its 

this

value.

Standard built-in methods are defined in this specification. A 

host

 or implementation may

provide additional built-in methods that are not described in this specification.

4.4.37  method

4.4.38  built-in method

4.4.39  attribute

4.4.40  own property

4.4.41  inherited property

4.5  Organization of This Specification

57

Table 78: 

ReadModifyWriteSharedMemory

 Event Fields

Field Name

Value

Meaning

[[Order]]

SeqCst

Read-modify-write events are always sequentially consistent.

[[NoTear]]

true

Read-modify-write events cannot tear.

[[Block]]

Shared Data Block

The block the event operates on.

[[ByteIndex]]

A non-negative 

integer

The byte address of the read-modify-write in [[Block]].

[[ElementSize]] A non-negative 

integer

The size of the read-modify-write.

[[Payload]]

List

The 

List

 of byte values to be passed to [[ModifyOp]].

[[ModifyOp]]

read-modify-write

modification function

An abstract closure that returns a modified 

List

 of byte values from a

read 

List

 of byte values and [[Payload]].

These events are introduced by 

abstract operations

 or by methods on the Atomics object.

Some operations may also introduce 

Synchronize

 events. A 

Synchronize event

 has no fields, and exists purely to directly

constrain the permitted orderings of other events.

In addition to 

Shared Data Block

 and Synchronize events, there are 

host

-specific events.

Let the range of a ReadSharedMemory, WriteSharedMemory, or ReadModifyWriteSharedMemory event be the Set of
contiguous integers from its [[ByteIndex]] to [[ByteIndex]] + [[ElementSize]] - 1. Two events' ranges are equal when
the events have the same [[Block]], and the ranges are element-wise equal. Two events' ranges are overlapping when
the events have the same [[Block]], the ranges are not equal and their intersection is non-empty. Two events' ranges
are disjoint when the events do not have the same [[Block]] or their ranges are neither equal nor overlapping.

NOTE 2

Events are ordered within candidate executions by the relations defined below.

An 

Agent Events Record

 is a 

Record

 with the following fields.

Examples of 

host

-specific synchronizing events that should be accounted for are: sending a

SharedArrayBuffer from one 

agent

 to another (e.g., by 

postMessage

postMessage

 in a browser), starting

and stopping agents, and communicating within the 

agent cluster

 via channels other than shared

memory. It is assumed those events are appended to 

agent-order

 during evaluation like the other

SharedArrayBuffer events.

29.2  Agent Events Records

801

 

 

 

 

 

 

 

Content      ..     7      8      9      10     ..