We currently keep all mark stacks allocated after GC, shrunk to their default size.
For parallel marking we can free the mark stacks of all markers apart from the
first. If we fail to allocate them at the start of marking we can fall back to
not marking in parallel.
This fixes the AWSY regression.
The patch also changes GCMarker::reset() to cover everything that happens in
GCMarker::stop() so you don't need to call both.
Differential Revision: https://phabricator.services.mozilla.com/D189342
This required significantly reworking how the harness handles ref.extern. We no
longer "canonicalize" externrefs created by the harness, since when checking for
an externref result we now extract the numeric value contained within.
Differential Revision: https://phabricator.services.mozilla.com/D188738
- Fix wasm module serialization order. Element segments sometimes need to refer to types during deserialization, but element segments were being deserialized before code objects (which contain types).
- Do function subtype checks on import, rather than requiring strict equality.
- Allow explicit null function references in table initializers.
- Initialize type defs and globals before tables when instantiating modules.
Differential Revision: https://phabricator.services.mozilla.com/D188737
This patch newly allows cases such as MonDDYYYY and Mon.DD.YYYY.
In adding tests for this patch, I noticed that the tests for parsing
periods were broken and could not fail the way that they were written,
so I fixed them.
This patch also fixes a couple of other standing bugs...
fixes Bug 485639 - for cases like "Aug 15 2015 10:00am"
fixes Bug 1760290 - for YYYY.MM.DD
Differential Revision: https://phabricator.services.mozilla.com/D186054
Performance results pending, but this shouldn't hurt utf-8 atomization
at all, and it should also make utf-16 atomization potentially cheaper.
So sending for review under the assumption that perf numbers will look
good.
Differential Revision: https://phabricator.services.mozilla.com/D189021
This occurrence was missed from the previous patch and so the GC param is named
'KB' even though the value is interpreted as MB.
This affects the shell and testing functions only.
Differential Revision: https://phabricator.services.mozilla.com/D189239
Performance results pending, but this shouldn't hurt utf-8 atomization
at all, and it should also make utf-16 atomization potentially cheaper.
So sending for review under the assumption that perf numbers will look
good.
Differential Revision: https://phabricator.services.mozilla.com/D189021
Tail calls are doing some stack data manipulations, and profiler (iterator) needs to know how to find where caller RA and FP stored. A platform now preserves temporary registers used to store FP/RA using collapse frame operations.
Differential Revision: https://phabricator.services.mozilla.com/D183269
This implementation allows for the old behavior, returning a plain
object, if these functions are given no argument, while providing the
new behavior, querying the build/realm configuration, if an argument is
given.
Differential Revision: https://phabricator.services.mozilla.com/D188788
Speedometer 3's Charts-chartjs calls this with an object with 10 properties,
so this avoids malloc overhead.
Depends on D188967
Differential Revision: https://phabricator.services.mozilla.com/D188968
We don't need to use the vector in this case because both objects
are plain objects with only data properties.
Depends on D188966
Differential Revision: https://phabricator.services.mozilla.com/D188967
We already had an optimization to reuse the shape when assigning to an empty object.
This often doesn't work because the number of fixed slots is different, but in
this case we can still reuse the property map.
Differential Revision: https://phabricator.services.mozilla.com/D188966
ConditionalExpr is the only case I can see where constant-folding can replace
the valid LHS of an OptionalDotExpr with another expression that isn't valid in
the AST. This can happen when the ConditionalExpr is parenthesized, and
maintaining the parentheses keeps the folded expression valid for
OptionalDotExpr.
One alternative to maintaining the parentheses is to check if folding results
in a disallowed expression (not a MemberExpression or CallExpression), and
restoring the unfolded expression if so. Wrapping in parentheses lets us keep
the folding optimization, so it seems better.
Differential Revision: https://phabricator.services.mozilla.com/D187222
While the limit when setting the pref is surprising, I think it makes more
sense to change this pref to use MB like most of the other GC prefs after which
the problem will not arise.
Differential Revision: https://phabricator.services.mozilla.com/D188715
This implementes the following requirement from the spec:
https://html.spec.whatwg.org/#fetch-a-single-module-script
12. In both cases, let processResponseConsumeBody given response response and null, failure, or a byte sequence bodyBytes be the following algorithm:
5. Let referrerPolicy be the result of parsing the `Referrer-Policy` header given response.
6. If referrerPolicy is not the empty string, set options's referrer policy to referrerPolicy.
Differential Revision: https://phabricator.services.mozilla.com/D186944
`putAsciiPrintable` was added temporarily as a substitute for externalizing the
logic done by `QuoteString`, while providing an interface which is as efficient.
Now, `EscapePrinter` is used to replace the content of `QuoteString` while
providing the same implementation, except that it is based on `put` instead of
`putAsciiPrintable`. The `EscapePrinter` already provides the guarantees that
are asserted by `putAsciiPrintable`, thus there is no longer any need for it.
As this patch set introduced `putAsciiPrintable`, there is not yet any external
consumer of it, and `EscapePrinter` should cover all use cases where non-ascii
inputs are provided.
Differential Revision: https://phabricator.services.mozilla.com/D183760
The previous patch reimplemented QuoteString to use a `StringSegmentRange`,
which should avoid mutating the inner parts of `JSRope`, while remaining fast on
`JSAtom`-s.
As the StringSegmentRange does not need to allocate with `ensureLinear`, then
all the failures are reported by the `put` functions using the `GenericPrinter`
mechanism, and the `release` functions of `Sprinter` would report the failure if
any.
Thus, there is no need for retuning a boolean value anymore from `QuoteString`
and `JSONQuoteString`, while this is still necessary to check the returned value
variant of `QuoteString` which returns `UniqueChars` by using the `release`
function of `Sprinter`.
Differential Revision: https://phabricator.services.mozilla.com/D183759
When reporting failure, we have to prevent continuation iterating over the
string segments, and stop early, as well as not ignoring the errors.
Differential Revision: https://phabricator.services.mozilla.com/D188248
`QuoteString` is today only available as a mean to serialize a `JSString` to a
`Sprinter`, or by making an extra temporary allocation whch is most likely
discarded once the serialized content has been used once.
This implementation provide a generic escaping mechanism, named `EscapePrinter`,
which can be used on top of any existing Printer class, and with any escaping
logic such as different quotes, or different quotation marks if needed. The
different quoting strategies are implemented using a class which provides
`isSafeChar` and `convertInto` to normalize the `JSString` input characters into
characters which are properly encoded for the Printer.
This change keep the original `QuoteString` behavior, while replacing its
fallible implementation by an infallible implementation. `QuoteString` had an
undocummented side-effect of linearizing the strings while reading them, which
causes memory allocation and potential GC failures. This change replaces the
`ensureLinear` call by the new `GenericPrinter::putString` function which relies
on `StringSegmentRange` to iterate over the string fragments and serialize the
content which does not have the same side-effects.
If performance issue arise from this modification, calls to `ensureLinear`
should be added before the `QuoteString` calls.
Differential Revision: https://phabricator.services.mozilla.com/D183758
`putString` requires a JSContext, and it is taken out of Sprinter, which does
not make much sense. Making it explicit that a JSContext is required to print
JSString would make things simpler for users instead of failing during the
execution.
Differential Revision: https://phabricator.services.mozilla.com/D187202
Sprinter::jsprintf is nowadays the same as GenericPrinter::printf which Sprinter
inherit from. This patch removes all calls to Sprinter::jsprintf and replaces
them by Sprinter::printf.
The advantage of using GenericPrinter::printf is that this reduce the dependency
on Sprinter-specific interface and moves us toward being able to move more
consumers over to the GenericPrinter.
Differential Revision: https://phabricator.services.mozilla.com/D181500
Now that Sprinter::put and Sprinter::jsprintf functions are infallible, there is
no need to return a boolean from Nursery::printProfileDurations and
Statistics::printProfileTimes functions.
Differential Revision: https://phabricator.services.mozilla.com/D181499
Remove the boolean returned value of printing functions of the GenericPrinter
and all descendant classes.
The goal being that error checking is the responsibility of the wrapping
function in charge of the GenericPrinter, and that functions in charge of
providing content should assume that everything is always written successfully.
This patch only look at the GenericPrinter methods, consumers of these functions
would be updated in subsequent patches.
Differential Revision: https://phabricator.services.mozilla.com/D181498
As we are going to remove the returned value, and to be extra cautious, we skip
future re-entry in case of previous failures.
Differential Revision: https://phabricator.services.mozilla.com/D181497
As functions are made infallible, only the 2 release functions are reporting
errors. The advantage of this approach is that the error reporting and checking
would only happen in the release functions calls in the future. This enables
the upcoming set of patches to change the return type of put functions to make
them infallible, reduce the number of visible branches in debugging code.
This makes the Sprinter class more like a "Sink allocator", where the smell of
allocation failures does not propagate immediatly through the sinking water until
all the water has been through.
Differential Revision: https://phabricator.services.mozilla.com/D181496
When using Sprinter::string, one assumes that out-of-memory errors have been
reported earlier. As the code is being converted to be infallible, the
out-of-memory is thus needed when the release function is called. This change
replaces all Sprinter::string by Sprinter::release and explicit the error
checking code path which would be relevant when the Sprinter::put function would
become infallible in follow-up patches.
Differential Revision: https://phabricator.services.mozilla.com/D181495
Sprinter::releaseJS centralize a mechanism which used in many places across the
JS engine, and replaces it with a single function call as well as democratising
the proper handling of UTF8 which might be added to Sprinter allocated strings.
Differential Revision: https://phabricator.services.mozilla.com/D181494
Sprinter already create strings, and the ExpressionDecompiler duplicates this
logic to copy the content of the Sprinter buffer. While there is a benefit in
case we over-allocated ahead using Sprinter, this should still reduce the peak
memory allocation.
Differential Revision: https://phabricator.services.mozilla.com/D181489