This is a normative change in the ECMA-402 spec. See:
02bd03a
This is observable just due to reading the properties one less time. It
would have been possible for e.g. the property values to change between
those invocations.
This is an editorial change in the ECMA-402 spec. See:
b6ed64b6e3b70d
This moves Intl.DateTimeFormat creation to InitializeDateTimeFormat and
renames that AO to CreateDateTimeFormat.
These passes have not been shown to actually optimize any JS, and tests
have become very flaky with optimizations enabled. Until some measurable
benefit is shown, remove the optimization passes to reduce overhead of
maintaining bytecode operations and to reduce CI churn. The framework
for optimizations will live on in git history, and can be restored once
proven useful.
Rather than splitting the Iterator type and its AOs into two files,
let's combine them into one file to match every other JS runtime object
that we have.
This is a normative change in the Set Methods proposal. See:
f3d5206
Note that this is normative due to an IsCallable check being deferred to
some time after its previous invocation in the GetKeysIterator.
This is an editorial change in the ECMA-262 spec. See:
784fc65
Note we were already doing this for a nicer error message. This is also
what lets GetIteratorFromMethod accept the method parameter as a nonnull
pointer.
This is an editorial change in the ECMA-262 spec. See:
ff60140
In doing so, as the new name implies, callsites are updated to pass in
an IteratorRecord themselves, rather than an iterable value.
This is an editorial change in the ECMA-262 spec. See:
956e5af
This splits the GetIterator AO into two AOs, to remove some recursion
and to (soon) remove optional parameters.
This is in preparation of implementing %IteratorHelperPrototype%.return.
That will invoke GeneratorResumeAbrupt, which will execute the generator
with an abrupt completion. At that time, we must take care to close the
current inner iterator.
This is required for %IteratorHelperPrototype%.return, which needs to
operate on the internal slots of the base GeneratorObject. Doing so also
provides us with the appropriate VM to be used in invocations to the
overridden IteratorHelper::execute.
In the Iterator Helpers proposal, we must create a generator object with
additional internal slots and behavior differences.
GeneratorObject is currently implemented assuming it wraps around an
ECMAScriptFunctionObject with generated bytecode. In this proposal, we
instead have "Abstract Closure" blocks. So this marks the `execute`
method as virtual, to allow the future subclass to essentially just
invoke those closures.
We will also require mutable access to the [[GeneratorState]] internal
slot.
This optional parameter is not currently set by any caller, but will be
for the Iterator Helpers proposal. In all specs, this parameter is a
static string, so we can just use a StringView rather than allocating a
(Deprecated)String on each invocation.
This also changes this optional parameter to be passed by const-ref, as
it does not need to be copied.
We were implicitly converting the throw completion's value into a normal
completion in `AsyncFunctionDriverWrapper::continue_async_execution`,
which meant the routine generated by `generate_await` didn't know that
the value had to be thrown when execution resumed.
Without this change, we mistakenly pass 13 tests for `Array.fromAsync`,
which we do not implement yet. But even with that "regression", we pass
17 more test262 tests in total.
When someone calls PrimitiveString::utf16_string() on a rope string,
we know for sure that the client wants a UTF-16 string and may not
be interested in a UTF-8 version at all.
To avoid round-tripping through UTF-8 in this scenario, callers can
now inform resolve_rope_if_needed() about their preferred encoding,
should rope resolution take place. The UTF-16 case is actually a lot
simpler than the UTF-8 case, since we can simply ask for UTF-16 data
for each fiber of the rope, and then concatenate all the fibers.
Since LibJS always uses UTF-16 for regular expression matching, this
avoids round-tripping through UTF-8 whenever the input to a regex test
is already UTF-16. :^)
This optimization was no longer helpful after the bug fix for missing
invalidation on global delete was introduced in 331f6a9e6, since we
now have to check bindings for presence in the global environment every
time anyway.
Since the bytecode VM now has fast GetGlobal in most cases, let's not
even worry about this and just remove the unhelpful "optimization".
In fact, removing this is actually an *optimization*, since we avoid
a redundant has_binding() check on every global variable access. :^)
This counter is incremented whenever a mutating operation occurs
within the environment's set of bindings.
It is going to be used by GetGlobal instruction to correctly invalidate
cache when global declarative environment is mutated.