new Map, new Set, new WeakMap and new WeakSet read their argument by
index (an array, a string or an object with a length), so a generator,
a Map, a Set or any other iterable was a TypeError, and an array whose
@@iterator was replaced was still read by index. They now read it
through GetIterator and close the iterator when adding an entry throws
(ECMAScript 2015, sections 23.1.1.1, 23.2.1.1, 23.3.1.1 and 23.4.1.1).
A Map or WeakMap entry that is not an object is a TypeError.
The typed array constructors and %TypedArray%.from read a source with
an @@iterator method through its iterator to the end before mapping
it, and any other source as an array-like object (sections 22.2.1.4
and 22.2.2.1).
Map.prototype[@@iterator] is entries, Set.prototype[@@iterator] is
values, %TypedArray%.prototype[@@iterator] is values, and the Map, Set
and array iterators inherit %IteratorPrototype%, so for-of and spread
walk them.
Changed behavior: an array-like object without @@iterator passed to
new Set or new Map is now a TypeError, and Uint8Array.from([1, 1], f)
with an f that changes the array maps the values read before f ran.
main added `Value::Symbol`, a binary_octal argument to `string_to_number` and its own
ES2015_BUILT_INS and ES2015_FEATURES in the test262 runner.
- A Map or Set key compares a Symbol by identity, as SameValueZero does.
- CanonicalNumericIndexString reads a typed array property name with the ES2015 ToNumber.
- The collection and binary-data test262 runner uses ES2015_COLLECTION_BUILT_INS and
ES2015_COLLECTION_FEATURES, writes its failures to `es2015-builtins-failures.txt` so it does
not overwrite the ES2015 subset's `es2015-failures.txt`, and runs each test through `run_one`.
%TypedArray%.prototype.toLocaleString invokes each element's method
(Invoke, section 7.3.18), so a getter for toLocaleString on
Number.prototype now gets the number as this, as the call already does.
Array.prototype.toLocaleString keeps the element's object for both.
%TypedArray%.from and of make their result with AllocateTypedArray in
the 6th edition (sections 22.2.2.1.1, 22.2.2.2 and 22.2.1.2.1), which
looks for a typed array constructor on the receiver's prototype chain
and throws a TypeError when it finds none. A function that returns a
typed array, or a bound typed array constructor, is refused again
instead of being called. Later editions call the receiver through
TypedArrayCreate.
- A collection that removes the holes of a Map or Set releases the room
its entries and index held, and a WeakMap or WeakSet whose table has
far more room than entries after pruning releases the extra room, so
the heap estimate covers what the tables still hold.
- %TypedArray%.from throws a TypeError for a receiver that is not a
constructor before it reads the source (section 22.2.2.1 step 2).
- %TypedArray%.from and of make their result with any constructor they
are called on (TypedArrayCreate, section 22.2.4.6): the result must be
a typed array with room for every element, or the call is a TypeError.
- %TypedArray%.prototype.toLocaleString calls each element's method on
the number itself (section 22.2.3.27); Array.prototype.toLocaleString
still calls it on the element's object.
- ArrayBuffer.prototype.slice and the typed array map, filter, slice and
subarray read the receiver's constructor where SpeciesConstructor does
(section 7.3.20): a getter's error propagates, and a value that is
neither undefined nor an object is a TypeError. filter reads it before
its callback runs.
- sort charges a unit of fuel for each element it reads and each it
writes back, before it starts.
- set between typed arrays on different buffers writes each element as
it reads it, without holding a copy of the source.
- The binary data module comment says a constructor reads a primitive
string as a length and from reads it by code point, and a prototype
test puts its value at the index it checks.
A realm with Options::es2015 now has Map, Set, WeakMap and WeakSet, and
ArrayBuffer, DataView and the nine typed arrays from Int8Array to
Float64Array with %TypedArray%.from, of and the prototype methods
(ECMA-262 6th edition, sections 22.2 to 24.2). A realm without the
option, the ExtendScript realm included, has none of these names.
- Map and Set compare keys with SameValueZero and keep insertion order.
forEach and iterators skip entries deleted before they reach them and
visit entries added during the walk; the collector removes holes and
moves live iterators.
- WeakMap and WeakSet hold their keys weakly. The collector marks a
WeakMap value only once its key is reachable another way and drops the
entries of unreachable keys, also when a value refers to its key.
- Typed arrays store elements little-endian; DataView is big-endian
unless littleEndian is true. Numeric property names are elements or
nothing, with the element descriptors of later editions. Copies to the
same element type keep every bit.
- An ArrayBuffer longer than 2^32 - 1 bytes or than the heap limit is a
RangeError before anything is allocated, and every element a method
visits takes fuel.
- Until the language has iterators, the collection constructors and
%TypedArray%.from read an array, a string by code point or an object
with a length, by index. A typed array constructor reads an array or
an object with a length the same way, and converts a first argument
that is not an object to a length.
- The %TypedArray%.prototype methods that share an Array method use the
element count, and an Array method called on a typed array reads its
length property. Array methods visit every element of a typed array
longer than 4,096.
- Check Script counts new of these constructors as the language's.
test262 runs the Map, Set, WeakMap, WeakSet, ArrayBuffer, DataView,
TypedArray and TypedArrayConstructors folders in ES2015 realms.
Docs: docs/mcp.md, docs/target-app-parity.md.