This patch turns on various optimization options by default. A later patch will allow us to control these flags with JitOptions.
Depends on D66104
Differential Revision: https://phabricator.services.mozilla.com/D66105
--HG--
extra : moz-landing-system : lando
std::stable_sort allocates a buffer internally for temporary scratch space, but SpiderMonkey doesn't want anybody to allocate memory without going through us. This patch appeases our static analysis.
Depends on D66103
Differential Revision: https://phabricator.services.mozilla.com/D66104
--HG--
extra : moz-landing-system : lando
FixedArray must store v8 Objects (aka JS::Values), but because it is allocated during parsing, it can't be a GC thing itself. The current implementation doesn't work. Writing a correct implementation is a little delicate. Fortunately, we only need it to support named captures, which are future work. For now, I am stubbing out the implementation of FixedArray to get rid of some GC hazards.
Depends on D66102
Differential Revision: https://phabricator.services.mozilla.com/D66103
--HG--
extra : moz-landing-system : lando
StdoutStream is used for debug output when trace-regexp-parser is enabled. The existing code doesn't actually print anything. V8's implementation goes to great lengths to make output work, even on Android. Instead of pulling in dozens of lines of code just to get some debug output working, this implementation just tapes a piece of paper to its chest with "std::cerr" written in crayon and pretends.
The snprintf changes are to satisfy a static analysis (SprintfLiteralChecker).
Differential Revision: https://phabricator.services.mozilla.com/D66102
--HG--
extra : moz-landing-system : lando
For obvious reasons, irregexp does not contain any calls to EnsureBallast. We therefore need to make our LifoAlloc allocation fallible so that it can allocate a new chunk if necessary.
Also, we want to use the current size of the LifoAlloc, not the peak size, to decide whether we've allocated too much memory. Nobody was using the old ComputedSizeOfExcludingThis, so I rewrote it to use the value we're already tracking.
Depends on D66100
Differential Revision: https://phabricator.services.mozilla.com/D66101
--HG--
extra : moz-landing-system : lando
When ICU is available, case-insensitive non-unicode matches (/i, not /iu) are performed using precomputed sets of characters that need special handling to follow the JS spec's weird rules. These sets live in special-case.cc. In V8, special-case.cc is generated at compile time with a special build step. This is overkill. Barring changes to gen-regexp-special-case.cc, special-case.cc will only change when we import a new version of ICU, and even then only if Unicode defines new case-folding shenanigans. This patch checks in a copy of special-case.cc. I'll open another bug to hook this process up to make_unicode.py.
PS: This version of special-case.cc is actually wrong due to a bug in V8. My patch to fix it upstream is under review; I'll fix it here in a later patch.
Depends on D66099
Differential Revision: https://phabricator.services.mozilla.com/D66100
--HG--
extra : moz-landing-system : lando
The actual definition of these methods depends on future changes to RegExpShared. For now, we just stub them out.
Depends on D66098
Differential Revision: https://phabricator.services.mozilla.com/D66099
--HG--
extra : moz-landing-system : lando
This patch fills in the ICU-less Unicode implementation by copying the relevant code from V8's implementation. There are a number of big tables here, but they are all only defined when we're not using ICU (aka only in local shell builds).
Depends on D65573
Differential Revision: https://phabricator.services.mozilla.com/D66098
--HG--
extra : moz-landing-system : lando
In V8, the Isolate (~JSContext) owns a Factory, which is responsible for allocating objects. The SM shim unifies Isolate and Factory into a single class.
This patch implements the Factory methods using the Handle infrastructure from previous patches.
Differential Revision: https://phabricator.services.mozilla.com/D65573
--HG--
extra : moz-landing-system : lando
A ByteArray is a fixed-length array of bytes. V8 uses ByteArrays to store bytecode for the irregexp interpreter, and to store lookup tables when compiling regexps. V8's ByteArrays are GC things (meaning that we have to be able to store them in a Value), but SM's version can't be a GC thing, because we have to be able to allocate a ByteArray while generating masm. We therefore end up with this approach, where a ByteArray is a PrivateValue pointing to a ByteArrayData (a length-prefixed buffer).
Differential Revision: https://phabricator.services.mozilla.com/D65572
--HG--
extra : moz-landing-system : lando
SM's roots are a linked list that lives on the stack. V8's stack roots are stored in a side table, which allows them to allocate handles that outlive the current stack frame. The lifetimes of those handles are instead determined by HandleScope objects. When a HandleScope goes out of scope, all "roots" created in that scope are freed simultaneously. This patch implements the V8 API inside SM.
Differential Revision: https://phabricator.services.mozilla.com/D65571
--HG--
extra : moz-landing-system : lando
MOZ_ASSERT(false) will evaluate to a no-op in release builds, so there should be no overhead from using MOZ_ASSERT(false) to define MOZ_ALWAYS_TRUE/FALSE/OK/ERR in both debug and release.
Differential Revision: https://phabricator.services.mozilla.com/D66797
--HG--
extra : moz-landing-system : lando
This allows us to asynchronously wait for a given `GeckoThread` state
to be reached.
Differential Revision: https://phabricator.services.mozilla.com/D66585
--HG--
extra : moz-landing-system : lando
This improves the implementation of IsCurrentlyCheckerboarding (which is not
invoked from anywhere prior to this patch) so that it takes into account the
recursive clipping applied by ancestor layers' composition bounds. In other
words, the visible rect for a layer may be additionally clipped because
ancestor scrollframes have scrolled, and this patch accounts for that.
It also records the currently-checkerboarding state into the APZTestData
at the time that the compositor APZTestData instance is fetched.
Differential Revision: https://phabricator.services.mozilla.com/D66427
--HG--
extra : moz-landing-system : lando
Slight functional changes:
- the checkerboard event call site will now include mTestAsyncScrollOffset
when calculating the visible rect, which should impact overall behaviour if
there's a test that cares about checkerboard events (there currently isn't).
- the IsCurrentlyCheckerboarding call site will use the compositing effective
scroll offset instead of the raw metrics scroll offset. This function is
not called from anywhere so it doesn't matter, but it makes sense to align
it with the other uses and I'll be using it in future patches.
Differential Revision: https://phabricator.services.mozilla.com/D66426
--HG--
extra : moz-landing-system : lando
If we can get the root frame's displayport, then we should use that
rect instead of the root composition bounds when clipping the scrollframe's
displayport. That way if APZ is disabled on the scrollframe, but the root
frame scrolls to bring a part of it into view, it will be fully painted and
not perma-checkerboard-y.
Note that this patch is the main fix, but leaves a bunch of comments/variables
with bad names; the next patch cleans that up.
Differential Revision: https://phabricator.services.mozilla.com/D66421
--HG--
extra : moz-landing-system : lando
`ICStub::extra_` is already initialised to zero through a class field initialiser expression.
Differential Revision: https://phabricator.services.mozilla.com/D66073
--HG--
extra : moz-landing-system : lando
The comment was added in bug 741271. Bug 1041688 changed the code to call
`maybeCreateThisForConstructor()`, but that call was eventually removed in
bug 1406957.
Differential Revision: https://phabricator.services.mozilla.com/D66069
--HG--
extra : moz-landing-system : lando