Commit Graph

81910 Commits

Author SHA1 Message Date
yk
fd8b90d571 Bug 1693482 - SIMD optimization x64/x86: inline constant load for PSHUFB in MacroAssembler::permuteInt8x16. r=lth
Differential Revision: https://phabricator.services.mozilla.com/D108798
2021-03-19 07:03:42 +00:00
Ryan Hunt
9c7df94be9 Bug 1698127 - wasm: Add parentheses around macro terms. r=lth
Differential Revision: https://phabricator.services.mozilla.com/D108215
2021-03-18 21:27:41 +00:00
Ryan Hunt
4089053008 Bug 1698127 - wasm: Explicitly examine result of memcmp(). r=lth
Differential Revision: https://phabricator.services.mozilla.com/D108214
2021-03-18 21:27:41 +00:00
Ryan Hunt
4b9fee2016 Bug 1698127 - wasm: Use std::forward and std::move when we can. r=lth
Differential Revision: https://phabricator.services.mozilla.com/D108213
2021-03-18 21:27:40 +00:00
Ryan Hunt
e17e341fc6 Bug 1698127 - wasm: Add default, noexcept specifiers to some constructors. r=lth
I don't know why clang static-analysis wants noexcept specifiers on
these TypeDef methods, but it's trivially true so I don't see an issue
with it.

Differential Revision: https://phabricator.services.mozilla.com/D108212
2021-03-18 21:27:40 +00:00
Ryan Hunt
49f1429420 Bug 1698127 - wasm: Add braces to single line if statements. r=lth
Differential Revision: https://phabricator.services.mozilla.com/D108211
2021-03-18 21:27:40 +00:00
Ryan Hunt
00637161f4 Bug 1698127 - wasm: Default initialize variables of Nothing. r=lth
clang static-analysis complains if you have a variable that is
not initialized at its definition, even if it's always initialized
before it's first use. I don't think it's worth trying to find
a way to appease this warning at this time.

This commit adds initializers to all instances of Nothing to
remove some of these warnings, as this is a trivial case to
fix.

Differential Revision: https://phabricator.services.mozilla.com/D108210
2021-03-18 21:27:39 +00:00
Ryan Hunt
696e732ebf Bug 1698127 - wasm: Apply const specifiers to functions when applicable. r=lth
Differential Revision: https://phabricator.services.mozilla.com/D108209
2021-03-18 21:27:39 +00:00
Ryan Hunt
457129eefd Bug 1698127 - wasm: Use auto* instead of auto in some places. r=lth
Differential Revision: https://phabricator.services.mozilla.com/D108208
2021-03-18 21:27:38 +00:00
Ryan Hunt
52b27f3399 Bug 1698127 - wasm: Transform if statements to returns when trivially possible. r=lth
Differential Revision: https://phabricator.services.mozilla.com/D108207
2021-03-18 21:27:38 +00:00
Ryan Hunt
09c8e409d1 Bug 1698127 - wasm: Make sure parameter declaration names match parameter definition names. r=lth
The autofix algorithm for this rule appears to use the definition parameter
name when there is a mismatch. This seems reasonable to me from glancing at
the results.

Differential Revision: https://phabricator.services.mozilla.com/D108206
2021-03-18 21:27:38 +00:00
Ryan Hunt
122cc2c23d Bug 1698127 - wasm: Use using instead of typedef. r=lth
Differential Revision: https://phabricator.services.mozilla.com/D108205
2021-03-18 21:27:37 +00:00
Ryan Hunt
4466a7b456 Bug 1698127 - wasm: Use range-based for loops. r=lth
clang static-analysis prefers to use range-based for loops whenever
it is possible. Some of the replacements are obvious improvements,
while others are a bit murky. Open to discussion on whether these
all make sense.

Differential Revision: https://phabricator.services.mozilla.com/D108204
2021-03-18 21:27:37 +00:00
Jon Coppeard
28916d6345 Bug 1699364 - Re-add special case pre-barrier for rope flattening r=sfink
It turns out that patch for bug 1698543 was too optimistic and we need the special case barrier for rope flattening for another reason: during flattening rope nodes are transformed before their ancestors.  Interior rope nodes are transformed to dependent strings with the base being the root node, and the root transformed into a linear string. Since the root is changed last the GC graph is not safe to traverse until flattening has finished.

This makes the test case pass.  I added this test case and the one for the previous bug.  I don't think we need to hide these since this change has only been on nightly so far.

If there are futher issues with this then I'm going to back out the barrier changes and think about an alteranative approach.

Differential Revision: https://phabricator.services.mozilla.com/D108979
2021-03-18 19:31:57 +00:00
Yury Delendik
da4c6fbb94 Bug 1697846 - Fix ARM64 simulator execution for FCVTN. r=nbp
Patch from 5319db71bd

Differential Revision: https://phabricator.services.mozilla.com/D108846
2021-03-18 18:11:39 +00:00
Yury Delendik
f005e50ce5 Bug 1693368 - Implement SIMD i64x2.abs instruction. r=lth
Differential Revision: https://phabricator.services.mozilla.com/D106671
2021-03-18 18:08:47 +00:00
Julian Seward
2f0ecea73d Bug 1699398 - Fix build failures resulting in "use of undeclared identifier 'forceWasmIon'" in obscure build configurations. r=lth.
Following the landing of wasm-via-Ion on arm64 (bug 1678097), some obscure
build configurations now break the build due to incorrect target-selection
ifdeffery.  This has been observed to happen for x86_64-linux when the
following are specified together (in a browser build):

  ac_add_options --enable-cranelift
  ac_add_options --enable-js-shell

In particular, `forceWasmIon` is declared in js.cpp and is guarded by
JS_CODEGEN_ARM64.  But there were later some uses of it guarded by
ENABLE_WASM_CRANELIFT.  In effect this incorrectly assumes that
JS_CODEGEN_ARM64 and ENABLE_WASM_CRANELIFT are both either defined or
undefined.  But that's not correct, (eg) for a build on x86_64-linux that is
configured `--enable-cranelift`.

This patch fixes that by guarding such use points *additionally* with
JS_CODEGEN_ARM64, so as to ensure the sets of configurations that read or
write `forceWasmIon` are a subset of the configurations that declare it.

Differential Revision: https://phabricator.services.mozilla.com/D108934
2021-03-18 16:19:11 +00:00
Julian Seward
e8721925cb Bug 1699379 - Disable asm.js (but not wasm) compilation via Ion on arm64, for the time being. r=lth.
Disable asm.js-via-Ion on arm64 until such time as that pathway, along with
the associated compiler-option logic, is better tested.  asm.js will still be
available on arm64, but will be forced along the JS pathway, with the
associated performance lossage.  See also bug 1697560.

Differential Revision: https://phabricator.services.mozilla.com/D108925
2021-03-18 12:11:58 +00:00
Lars T Hansen
99bcf77911 Bug 1699363 - Fix MIPS64 compilation. r=jandem DONTBUILD
Differential Revision: https://phabricator.services.mozilla.com/D108905
2021-03-18 07:23:38 +00:00
Yury Delendik
e0eec4f887 Bug 1691490 - Implement SIMD i64x2.{gt,lt,ge,le}_s instructions. r=lth
Differential Revision: https://phabricator.services.mozilla.com/D106915
2021-03-17 20:07:51 +00:00
Lars T Hansen
b29a54de34 Bug 1699213 - Check for SIMD wormhole availability the right way. r=rhunt
We are never supposed to check flags directly, we should always go via the 'Available' functions.
So also here: the flag test tests just the flag; the availability test allows the flag value
to be provided by a privileged-extension check.

Differential Revision: https://phabricator.services.mozilla.com/D108819
2021-03-17 19:23:11 +00:00
Simon Giesecke
b9621d6376 Bug 1695162 - Use range-based for instead of custom hashtable iterators. r=xpcom-reviewers,kmag
Differential Revision: https://phabricator.services.mozilla.com/D108585
2021-03-17 15:49:46 +00:00
Jon Coppeard
7dd6194dc0 Bug 1699085 - Don't define gExtraPoisoningEnabled in builds where JS_GC_ALLOW_EXTRA_POISONING is not defined r=sfink
Differential Revision: https://phabricator.services.mozilla.com/D108766
2021-03-17 14:39:48 +00:00
Alexandru Michis
ae6b1fe49b Merge mozilla-central to autoland a=merge on a CLOSED TREE 2021-03-17 12:08:04 +02:00
Alexandru Michis
b7b156e536 Merge autoland to mozilla-central. a=merge 2021-03-17 11:45:21 +02:00
Jon Coppeard
f684ec5a23 Bug 1698543 - Rework handling of interaction between incremental barriers and rope flattening r=sfink
Currently we have a special path for performing barriers during rope flattening to take account of the fact that this overwrites the cell header word of ropes temporarily, making these cells untraceable.

The problem is that a rope can already be in the barrier buffer before flattening starts and so we need to check for this when processing the buffer.

The patch reworks use of temporary GC data to set one of the cell header flags when in use. This means we can check for it when processing the barrier buffer. It removes the special case function for barriers, which makes it slightly less efficient as we will now buffer all these ropes before skipping them later on. Hopefully that is not too deterimental to performance.

Differential Revision: https://phabricator.services.mozilla.com/D108664
2021-03-17 09:01:16 +00:00
Lars T Hansen
53265a2d6f Bug 1698984 - Allow large-memory test to oom. r=jandem
This test can oom on some underprovisioned 64-bit platforms like those in our CI,
so allow that as an outcome.

Differential Revision: https://phabricator.services.mozilla.com/D108740
2021-03-17 07:40:17 +00:00
Mike Hommey
0ea5ad6742 Bug 1698706 - Always add PIC flags to C{,XX}FLAGS. r=firefox-build-system-reviewers,andi,sheehan,mhentges
The build always uses them anyways, but configure tests don't, and some
of them fail as a consequence in some cases (example: when UBsan is
enabled, all AC_LANG_CPLUSPLUS + AC_CHECK_FUNCS tests fail). We also had
similar problems in the past, such as bug 1513605.

By adding the PIC flags to CFLAGS and CXXFLAGS, we ensure old-configure
tests use the flags as well.

While here, we also remove DSO_CFLAGS, which was always empty, and we
stop passing -fPIC to wasm compiles, because it has no effect there.

Differential Revision: https://phabricator.services.mozilla.com/D108560
2021-03-17 02:27:22 +00:00
Csoregi Natalia
1fe0f680de Backed out changeset 86089c4629b5 (bug 1698706) for spidermonkey bustage. CLOSED TREE 2021-03-17 03:48:31 +02:00
Mike Hommey
473d31abfb Bug 1698706 - Always add PIC flags to C{,XX}FLAGS. r=firefox-build-system-reviewers,andi,sheehan,mhentges
The build always uses them anyways, but configure tests don't, and some
of them fail as a consequence in some cases (example: when UBsan is
enabled, all AC_LANG_CPLUSPLUS + AC_CHECK_FUNCS tests fail). We also had
similar problems in the past, such as bug 1513605.

By adding the PIC flags to CFLAGS and CXXFLAGS, we ensure old-configure
tests use the flags as well.

While here, we also remove DSO_CFLAGS, which was always empty, and we
stop passing -fPIC to wasm compiles, because it has no effect there.

Differential Revision: https://phabricator.services.mozilla.com/D108560
2021-03-17 01:27:39 +00:00
Yury Delendik
82dc6f238e Bug 1691489 - Implement SIMD i8x16.popcnt op. r=lth
Differential Revision: https://phabricator.services.mozilla.com/D104770
2021-03-16 20:24:22 +00:00
Jon Coppeard
d8f842d8c1 Bug 1697479 - Turn extra GC poisoning off by default in nightly builds r=sfink,perftest-reviewers,sparky
This changes the default so that extra GC poisoning is off in nightly opt builds unless enabled by an environment variable. This should give us more useful telemetry on nightly performance and make it easier for people trying to benchmark our browser. The poisoning is still enabled in debug builds.

The variable is renamed from JSGC_DISABLE_POISONING to JSGC_EXTRA_POISONING.

Differential Revision: https://phabricator.services.mozilla.com/D108419
2021-03-16 17:44:38 +00:00
Ryan Hunt
59b1f4f018 Bug 1692069 - wasm: Update typing of br_on_cast instruction. r=lth
The br_on_cast instruction is currently too strict and disallows the passing
along extra values. This commit adds validation for this, adds comments clarifying
the baseline implementation of the function, normalizes argument order for
WasmOpIter, and adds a test.

Differential Revision: https://phabricator.services.mozilla.com/D108505
2021-03-16 16:13:11 +00:00
Jason Orendorff
3567b6d14a Bug 1697223 - Part 5: Tests. r=mgaudet
Depends on D107694

Differential Revision: https://phabricator.services.mozilla.com/D107695
2021-03-16 16:12:07 +00:00
Jason Orendorff
85b56d8863 Bug 1697223 - Part 4: Let the frontend optimize away the var environment for strict eval. r=mgaudet
Depends on D107693

Differential Revision: https://phabricator.services.mozilla.com/D107694
2021-03-16 16:12:07 +00:00
Jason Orendorff
cfd1c2ac76 Bug 1697223 - Part 3: Allow var and function bindings in strict eval to be stored in stack locals. r=mgaudet,arai
Depends on D107692

Differential Revision: https://phabricator.services.mozilla.com/D107693
2021-03-16 16:12:06 +00:00
Jason Orendorff
d8311559d9 Bug 1697223 - Part 2: Statically bind more identifiers in strict direct eval. r=mgaudet
Toplevel `var` and `function` bindings in strict direct eval are now statically
bound. Direct eval code is also permitted to search enclosing scopes, the same
way lazy functions do. References to variables in enclosing scopes will now
typically use aliased ops.

The test change in class/super-in-nested-eval.js causes the test to continue
testing what it was testing before, despite the scoping changes in this and
subsequent patches.

Depends on D107691

Differential Revision: https://phabricator.services.mozilla.com/D107692
2021-03-16 16:12:06 +00:00
Jason Orendorff
947bf339c5 Bug 1697223 - Part 1: Tweak a comment on EvalKernel. r=mgaudet
Differential Revision: https://phabricator.services.mozilla.com/D107691
2021-03-16 16:12:05 +00:00
Jon Coppeard
1b2d6d65df Bug 1698077 - Display an error message when attempting to set the max nursery size to zero in the shell r=sfink
This does the simplest thing to avoid the assertion and educate the user.

Differential Revision: https://phabricator.services.mozilla.com/D108425
2021-03-16 12:32:12 +00:00
Lars T Hansen
f3ed586788 Bug 1678097 - Enable Ion for wasm on ARM64 (phase 1). r=lth.
In Phase 1, both Ion and Cranelift are available, and the default is switched
to Cranelift.  Use --wasm-force-ion or --wasm-compiler=ion at the shell to
select Ion, or make sure javascript.options.wasm_force_ion is true in
about:config.  Phase 1 is appropriate for fuzzing, after the patch set lands
in mozilla-central but before Ion is enabled by default.  The patch for Phase
1 will appear on bug 1678097 and will be very small, and MUST land with the
patch for Phase 0.

Differential Revision: https://phabricator.services.mozilla.com/D101867
2021-03-16 10:58:42 +00:00
Lars T Hansen
727d8e5fa1 Bug 1678097 - Deal with SP/PSP. r=iain,lth.
Every operation that updates the SP or PSP must be sure to maintain the
required SP-vs-PSP invariants.  Various addToStackPtr APIs did not do this.
Various other code needs tweaks.

This patch documents the existing invariants, and fills in some missing cases
for them.  The invariants are, in summary:

* PSP (x28) is the "primary" stack pointer value.  SP is "secondary".

* At all times, the invariant SP <= PSP is maintained.

* There are no memory accesses below SP, ever.

* All stack accesses are based off PSP, not SP.

* All function boundaries (calls and returns), SP == PSP.

In some places, where stack-manipulation code is not SP-vs-PSP agnostic,
it has been made clearer whether we are dealing with SP or PSP.

js/src/jit/arm64/Assembler-arm64.h has acquired a large block comment
which records the current invariants in more detail, plus results of
ongoing investigations.

Differential Revision: https://phabricator.services.mozilla.com/D97772
2021-03-16 10:58:42 +00:00
Lars T Hansen
95a66c120d Bug 1678097 - ARM64 code generation for Wasm (non-SIMD). r=nbp.
This enables Ion for ARM64 and adds all missing code generation code
for Wasm, except SIMD.

In one case we use a different strategy on ARM64 than on other
platforms, leading to the introduction of a lowerFor...() function
across all the platforms.  Otherwise this patch is restricted to
ARM64.

The code generated here may have optimization opportunities still;
that is by design.  This patch is only intended to be complete and
correct, not optimal.

Code here was generally adapted from the corresponding x64 and mips64
(sometimes x86-shared and mips-shared) code.

Differential Revision: https://phabricator.services.mozilla.com/D97478
2021-03-16 10:58:41 +00:00
Lars T Hansen
67d5845467 Bug 1678097 - Enable Ion for wasm on arm64 without SIMD (phase 0). r=lth.
In Phase 0, both Cranelift and Ion are available on arm64, and Ion is the
default.  Use --wasm-force-cranelift or --wasm-compiler=cranelift at the shell
to select Cranelift, or set javascript.options.wasm_force_ion to false in
about:config.  Phase 0 is appropriate for developers, before the patch set
lands in mozilla-central and before SIMD is present.

In Phase 1, both compilers are still available, but the default is switched to
Cranelift.  Use --wasm-force-ion or --wasm-compiler=ion at the shell to select
Ion, or make sure javascript.options.wasm_force_ion is true in about:config.
Phase 1 is appropriate for fuzzing, after the patch set lands in
mozilla-central but before Ion is enabled by default.  The patch for Phase 1
will appear on bug 1678097 and will be very small, and MUST land with the
patch for Phase 0.

In Phase 0 and Phase 1, --wasm-compiler=cranelift and --wasm-compiler=ion are
both accepted, and do the expected thing.

In Phase 2, Cranelift becomes disabled in moz.configure and all the changes in
the present patch are removed again.  The patch for Phase 2 will appear on bug
1686626 and will revert Phase 0 and Phase 1, and additionally update
moz.configure.

Differential Revision: https://phabricator.services.mozilla.com/D102420
2021-03-16 10:58:41 +00:00
Jan de Mooij
50d50fdf1c Bug 1697803 - Use DOM getter optimization for GetProp on WindowProxy too. r=evilpie
This is similar to what we do for GetName already.

Differential Revision: https://phabricator.services.mozilla.com/D108429
2021-03-16 08:21:52 +00:00
Lars T Hansen
caf0863b01 Bug 1676441 - Upgrade to BufferSize::get everywhere. r=rhunt
Use the value from BufferSize::get() without checking that it fits in
uint32_t in cases where this makes sense and is straightforward.  In
the cases where it still matters, perform additional checking or
rewrite code so that it doesn't matter.

Remove BufferSize::getWasmUint32(), it is now unused.  Indeed
BufferSize could be replaced by size_t now.

As a consequence of these changes, we relabel the memory operations so
that it is clear that they are for 32-bit memories, as they would
otherwise have to take 64-bit arguments and have more complicated
overflow checking on source and destination addresses.  So long as
only the memory size needs to be larger than 32 bits it's not
complicated.

Drive-by fix a bug where TableCopy used a failure value from MemCopy;
this has no impact on any code, it's just a typo.

Differential Revision: https://phabricator.services.mozilla.com/D98970
2021-03-16 06:48:25 +00:00
Lars T Hansen
7d83d7c31e Bug 1676441 - Allow up to 65534 pages + test cases. r=rhunt
The purpose here is to allow wasm memories to use up to 65534 pages of
memory on 64-bit systems, if the underlying ArrayBuffer /
SharedArrayBuffer supports it.  (The remaining two pages remain out of
bounds until we can make the bounds checking limit 64 bits wide, and
some other things.)

As the max value of the heap limit field is 65536, this should unlock
memories above 2GB for all users who do not insist on actually
allocating all 4GB.

The changes here are:

* Parameterize everything properly: Get rid of hardcoded UINT32_MAX
  and INT32_MAX and similar where that is possible.  Some remain;
  comments have been added.
* Add guards for asm.js to remain at heap limit INT32_MAX forever
* Add guard for grow() methods to enforce the limit separately from
  arraybuffer code
* Add test cases and test infrastructure
* Clean up some transitional things that are no longer required, now
  that the underlying arraybuffer code is stable

Some parameters are turned into function calls now, but may become
constants again later.

Differential Revision: https://phabricator.services.mozilla.com/D96602
2021-03-16 06:48:25 +00:00
Chris Peterson
0ceeb049da Bug 1571631 - Replace MOZ_MUST_USE with [[nodiscard]] in js/src. r=jandem
MOZ_MUST_USE was replaced with [[nodiscard]] in js/rc in bug 1684092, but some new uses of MOZ_MUST_USE instead of [[nodiscard]] have crept back in.

Depends on D108343

Differential Revision: https://phabricator.services.mozilla.com/D108344
2021-03-16 04:36:45 +00:00
Yury Delendik
24468dbb2a Bug 1691485 - Implement SIMD pairwise adds. r=lth
Differential Revision: https://phabricator.services.mozilla.com/D104743
2021-03-15 22:45:34 +00:00
Ted Campbell
31cb93d51e Bug 1697904 - Migrate the JIT spectre mitigation prefs to StaticPrefs. r=jandem
To simplify this code, turns these prefs into unlisted prefs on MIPS
platforms since the JIT support is missing there. The JitOptions will
continue to default them to false on MIPS.

Differential Revision: https://phabricator.services.mozilla.com/D108107
2021-03-15 22:20:44 +00:00
Ted Campbell
002f610266 Bug 1697904 - Migrate more JIT prefs to StaticPrefs. r=jandem
Also relax the type on large_arraybuffers to plain bool since it is only read
once on startup.

Differential Revision: https://phabricator.services.mozilla.com/D108106
2021-03-15 22:20:43 +00:00