76193 Commits

Author SHA1 Message Date
Kannan Vijayan
ab80e24ca6 Bug 1592105 - Part 1 - Add a reference to CompilationInfo within TokenStream. r=mgaudet
Differential Revision: https://phabricator.services.mozilla.com/D70893
2020-04-16 19:23:56 +00:00
Tom Schuster
aafa33aa8e Bug 1629569 - Warp: Support IONFLAGS=logs. r=jandem
Depends on D70872

Differential Revision: https://phabricator.services.mozilla.com/D71065
2020-04-16 11:40:43 +00:00
Iain Ireland
70ddc40735 Bug 1630090: Implement PrepareAndExecuteRegexp for new engine r=jandem
The code in this patch lines up fairly closely with the old version of PrepareAndExecuteRegexp, but not so closely that I wanted to unify them, particularly since the old version will be going away. Aside from the changes to the layout of the input data, the main difference is that the return value is now being passed in a register instead of on the stack.

Differential Revision: https://phabricator.services.mozilla.com/D71081
2020-04-16 12:36:32 +00:00
Iain Ireland
2c3a12e2d9 Bug 1630090: Refactor PrepareAndExecuteRegexp r=jandem
PrepareAndExecuteRegexp has to be updated to call the new engine. In preparation, this patch factors out a couple of helper functions that a) can be shared between the two versions, and b) make sense as standalone functions in the future when we remove the old implementation.

Differential Revision: https://phabricator.services.mozilla.com/D71080
2020-04-16 11:49:27 +00:00
Andy Wingo
ebdcf1995b Bug 1628499 - Fix capture of call stack results in baseline compiler r=lth
The baseline compiler needs to adjust its virtual stack to match the
machine stack at control-flow joins, and also when preparing stack
result areas for calls.  In the latter case, there may be temporary
values on the stack, so the stack height before pushing stack results is
not the current block's stack height.  Similarly adjustments are needed
when pushing stack results after a call.

Differential Revision: https://phabricator.services.mozilla.com/D71017

--HG--
extra : moz-landing-system : lando
2020-04-16 12:53:22 +00:00
Lars T Hansen
5f2da00b55 Bug 1630359 - Create correct register dumps when SIMD disabled. r=bbouvier
On x86 and x64, the register dump has space for the full XMM FP
registers, but PushRegistersInMask will reduce the register set down
to quadword if JitSupportsSimd() is false.  Thus register dump areas
must be created by another mechanism than PushRegistersInMask when
!JitSupportsSimd().  The platform code did this in the case of
bailouts but got it wrong for invalidations; this patch fixes that for
both platforms.

We never found this bug because JitSupportsSimd() currently always
returns true on x86 and x64, as it only checks HasSSE2(), and that is
always true.

Additionally, make JitSupportsSimd() guard its return value on the
js::jit::SupportsSimd flag, which it probably should have been doing
all along (it does this on other platforms).  Since that flag is
always false, JitSupportsSimd() will now always return false, there
being no SIMD on x86 or x64 yet.

Differential Revision: https://phabricator.services.mozilla.com/D71149

--HG--
extra : moz-landing-system : lando
2020-04-16 13:11:18 +00:00
Jan de Mooij
644045f186 Bug 1624563 - Add hasJitInfo_ flag to WrappedFunction to avoid reading JSFunction flags off-thread. r=tcampbell
Some of the flags are mutable so reading this flag off-thread can cause TSan issues.

Differential Revision: https://phabricator.services.mozilla.com/D71172

--HG--
extra : moz-landing-system : lando
2020-04-16 13:01:46 +00:00
Matthew Gaudet
5a5d06f390 Bug 1627373 - Use SharedContext source extents instead of passing around line and columns r=tcampbell
Outside of powering BytecodeSection's source notes generation, the line and
column numbers were almost entirely unused, except to power a single assertion
that lineno and column agreed between the stencil (BCE derived) and script.

However, by switching to using the SharedContext extents, we lose the ability
to always assert they're the same, because in the old system dynamically
allocated functions used externally provided column info that disagrees with
the parser result. In this patch the script still gets the same column
number as before, but we can't assert that the value is the same as what you
could get out of the BCE, because the BCE number is actually more accurate
than the script.

Fixing the script column should be followup.

Differential Revision: https://phabricator.services.mozilla.com/D70411

--HG--
extra : moz-landing-system : lando
2020-04-16 12:38:04 +00:00
Matthew Gaudet
c5259a9142 Bug 1627373 - Give shared contexts an extent r=tcampbell
Differential Revision: https://phabricator.services.mozilla.com/D70410

--HG--
extra : moz-landing-system : lando
2020-04-16 12:37:59 +00:00
Benjamin Bouvier
8d4763ec4c Bug 1630205: Reuse data structures even more across Cranelift compilations; r=rhunt
Differential Revision: https://phabricator.services.mozilla.com/D71038

--HG--
extra : moz-landing-system : lando
2020-04-16 10:12:58 +00:00
Jon Coppeard
533b57acda Bug 1591276 - Track memory used by malloced buffers associated with nursery cells r=sfink
This tracks the total memory used by the nursery's malloced buffers set and trigers a minor GC if it passes some limit. The limit is somewhat arbirarily defined as eight times the nursery capactity - this only fires rarely in normal use but is enough to prevent runaway memory growth in this case.

Depends on D71041

Differential Revision: https://phabricator.services.mozilla.com/D71042

--HG--
extra : moz-landing-system : lando
2020-04-15 17:23:23 +00:00
Jon Coppeard
ca56cec302 Bug 1591276 - Refactor code to reallocate malloced buffers associated with nursery cells r=sfink
Differential Revision: https://phabricator.services.mozilla.com/D71041

--HG--
extra : moz-landing-system : lando
2020-04-15 17:27:14 +00:00
Brindusan Cristian
54aebde862 Backed out changeset 928ee6869299 (bug 1628279) for sm bustages at script-filename-validation-1.js. CLOSED TREE 2020-04-16 11:04:21 +03:00
Christian Holler
fdaac56227 Bug 1628279 - Initialize the JS shell module loader for each new global. r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D70891

--HG--
extra : moz-landing-system : lando
2020-04-15 08:22:53 +00:00
Jan de Mooij
72d50388f6 Bug 1629791 part 3 - Define CacheIR ops in a YAML file and use that to generate a header file. r=iain
For now this generates just CACHE_IR_OPS and CACHE_IR_SHARED_OPS in CacheIROpsGenerated.h
but the plan is to use this to generate parts of the IR writer and compiler/transpiler
interface. The spewer could also potentially be improved now that each operand has a name
and more precise type.

Generating the IR writer will likely happen incrementally so that will give us
another chance to double check the precise types match what's in the YAML file.

Differential Revision: https://phabricator.services.mozilla.com/D70995

--HG--
extra : moz-landing-system : lando
2020-04-16 05:21:38 +00:00
Jan de Mooij
aa4f4f7fe1 Bug 1629791 part 2 - Remove unnecessary condition operand from GuardSpecificInt32Immediate. r=iain
Depends on D70993

Differential Revision: https://phabricator.services.mozilla.com/D70994

--HG--
extra : moz-landing-system : lando
2020-04-15 14:06:22 +00:00
Jan de Mooij
c60dee00d5 Bug 1629791 part 1 - Rename MOpcodes.h to MOpcodesGenerated.h and LOpcodes to LOpcodesGenerated.h. r=iain
Most other generated SpiderMonkey files have the 'Generated' suffix so let's
follow that convention.

Differential Revision: https://phabricator.services.mozilla.com/D70993

--HG--
extra : moz-landing-system : lando
2020-04-15 14:06:21 +00:00
Ted Campbell
e2df076d45 Bug 1629721 - Remove FunctionEmitter::interpretedCommon. r=mgaudet
Move the TI heuristic into BCE::emitFunction where the other special mutation
of inner-functions is happening.

Differential Revision: https://phabricator.services.mozilla.com/D70781

--HG--
extra : moz-landing-system : lando
2020-04-15 22:07:39 +00:00
Ted Campbell
9636c3ba3e Bug 1629721 - Remove BytecodeEmitter::runOnceLambda helper. r=mgaudet
Instead rely on consistent definitions of the TreatAsRunOnce flag on the
SharedContext. Also simplify the BCE::check{RunOnce,Singleton}Context
accessors. Note that the TreatAsRunOnce flag indicates the script is expected
to run-once, but the BCE also checks for isInLoop to decide if current
bytecode location within the script should still be considered run-once.

Differential Revision: https://phabricator.services.mozilla.com/D70780

--HG--
extra : moz-landing-system : lando
2020-04-15 22:07:34 +00:00
Ted Campbell
b5951c4ebc Bug 1629721 - Unified runOnceLambda definition for lazy/non-lazy. r=mgaudet
Use the same conditions for qualifying an inner function as a run-once-lambda
between the lazy and non-lazy code paths. Use the FunctionBox::immutableFlags
so that this works well with delazification too.

Differential Revision: https://phabricator.services.mozilla.com/D70779

--HG--
extra : moz-landing-system : lando
2020-04-15 22:07:27 +00:00
Ted Campbell
38903f778e Bug 1629721 - Use the TreatAsRunOnce flag on SharedContext. r=mgaudet
In the BytecodeEmitter constructor, initialize the TreatAsRunOnce flag for
top-level SharedContexts. In the future we should initialize this even
earlier. For the delazification case, we initialize already directly
initialize this flag from the lazy BaseScript.

Differential Revision: https://phabricator.services.mozilla.com/D70778

--HG--
extra : moz-landing-system : lando
2020-04-15 22:07:25 +00:00
Iain Ireland
4b0968f728 Bug 1629670: Tier up to compiled regexps r=mgaudet
The interpreter calls `TierUpTick` whenever we interpret a regexp. Once we hit the tick threshold, compileIfNecessary will compile native code for the regexp.

Currently the tick threshold is hard-coded to 10. V8's tick threshold is 1, which seems unreasonably low. We can tune this later.

Differential Revision: https://phabricator.services.mozilla.com/D70952

--HG--
extra : moz-landing-system : lando
2020-04-15 20:08:21 +00:00
Iain Ireland
c467363eb7 Bug 1629670: Change ForceByteCode to CodeKind r=mgaudet
The current ForceByteCodeEnum is a glorified boolean. This patch replaces it with a three-value bytecode/jitcode/either enum, which will make our tiering-up logic slightly nicer in the next patch.

Differential Revision: https://phabricator.services.mozilla.com/D70951

--HG--
extra : moz-landing-system : lando
2020-04-15 20:54:38 +00:00
Iain Ireland
8dad7c3e77 Bug 1628835: Unify result enum r=tcampbell
Internally, irregexp uses -1 for errors, 0 for failure, and 1 for success. We have to use the same values in RegExpRunStatus.

Ideally we would replace RegExpRunStatus with an enum defined in RegExpTypes.h, but that will have to wait until we get rid of the old import.

Differential Revision: https://phabricator.services.mozilla.com/D70728

--HG--
extra : moz-landing-system : lando
2020-04-15 20:08:25 +00:00
Iain Ireland
454a5e1d1b Bug 1628835: Add interpreter support r=tcampbell
The irregexp compiler takes the AST produced by the parser, compiles it down to a more efficient internal representation, then uses a 'macroassembler' to generate code. The generated code can either be bytecode (which is then fed into the interpreter) or jitcode (which can be executed directly).

This patch gets the infrastructure set up and handles the former case.

CompilePattern is based heavily on V8's `RegExpImpl::compile` (affc364620/src/regexp/regexp.cc (L745-L933)). I am upstreaming a patch to move the code in WrapBody into regexp-compiler.cc where it fits better.

V8 is about to land a patch to tweak the API for Interpret so that it allocates memory for its registers internally instead of requiring it to be passed in. When we import this change, we'll be able to pass `matches->pairsRaw()` directly into `MatchForCallFromRuntime`, and the interpreter will fill it in for us.

In the old engine, we could handle interrupts in the middle of the interpreter. If we hit an urgent interrupt in compiled code, we would generate bytecode and fall back to the interpreter (see https://searchfox.org/mozilla-central/rev/9120151ddb35f2d4c37bfe613a54a4f10a9a3dc5/js/src/vm/RegExpObject.cpp#1165-1175). (This is what all the `ForceByteCode` machinery in RegExpObject.cpp is about. It was added in bug 1077514.) That won't work in the new version. V8 does allow interrupts during regexp execution, but only by jumping through some scary hoops to "manually relocate unhandlified references" afterwards. Instead, we just retry the regexp. I have no idea what a reasonable number of retries is before giving up; I've arbitrarily picked 4 for now.

Differential Revision: https://phabricator.services.mozilla.com/D70695

--HG--
extra : moz-landing-system : lando
2020-04-15 20:08:25 +00:00
Iain Ireland
5748dca264 Bug 1628835: Use RegExpShared in JSRegExp r=tcampbell
In preparation for actually compiling regexps in the next patch, hook up the V8 and irregexp representations of a compiled regexp.

Differential Revision: https://phabricator.services.mozilla.com/D70694

--HG--
extra : moz-landing-system : lando
2020-04-15 20:08:24 +00:00
Iain Ireland
54ca602cfd Bug 1628835: Change parenCount to pairCount r=tcampbell
A regexp with N sets of capturing parens will have N+1 capture groups, with the extra capture containing the entire matching string. Our old implementation stored `parenCount` in the RegExpShared and then added 1 to it whenever it was used. A much simpler answer is to just add 1 when initializing the regexp.

Differential Revision: https://phabricator.services.mozilla.com/D70693

--HG--
extra : moz-landing-system : lando
2020-04-15 20:08:24 +00:00
Csoregi Natalia
88ee7ff0b3 Backed out 6 changesets (bug 1628835, bug 1629670) for js crashes. CLOSED TREE
Backed out changeset e3c3f27d586a (bug 1629670)
Backed out changeset 6de75c45c46c (bug 1629670)
Backed out changeset 404ab88bafa3 (bug 1628835)
Backed out changeset d462c95e0945 (bug 1628835)
Backed out changeset 7392b332870d (bug 1628835)
Backed out changeset 1bc49605ad10 (bug 1628835)
2020-04-15 23:03:32 +03:00
Iain Ireland
144787849c Bug 1629670: Tier up to compiled regexps r=mgaudet
The interpreter calls `TierUpTick` whenever we interpret a regexp. Once we hit the tick threshold, compileIfNecessary will compile native code for the regexp.

Currently the tick threshold is hard-coded to 10. V8's tick threshold is 1, which seems unreasonably low. We can tune this later.

Differential Revision: https://phabricator.services.mozilla.com/D70952

--HG--
extra : moz-landing-system : lando
2020-04-15 19:25:24 +00:00
Iain Ireland
9a7a45e57a Bug 1629670: Change ForceByteCode to CodeKind r=mgaudet
The current ForceByteCodeEnum is a glorified boolean. This patch replaces it with a three-value bytecode/jitcode/either enum, which will make our tiering-up logic slightly nicer in the next patch.

Differential Revision: https://phabricator.services.mozilla.com/D70951

--HG--
extra : moz-landing-system : lando
2020-04-15 13:16:14 +00:00
Iain Ireland
b1bf2b2ca2 Bug 1628835: Unify result enum r=tcampbell
Internally, irregexp uses -1 for errors, 0 for failure, and 1 for success. We have to use the same values in RegExpRunStatus.

Ideally we would replace RegExpRunStatus with an enum defined in RegExpTypes.h, but that will have to wait until we get rid of the old import.

Differential Revision: https://phabricator.services.mozilla.com/D70728

--HG--
extra : moz-landing-system : lando
2020-04-15 16:13:24 +00:00
Iain Ireland
df8d0b02ba Bug 1628835: Add interpreter support r=tcampbell
The irregexp compiler takes the AST produced by the parser, compiles it down to a more efficient internal representation, then uses a 'macroassembler' to generate code. The generated code can either be bytecode (which is then fed into the interpreter) or jitcode (which can be executed directly).

This patch gets the infrastructure set up and handles the former case.

CompilePattern is based heavily on V8's `RegExpImpl::compile` (affc364620/src/regexp/regexp.cc (L745-L933)). I am upstreaming a patch to move the code in WrapBody into regexp-compiler.cc where it fits better.

V8 is about to land a patch to tweak the API for Interpret so that it allocates memory for its registers internally instead of requiring it to be passed in. When we import this change, we'll be able to pass `matches->pairsRaw()` directly into `MatchForCallFromRuntime`, and the interpreter will fill it in for us.

In the old engine, we could handle interrupts in the middle of the interpreter. If we hit an urgent interrupt in compiled code, we would generate bytecode and fall back to the interpreter (see https://searchfox.org/mozilla-central/rev/9120151ddb35f2d4c37bfe613a54a4f10a9a3dc5/js/src/vm/RegExpObject.cpp#1165-1175). (This is what all the `ForceByteCode` machinery in RegExpObject.cpp is about. It was added in bug 1077514.) That won't work in the new version. V8 does allow interrupts during regexp execution, but only by jumping through some scary hoops to "manually relocate unhandlified references" afterwards. Instead, we just retry the regexp. I have no idea what a reasonable number of retries is before giving up; I've arbitrarily picked 4 for now.

Differential Revision: https://phabricator.services.mozilla.com/D70695

--HG--
extra : moz-landing-system : lando
2020-04-15 16:13:06 +00:00
Iain Ireland
274247166d Bug 1628835: Use RegExpShared in JSRegExp r=tcampbell
In preparation for actually compiling regexps in the next patch, hook up the V8 and irregexp representations of a compiled regexp.

Differential Revision: https://phabricator.services.mozilla.com/D70694

--HG--
extra : moz-landing-system : lando
2020-04-15 16:12:33 +00:00
Iain Ireland
44e5878dff Bug 1628835: Change parenCount to pairCount r=tcampbell
A regexp with N sets of capturing parens will have N+1 capture groups, with the extra capture containing the entire matching string. Our old implementation stored `parenCount` in the RegExpShared and then added 1 to it whenever it was used. A much simpler answer is to just add 1 when initializing the regexp.

Differential Revision: https://phabricator.services.mozilla.com/D70693

--HG--
extra : moz-landing-system : lando
2020-04-13 16:13:00 +00:00
Tom Schuster
2a69bde525 Bug 1629867 - Add support for LoadStringChar. r=jandem
Differential Revision: https://phabricator.services.mozilla.com/D70872

--HG--
extra : moz-landing-system : lando
2020-04-15 15:36:22 +00:00
Tom Schuster
ca0431034a Bug 1629867 - Add spew for unsupported CacheIR opcodes. r=jandem
Differential Revision: https://phabricator.services.mozilla.com/D70859

--HG--
extra : moz-landing-system : lando
2020-04-15 15:36:11 +00:00
Tom Schuster
3361f99e22 Bug 1629867 - Add support for LoadDenseElement to WarpCacheIRTranspiler. r=jandem
Differential Revision: https://phabricator.services.mozilla.com/D70858

--HG--
extra : moz-landing-system : lando
2020-04-15 15:35:58 +00:00
Tom Schuster
7082ccd1b5 Bug 1629867 - Allow passing multiple inputs to buildCacheIR. r=jandem
Differential Revision: https://phabricator.services.mozilla.com/D70857

--HG--
extra : moz-landing-system : lando
2020-04-15 15:35:43 +00:00
André Bargull
0b6d9349df Bug 1629833 - Part 5: Move a variable comment to the variable declaration. r=yulia
It's probably more helpful to have the variable documentation near the
declaration. Also amends the description to cover normal name assignments.

Depends on D70863

Differential Revision: https://phabricator.services.mozilla.com/D70864

--HG--
extra : moz-landing-system : lando
2020-04-15 13:28:40 +00:00
André Bargull
648666d512 Bug 1629833 - Part 4: Remove unnecessary manual lifetime management of Maybe<> variables. r=yulia
`~Maybe()` will perform the clean-up anyway, so we don't really need to call
`reset()` manually here.

Depends on D70862

Differential Revision: https://phabricator.services.mozilla.com/D70863

--HG--
extra : moz-landing-system : lando
2020-04-15 08:33:46 +00:00
André Bargull
a0b93ccdbf Bug 1629833 - Part 3: Reduce code duplication for assignment operations. r=yulia
The comment about handling name assignments separately predates `NameOpEmitter`.
Using `NameOpEmitter` we don't have to worry choosing the correct bytecode
operations and when to emit `BindName`.

Depends on D70861

Differential Revision: https://phabricator.services.mozilla.com/D70862

--HG--
extra : moz-landing-system : lando
2020-04-15 08:33:25 +00:00
André Bargull
a4a6ee2c56 Bug 1629833 - Part 2: Pretty print compound assignment in disassembler. r=yulia
Depends on D70860

Differential Revision: https://phabricator.services.mozilla.com/D70861

--HG--
extra : moz-landing-system : lando
2020-04-15 08:32:19 +00:00
André Bargull
4aee86ee3d Bug 1629833 - Part 1: Add missing source-note for compound assignment. r=yulia
Differential Revision: https://phabricator.services.mozilla.com/D70860

--HG--
extra : moz-landing-system : lando
2020-04-15 08:32:11 +00:00
Andy Wingo
5ac664ca0b Bug 1629780 - Make users of ArgTypeVector::length explicitly include/exclude stack results arg r=lth
Differential Revision: https://phabricator.services.mozilla.com/D70806

--HG--
extra : moz-landing-system : lando
2020-04-15 12:01:11 +00:00
André Bargull
4e03b316ef Bug 1629106 - Part 2: Enable test262 tests for Logical Assignment Operators proposal. r=yulia
Depends on D70823

Differential Revision: https://phabricator.services.mozilla.com/D70824

--HG--
extra : moz-landing-system : lando
2020-04-15 09:16:09 +00:00
André Bargull
983a650c4b Bug 1629106 - Part 1: Implement Logical Assignment Operators proposal. r=yulia
Restricted to Nightly because there's still an open issue about inferred
function names and because the proposal was only recently moved to stage 3.

Depends on D70821

Differential Revision: https://phabricator.services.mozilla.com/D70823

--HG--
extra : moz-landing-system : lando
2020-04-15 09:15:22 +00:00
André Bargull
a637f58fb8 Bug 1629795 - Part 3: Ignore exceptions in IteratorClose for Throw completions. r=arai
Implements the changes from: https://github.com/tc39/ecma262/pull/1408

The spec PR requires to start the non-syntactic `try` block before retrieving
the "return" property and checking whether or not the "return" property is
callable. As part of this change we can also reorder the other byte code
instructions, which enables us to make the code more similar to normal JS code.
The equivalent JS code is documented in the added comments. Furthermore these
changes allow us to remove the manual stack depth fixups.

Depends on D70819

Differential Revision: https://phabricator.services.mozilla.com/D70820

--HG--
extra : moz-landing-system : lando
2020-04-15 09:54:43 +00:00
André Bargull
ebfbb8b7a3 Bug 1629795 - Part 2: Replace JSOp::Pick with JSOp::Swap if possible. r=arai
Updates the two callers to `JSOp::Pick` which can be optimised to `JSOp::Swap`.

Using `JSOp::Swap` saves one byte when compared to `JSOp::Pick`.

Depends on D70817

Differential Revision: https://phabricator.services.mozilla.com/D70819

--HG--
extra : moz-landing-system : lando
2020-04-14 14:40:36 +00:00
André Bargull
7aa55e8355 Bug 1629795 - Part 1: Omit "..." when disassembling zero-args call. r=arai
Omit the ellipsis characters when the call has zero arguments. This makes the
disassembly of iterator code a bit more readable, because we're now no longer
displaying additional "..." strings when the call has no arguments.

Depends on D70816

Differential Revision: https://phabricator.services.mozilla.com/D70817

--HG--
extra : moz-landing-system : lando
2020-04-14 14:40:36 +00:00
André Bargull
d6a7fbec08 Bug 1629794: Handle absent arguments in AsyncFromSyncIteratorPrototype. r=yulia
We're using a shared implementation for the "next", "return", and "throw"
methods, so we only need to adjust a single line of code.

Spec PR: https://github.com/tc39/ecma262/pull/1776

Depends on D70815

Differential Revision: https://phabricator.services.mozilla.com/D70816

--HG--
extra : moz-landing-system : lando
2020-04-14 14:40:35 +00:00