Граф коммитов

87774 Коммитов

Автор SHA1 Сообщение Дата
André Bargull 6bf861ae0e Bug 1797724 - Part 6: Correctly use AsyncFromSyncIterator to unwrap Promise values. r=mgaudet
`asyncFromSyncIteratorObject[ASYNC_FROM_SYNC_ITERATOR_OBJECT_ITERATOR_SLOT]` is
the iterator passed to `CreateAsyncFromSyncIterator()`, but we actually need to
use `asyncFromSyncIteratorObject` for the `iteratorRecord` to correctly unwrap
Promise values. (Same applies for the `next` method.)

Depends on D160479

Differential Revision: https://phabricator.services.mozilla.com/D160480
2022-10-31 09:38:42 +00:00
André Bargull bc9d9090e4 Bug 1797724 - Part 5: Use consistent error messages when iterator method returns a non-object. r=mgaudet
This ensures `Array.fromAsync` uses the same error message as `Array.from` and
normal iteration (`for-of` and `for-await-of`).

This let's us also remove the `GetIterator` self-hosted function.

Also renamed `asyncIterator` to `iterator`, because the returned iterator isn't
an async iterator.

Depends on D160478

Differential Revision: https://phabricator.services.mozilla.com/D160479
2022-10-31 09:38:41 +00:00
André Bargull 1c1c8e1864 Bug 1797724 - Part 4: Use correct error message when 'Symbol.asyncIterator' returns a non-object. r=mgaudet
Noticed this when adding a test for the next part.

Depends on D160477

Differential Revision: https://phabricator.services.mozilla.com/D160478
2022-10-31 09:38:41 +00:00
André Bargull 52dc545aba Bug 1797724 - Part 3: Avoid unnecessary rooting in intrinsic_CreateAsyncFromSyncIterator. r=mgaudet
Part 8 will actually remove the entire method.

Depends on D160476

Differential Revision: https://phabricator.services.mozilla.com/D160477
2022-10-31 09:38:41 +00:00
André Bargull c2c3bc3641 Bug 1797724 - Part 2: Use an 'else' statement to avoid an unnecessary comparison. r=mgaudet
Later patches will rearrange this code again.

Depends on D160475

Differential Revision: https://phabricator.services.mozilla.com/D160476
2022-10-31 09:38:40 +00:00
André Bargull 90196ed9be Bug 1797724 - Part 1: Delete leading whitespace before preprocessor definitions. r=mgaudet
Reverts the whitespace change from the original `Array.fromAsync` patch.

Differential Revision: https://phabricator.services.mozilla.com/D160475
2022-10-31 09:38:40 +00:00
Stanca Serban f9b090a9af Backed out 11 changesets (bug 1797750) for causing spidermonkey failures on WrappedFunctionObject.cpp. CLOSED TREE
Backed out changeset 6d7bcd4a08bb (bug 1797750)
Backed out changeset c93b57fe1b66 (bug 1797750)
Backed out changeset 4e551959f63a (bug 1797750)
Backed out changeset 55b2f301b941 (bug 1797750)
Backed out changeset 8787060a075a (bug 1797750)
Backed out changeset 9c02299f0d56 (bug 1797750)
Backed out changeset 544c58f111c2 (bug 1797750)
Backed out changeset 947432f9bd0d (bug 1797750)
Backed out changeset bec9fda2f8ce (bug 1797750)
Backed out changeset 3a6e1feb1ebc (bug 1797750)
Backed out changeset 4e673df3058a (bug 1797750)
2022-10-31 11:35:31 +02:00
André Bargull ea743ca4a2 Bug 1797750 - Part 11: Use UnwrapAndTypeCheckValue to correctly unwrap non-CCW wrappers. r=mgaudet
`ValidateShadowRealmObject` didn't correctly handle non-CCW wrappers and was
missing error reporting when `CheckedUnwrapDynamic()` returned `nullptr`. Switch
to `UnwrapAndTypeCheckValue` to fix both issues.

Depends on D160513

Differential Revision: https://phabricator.services.mozilla.com/D160514
2022-10-31 08:52:36 +00:00
André Bargull 96c40cfccc Bug 1797750 - Part 10: Correct compartment/realm handling in WrappedFunctionCreate. r=mgaudet
Move the `AutoRealm` in `WrappedFunctionCreate` into a separate block to ensure
we're back in the original realm when we call `CopyNameAndLength`. Without this
change an error thrown `CopyNameAndLength` can escape the wrong realm to resp.
from the ShadowRealm.

Also add some `cx->check()` calls to ensure arguments are in the correct compartment
in `GetWrappedValue` and `WrappedFunctionCreate`. And add `cx->compartment()->wrap()`
in some places which we're using the wrong compartment.

Differential Revision: https://phabricator.services.mozilla.com/D160513
2022-10-31 08:52:36 +00:00
André Bargull 3da134eca6 Bug 1797750 - Part 9: Implement OrdinaryWrappedFunctionCall. r=mgaudet
This implements the changes from <https://github.com/tc39/proposal-shadowrealm/pull/356>.

Depends on D160511

Differential Revision: https://phabricator.services.mozilla.com/D160512
2022-10-31 08:52:35 +00:00
André Bargull 72dfdcfa66 Bug 1797750 - Part 8: Don't attempt to use the current name property for the toString output. r=mgaudet
The previous code assumed that the "name" property is always a string, but
user-code can redefine it to any value, which could easily lead to an exploit.

Furthermore the spec requires that the computed string matches the `NativeFunction`
production, so even if we only append the "name" when it's a string value, we'd
first have to parse the string as an identifier to determine if the string has to
be escaped or not. This is non-trivial, so instead follow the `toString` output
of bound functions and return an unnamed function source code string.

Depends on D160510

Differential Revision: https://phabricator.services.mozilla.com/D160511
2022-10-31 08:52:35 +00:00
André Bargull 70e598d49f Bug 1797750 - Part 7: Use NewBuiltinClassInstance instead of explicitly passing the prototype. r=mgaudet
`NewBuiltinClassInstance` automatically selects the correct prototype.

Depends on D160509

Differential Revision: https://phabricator.services.mozilla.com/D160510
2022-10-31 08:52:35 +00:00
André Bargull 28c89b7deb Bug 1797750 - Part 6: Use an array to store extra handler values. r=mgaudet
This matches how we handle this case for Promise handlers and it's much
faster.

Depends on D160508

Differential Revision: https://phabricator.services.mozilla.com/D160509
2022-10-31 08:52:34 +00:00
André Bargull d8ef6513e8 Bug 1797750 - Part 5: Fix a typo. r=mgaudet
Depends on D160507

Differential Revision: https://phabricator.services.mozilla.com/D160508
2022-10-31 08:52:34 +00:00
André Bargull e8746fac9b Bug 1797750 - Part 4: Clean-up CopyNameAndLength. r=mgaudet
Avoid to call the resolve hook for the "name" property and avoid unnecessary
atomisation of the "name" string: `IdToFunctionName` returns its input when
no function prefix is passed and the input is a JSAtom. And `JS_StringToId` only
atomises the input string. Both operations are unnecessary here.

Also avoid single letter, upper case variable names for consistency with the
rest of the SpiderMonkey code base.

Depends on D160506

Differential Revision: https://phabricator.services.mozilla.com/D160507
2022-10-31 08:52:33 +00:00
André Bargull 3139e748ae Bug 1797750 - Part 3: Prefer internal API instead of the public JS API. r=mgaudet
Prefer the internal API for consistency with the rest of SpiderMonkey. This
also avoids some extra overhead, for example we don't have to store the call
arguments first in `RootedVector<Valu>` and then copy them into `InvokeArgs`.

Directly using `InvokeArgs` also fixes some cross-compartment assertions in the
current code, because it skips the compartment checks from `JS::Call` when it
directly calls `js::Call`. Part 10 will fix this code to use the correct
compartment for all values.

Depends on D160505

Differential Revision: https://phabricator.services.mozilla.com/D160506
2022-10-31 08:52:33 +00:00
André Bargull 373fc70fa9 Bug 1797750 - Part 2: Remove unnecessary rooting. r=mgaudet
- `CallArgs::operator[]` returns a rooted value, so it's not necessary to
  re-root it.
- It's not necessary to root a value when it's stored in `CallArgs::rval()`.

Depends on D160504

Differential Revision: https://phabricator.services.mozilla.com/D160505
2022-10-31 08:52:33 +00:00
André Bargull b463636d27 Bug 1797750 - Part 1: Add trailing comma for nicer clang-format output. r=mgaudet
Clang-format writes each entry on a separate line when a trailing comma is
present. This produces nicer output in some cases.

Differential Revision: https://phabricator.services.mozilla.com/D160504
2022-10-31 08:52:32 +00:00
André Bargull 7621911562 Bug 1765357 - Part 5: Remove top_level_await preference. r=mgaudet
Depends on D160615

Differential Revision: https://phabricator.services.mozilla.com/D160616
2022-10-31 07:08:47 +00:00
André Bargull a4d3ba1baa Bug 1765357 - Part 4: Remove ergonomic_brand_checks preference. r=mgaudet
Depends on D160614

Differential Revision: https://phabricator.services.mozilla.com/D160615
2022-10-31 07:08:47 +00:00
Daniel Holbert 3c368026cb Bug 1798068 part 2: Expand JS::MutableHandleIdVector to more verbose typename in nsIXPCScriptable.idl, to satisfy static-analysis rule. r=xpcom-reviewers,mccr8
This patch doesn't change behavior; it's just expanding an abbreviated typename.

Without this patch, my local static-analysis build fails with the following
error for mozStorageStatementJSHelper.h (which has a class that implements
nsIXPCScriptable and is outside of SpiderMonkey):

"error: The fully qualified types are preferred over the shorthand typedefs for
JS::Handle/JS::Rooted types outside SpiderMonkey."

The error message points to the NS_DECL_NSIXPCSCRIPTABLE macro, and
specifically to a usage of this typename inside of that macro.  This patch's
type-expansion seems to appease this static analysis rule.

Before this patch, the type here was `JS::MutableHandleIdVector` which is a
typedef for `MutableHandle<StackGCVector<JS::PropertyKey>>` as defined here:
https://searchfox.org/mozilla-central/rev/fe5c9c39a879b07d5b629257f63d825c3c8cd0ed/js/public/TypeDecls.h#98

After this patch, the type here is `JS::MutableHandleVector<JS::PropertyKey>`
(which I took from the static analysis error message's suggestion). That
expands to the same full-qualified type, since `MutableHandleVector<T>` is an
alias for `MutableHandle<StackGCVector<T>>` as defined here:
https://searchfox.org/mozilla-central/rev/fe5c9c39a879b07d5b629257f63d825c3c8cd0ed/js/public/TypeDecls.h#128

Differential Revision: https://phabricator.services.mozilla.com/D160690
2022-10-28 23:11:46 +00:00
Daniel Holbert 9475dbb311 Bug 1798068 part 1: Fix indentation on some mis-indented lines of nsIXPCScriptable.idl. r=xpcom-reviewers,mccr8
This is a non-functional change (just whitespace cleanup).

Differential Revision: https://phabricator.services.mozilla.com/D160689
2022-10-28 23:11:46 +00:00
Daniel Holbert 16170f25a6 Bug 1797840: Replace stray tab characters with spaces in IDL files throughout the tree. r=mccr8,necko-reviewers,credential-management-reviewers,smaug,sgalich,valentin
DONTBUILD because this is just whitespace cleanup.

I found the files to fix up here using this command:
    grep -r '   ' * 2>/dev/null | grep -v "other-licenses" | grep "idl:"

I replaced the tab characters with however many spaces seemed consistent with
the indentation in the surrounding code (and did some minor space-indentation
cleanup in contextual lines to preserve alignment, in a few cases).

Differential Revision: https://phabricator.services.mozilla.com/D160577
2022-10-28 18:08:17 +00:00
Jon Coppeard f2bdf17ff2 Bug 1797755 - Part 5: Use a single initial mark stack size regardless of whether incremental GC is enabled r=sfink
Currently we initialize the mark stack to a different size depending on whether
or not incremental GC is enable. However, after the first GC we always shrink
it to the initial size when it is disabled.

This bug shows that there's no point having separate sizes so this patch
removes the option and uses a single size regardless.

Differential Revision: https://phabricator.services.mozilla.com/D160528
2022-10-28 15:17:43 +00:00
Jon Coppeard c9b0e72b33 Bug 1797755 - Part 4: Remove option to set maximum mark stack capacity in release builds r=sfink
Currently we have a GC parameter that allows setting a maximum mark stack
capacity. This is only ever used by test code, not in the browser. This
requires extra unnecessary work in release builds if we move to a different
stack representation as we won't be able to fold the comparison into the
current capacity check as we do now.

The patch makes this feature condtional on JS_GC_ZEAL.

Depends on D160526

Differential Revision: https://phabricator.services.mozilla.com/D160527
2022-10-28 15:17:43 +00:00
Jon Coppeard 92a8039ec6 Bug 1797755 - Part 3: Remove the unused MarkStackIter class r=sfink
Differential Revision: https://phabricator.services.mozilla.com/D160526
2022-10-28 15:17:43 +00:00
Jon Coppeard 57d45df89c Bug 1797755 - Part 2: Make delayed marking colors work like normal marking r=sfink
Currently the way mark colors work for delayed marking doesn't align with
normal marking for gray marking of GC things that can only be marked black
(e.g. strings).

Normal marking keeps these on the gray mark stack, but when it comes to mark
them they are marked black. Currently OOM during marking pushes arenas
containing such GC things onto the delayed black marking list. This means that
gray marking can cause delayed black marking. This is surprising and an
unnecessarily additional complication.

The patch makes this work the same as normal marking. OOM during gray marking
always pushes arenas onto the gray marking list; arenas on the gray marking
list are marked black if they are a GC thing kind that cannot be marked gray.

Depends on D160524

Differential Revision: https://phabricator.services.mozilla.com/D160525
2022-10-28 15:17:42 +00:00
Jon Coppeard 5477f78be5 Bug 1797755 - Part 1: Move testing mark queue to GCRuntime r=sfink
Parallel marking will use one GCMarker per thread. The testing mark queue is
really a per-runtime data structure, so this patch moves it to the GCRuntime.

Differential Revision: https://phabricator.services.mozilla.com/D160524
2022-10-28 15:17:42 +00:00
Iulian Moraru 15e9bd170d Backed out 5 changesets (bug 1797755) for causing bp-hybrid bustages on Marking.cpp.
Backed out changeset 7cda151d97a5 (bug 1797755)
Backed out changeset 098569654f17 (bug 1797755)
Backed out changeset 6e5a935e576a (bug 1797755)
Backed out changeset eb109d0ce408 (bug 1797755)
Backed out changeset 186a012563fc (bug 1797755)
2022-10-28 17:37:22 +03:00
Jon Coppeard db152653ff Bug 1797755 - Part 5: Use a single initial mark stack size regardless of whether incremental GC is enabled r=sfink
Currently we initialize the mark stack to a different size depending on whether
or not incremental GC is enable. However, after the first GC we always shrink
it to the initial size when it is disabled.

This bug shows that there's no point having separate sizes so this patch
removes the option and uses a single size regardless.

Differential Revision: https://phabricator.services.mozilla.com/D160528
2022-10-28 09:47:15 +00:00
Jon Coppeard 99f39c9c1b Bug 1797755 - Part 4: Remove option to set maximum mark stack capacity in release builds r=sfink
Currently we have a GC parameter that allows setting a maximum mark stack
capacity. This is only ever used by test code, not in the browser. This
requires extra unnecessary work in release builds if we move to a different
stack representation as we won't be able to fold the comparison into the
current capacity check as we do now.

The patch makes this feature condtional on JS_GC_ZEAL.

Depends on D160526

Differential Revision: https://phabricator.services.mozilla.com/D160527
2022-10-28 09:47:14 +00:00
Jon Coppeard aa62f6fe8e Bug 1797755 - Part 3: Remove the unused MarkStackIter class r=sfink
Depends on D160525

Differential Revision: https://phabricator.services.mozilla.com/D160526
2022-10-28 09:47:14 +00:00
Jon Coppeard 8175b08540 Bug 1797755 - Part 2: Make delayed marking colors work like normal marking r=sfink
Currently the way mark colors work for delayed marking doesn't align with
normal marking for gray marking of GC things that can only be marked black
(e.g. strings).

Normal marking keeps these on the gray mark stack, but when it comes to mark
them they are marked black. Currently OOM during marking pushes arenas
containing such GC things onto the delayed black marking list. This means that
gray marking can cause delayed black marking. This is surprising and an
unnecessarily additional complication.

The patch makes this work the same as normal marking. OOM during gray marking
always pushes arenas onto the gray marking list; arenas on the gray marking
list are marked black if they are a GC thing kind that cannot be marked gray.

Depends on D160524

Differential Revision: https://phabricator.services.mozilla.com/D160525
2022-10-28 09:47:14 +00:00
Jon Coppeard 81364b5f1e Bug 1797755 - Part 1: Move testing mark queue to GCRuntime r=sfink
Parallel marking will use one GCMarker per thread. The testing mark queue is
really a per-runtime data structure, so this patch moves it to the GCRuntime.

Differential Revision: https://phabricator.services.mozilla.com/D160524
2022-10-28 09:47:13 +00:00
Jan de Mooij c74e9ba876 Bug 1797701 - Remove unused JitRealm::stubCodes_ map. r=iain
All of these stubs were converted to CacheIR stubs, so we no longer need this.

Differential Revision: https://phabricator.services.mozilla.com/D160468
2022-10-28 08:52:17 +00:00
Henri Sivonen 1737aa6569 Bug 1630920 - Remove the gb2312han and big5han collations. r=anba
Makes the ICU data 191 KB smaller.

Differential Revision: https://phabricator.services.mozilla.com/D160337
2022-10-28 08:44:04 +00:00
Henri Sivonen 0b6dc7aed6 Bug 1793749 - Build ICU with the implicithan collation root. r=anba
Makes ICU data 353 KB smaller.

Differential Revision: https://phabricator.services.mozilla.com/D160345
2022-10-28 08:43:58 +00:00
Cristian Tuns 16e757373f Backed out 5 changesets (bug 1797755) for causing spidermonkey bustages CLOSED TREE
Backed out changeset 27d9b7db5e1c (bug 1797755)
Backed out changeset f207beed6252 (bug 1797755)
Backed out changeset 4746d15d7a9f (bug 1797755)
Backed out changeset 8be86d9e2f18 (bug 1797755)
Backed out changeset 9a3821fa6bb8 (bug 1797755)
2022-10-27 14:57:28 -04:00
Jon Coppeard e2b79fe043 Bug 1797755 - Part 5: Use a single initial mark stack size regardless of whether incremental GC is enabled r=sfink
Currently we initialize the mark stack to a different size depending on whether
or not incremental GC is enable. However, after the first GC we always shrink
it to the initial size when it is disabled.

This bug shows that there's no point having separate sizes so this patch
removes the option and uses a single size regardless.

Depends on D160527

Differential Revision: https://phabricator.services.mozilla.com/D160528
2022-10-27 18:23:03 +00:00
Jon Coppeard 60ce070cab Bug 1797755 - Part 4: Remove option to set maximum mark stack capacity in release builds r=sfink
Currently we have a GC parameter that allows setting a maximum mark stack
capacity. This is only ever used by test code, not in the browser. This
requires extra unnecessary work in release builds if we move to a different
stack representation as we won't be able to fold the comparison into the
current capacity check as we do now.

The patch makes this feature condtional on JS_GC_ZEAL.

Depends on D160526

Differential Revision: https://phabricator.services.mozilla.com/D160527
2022-10-27 18:23:03 +00:00
Jon Coppeard b3b5137df6 Bug 1797755 - Part 3: Remove the unused MarkStackIter class r=sfink
Depends on D160525

Differential Revision: https://phabricator.services.mozilla.com/D160526
2022-10-27 18:23:03 +00:00
Jon Coppeard 9f58602f9e Bug 1797755 - Part 2: Make delayed marking colors work like normal marking r=sfink
Currently the way mark colors work for delayed marking doesn't align with
normal marking for gray marking of GC things that can only be marked black
(e.g. strings).

Normal marking keeps these on the gray mark stack, but when it comes to mark
them they are marked black. Currently OOM during marking pushes arenas
containing such GC things onto the delayed black marking list. This means that
gray marking can cause delayed black marking. This is surprising and an
unnecessarily additional complication.

The patch makes this work the same as normal marking. OOM during gray marking
always pushes arenas onto the gray marking list; arenas on the gray marking
list are marked black if they are a GC thing kind that cannot be marked gray.

Depends on D160524

Differential Revision: https://phabricator.services.mozilla.com/D160525
2022-10-27 18:23:02 +00:00
Jon Coppeard 0438b21625 Bug 1797755 - Part 1: Move testing mark queue to GCRuntime r=sfink
Parallel marking will use one GCMarker per thread. The testing mark queue is
really a per-runtime data structure, so this patch moves it to the GCRuntime.

Differential Revision: https://phabricator.services.mozilla.com/D160524
2022-10-27 18:23:02 +00:00
Csoregi Natalia df1fd00af6 Backed out changeset d3d587531672 (bug 1794784) for causing spidermonkey bustages on BaselineCacheIRCompiler.cpp. CLOSED TREE 2022-10-27 19:33:10 +03:00
Christian Holler 0ccfd247ed Bug 1794784 - Add code for differential testing with Fuzzilli. r=jandem
Differential Revision: https://phabricator.services.mozilla.com/D159151
2022-10-27 16:19:46 +00:00
Jan de Mooij 6482e64181 Bug 1797255 - Return an empty array from Debugger.findObjects with --fuzzing-safe. r=decoder
Differential Revision: https://phabricator.services.mozilla.com/D160465
2022-10-27 11:46:52 +00:00
André Bargull b9446c85e2 Bug 1797248: Update time zone data to tzdata2022e. r=platform-i18n-reviewers,dminor
Differential Revision: https://phabricator.services.mozilla.com/D160173
2022-10-27 11:32:17 +00:00
Stanca Serban 09251682b1 Backed out changeset 5bb3611c95d7 (bug 1797248) for causing time zones failures. CLOSED TREE 2022-10-27 13:00:39 +03:00
André Bargull 2b52b24839 Bug 1797248: Update time zone data to tzdata2022e. r=platform-i18n-reviewers,dminor
Differential Revision: https://phabricator.services.mozilla.com/D160173
2022-10-27 09:11:48 +00:00
Doug Thayer f5e9af5d08 Bug 1794439 - Inline HasNativeDataPropertyPure cache lookup in Ion r=jandem
I saw something like a 5% improvement to the Elm, React, and React-Redux
subtests of speedometer with this, with maybe a 1% overall Speedometer
improvement, although the confidence is lower.

Differential Revision: https://phabricator.services.mozilla.com/D158983
2022-10-26 22:57:23 +00:00
Matthew Gaudet de0e01d414 Bug 1726039 - Eliminate security errors from exotic objects which disallow private fields r=jandem
Depends on D122780

Differential Revision: https://phabricator.services.mozilla.com/D158265
2022-10-26 21:53:36 +00:00
Matthew Gaudet 47be3bc251 Bug 1726039 - Disallow setting private fields on MaybeCrossOrigin objects (HostEnsureCanPrivateElementAdd) r=peterv,jandem
Differential Revision: https://phabricator.services.mozilla.com/D122780
2022-10-26 21:53:36 +00:00
Iain Ireland d262cab6ed Bug 1792228: Don't use LoadObject for cross-compartment objects r=jandem
Differential Revision: https://phabricator.services.mozilla.com/D160315
2022-10-26 20:40:03 +00:00
Iain Ireland e8e72a84cc Bug 1792228: Use LoadObject instead of LoadProto for proto shape guards r=jandem
We noticed this while looking at the CacheIR generated for an add-slot stub.

The depth threshold of 4 was picked by browsing around on the web and dumping the observed depth. 4 is enough to cover 95%+ of the cases I saw.

There are a couple of other places where we use LoadProto: the no-teleporting case in `GeneratePrototypeGuards`, and `ShapeGuardPrototypeChainForCrossCompartmentHolder`. They didn't show up in my experiments, so I left them alone for now.

Differential Revision: https://phabricator.services.mozilla.com/D158037
2022-10-26 20:40:03 +00:00
Ryan Hunt 70509cb3c2 Bug 1790626 - wasm: Use pointer to TypeDef instead of type index in PackedType. r=yury
This commit switches the representation of PackedType (and therefore ValType/FieldType)
to use a *TypeDef instead of type index.

There are several changes here:
  1. PackedTypeCode is always 64-bits now to pack the pointer. This penalizes 32-bit
     platforms, but we likely don't care about them enough to try to optimize this.
  2. RefType::TypeIndex is RefType::TypeRef
  3. RefType::typeIndex() is RefType::typeDef()
  4. TypeContext now stores a map from *TypeDef to original type index for printing errors
  5. Decoding a RefType now stores a *TypeDef instead of type index
  6. We now just transfer the SharedTypeContext from ModuleEnvironment to Metadata instead
     of copying definitions. This is needed for sharing the indexOf map.
  7. We now manually serialize/deserialize TypeContext
  8. TypeContext now stores SharedTypeDef in vector instead of TypeDef, this is needed so
     that *TypeDef is not invalidated across resizing the vector (asm.js does this)
  9. The initialization of TypeContext is refactored to keep the indexOf map in-sync
     with adding new types (asm.js needs this)
  10. We now manually serialize/deserialize PackedTypeCode using a new SerializedTypeCode
  11. Serialization now needs a TypeContext in order to get the index of type definitions
  12. Deserialization now constructs a TypeContext, and uses that when deserializing
      ValType/RefType/FieldType

Differential Revision: https://phabricator.services.mozilla.com/D157387
2022-10-26 14:48:08 +00:00
Ryan Hunt cfc3265f69 Bug 1790626 - wasm: Manually serialize/deserialize PackedType to prepare for it not being POD. r=yury
PackedType will store a pointer to *TypeDef in a later commit, making it
non-cacheable POD. We therefore need to specially handle it in serialization.
This commit starts preparing for that.

Differential Revision: https://phabricator.services.mozilla.com/D157386
2022-10-26 14:48:08 +00:00
Ryan Hunt e25c26d20a Bug 1790626 - wasm: Move 'immediate' type representation to FuncType and only use with call_indirect. r=yury
TypeIdDesc describes how to load the 'type id' for any type. Right now the
'type id' is an immediate integer for small function types, a *FuncType for
larger function types, and *RttValue for everything else.

The immediate integer case is an optimization for signature checks in
call_indirect. We can simplify our code by adding an 'immediateType_'
field to `FuncType` which stores an alternate representation of the
function type (if any) that can be used with call_indirect. Then
`TypeIdDesc`/`TypeDefWithId` are not needed during instantiation
anymore and we can just pass `TypeDefVector` from compilation to
runtime.

As a drive-by fix, some code for setting up the global data are of
Instance was simplified to allocate whole contiguous areas, instead
of looping, in some cases.

Some uses of TypeIdDesc still remain after this commit, but they are
only in codegen for figuring out how to emit signature checks. The
class is renamed and simplified to CallIndirectId to represent this.

Differential Revision: https://phabricator.services.mozilla.com/D157385
2022-10-26 14:48:07 +00:00
Ryan Hunt 5915126639 Bug 1790626 - wasm: Remove redundant isValid() checks on PackedType. r=yury
PackedType calls isValid() frequently before calling some accessor on
PackedTypeCode which then also calls isValid(). PT and PTC have slightly
different isValid() methods, with the only difference that PT will ensure
that the typeCode is valid for ValType or FieldType, and that PTC will
ensure that the typeCode has been initialized.

Because we check PT.isValid() when constructing a PT, any check that
PTC has been initialized should be equivalent to PT.isValid().

Differential Revision: https://phabricator.services.mozilla.com/D157384
2022-10-26 14:48:07 +00:00
Jon Coppeard eb83c140a5 Bug 1796901 - Clear realm incremental marking state at the start of GC rather than at the end r=jandem
GC can be aborted in several states and zones GCRuntime::finishCollection
doesn't always get called. It's easier to clear this state in a signle place at
the start.

Differential Revision: https://phabricator.services.mozilla.com/D160056
2022-10-26 11:09:39 +00:00
Mark Banner 9613c19f16 Bug 1795880 - Add an ESLint rule to enforce using static imports where possible. r=arai,geckoview-reviewers,m_kato
Differential Revision: https://phabricator.services.mozilla.com/D160131
2022-10-26 09:37:46 +00:00
Mark Banner 7f3cba09e8 Bug 1795322 - Update toolkit modules references in remaining places. r=mossop,zeid,geckoview-reviewers,calu
Differential Revision: https://phabricator.services.mozilla.com/D160036
2022-10-26 08:06:37 +00:00
Mike Hommey 402fce07b9 Bug 1796518 - Tweak lld flags for faster linkage on developer builds. r=firefox-build-system-reviewers,nalexander
Differential Revision: https://phabricator.services.mozilla.com/D159832
2022-10-25 22:58:25 +00:00
Matthew Gaudet 91dbb39588 Bug 1797331 - Add Array.fromAsync to fuzz-flags.txt r=bthrall
Differential Revision: https://phabricator.services.mozilla.com/D160281
2022-10-25 21:54:19 +00:00
Csoregi Natalia 5f9da7b301 Backed out 12 changesets (bug 1795322) for causing multiple failures e.g. test_deletion_request_ping.py. CLOSED TREE
Backed out changeset aba25cbcda51 (bug 1795322)
Backed out changeset a4a35005ada9 (bug 1795322)
Backed out changeset 8e8d790eb0f4 (bug 1795322)
Backed out changeset db8903454bd3 (bug 1795322)
Backed out changeset 60cc71c61cad (bug 1795322)
Backed out changeset bc6a674994ad (bug 1795322)
Backed out changeset 6ac8a611f8c7 (bug 1795322)
Backed out changeset 9fb873ecfb31 (bug 1795322)
Backed out changeset c8a7a40c2a2f (bug 1795322)
Backed out changeset f2c118b6c6ce (bug 1795322)
Backed out changeset 38df43b4a70f (bug 1795322)
Backed out changeset 89aea8373411 (bug 1795322)
2022-10-25 23:47:58 +03:00
Mark Banner fc7befc08d Bug 1795322 - Update toolkit modules references in remaining places. r=mossop,zeid,geckoview-reviewers,calu
Differential Revision: https://phabricator.services.mozilla.com/D160036
2022-10-25 19:49:28 +00:00
Tooru Fujisawa 8f7d859eb1 Bug 1795873 - Part 1: Add profiler marker for ChromeUtils.importESModule static import. r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D159920
2022-10-25 07:02:37 +00:00
Matthew Gaudet 1b10d789e4 Bug 1795452 - Add shell option to enable/disable Array.fromAsync r=arai
Differential Revision: https://phabricator.services.mozilla.com/D159643
2022-10-24 19:19:01 +00:00
Matthew Gaudet e31033054b Bug 1795452 - Initial implementation of Array.fromAsync r=arai
Differential Revision: https://phabricator.services.mozilla.com/D159642
2022-10-24 19:19:01 +00:00
Matthew Gaudet 586d2d08f6 Bug 1795452 - Add the three-argument GetIterator function. r=arai
Differential Revision: https://phabricator.services.mozilla.com/D159641
2022-10-24 19:19:00 +00:00
Matthew Gaudet 063f9e7ec7 Bug 1795452 - Expose CreateAsyncFromSyncIter to self-hosted code r=arai
Differential Revision: https://phabricator.services.mozilla.com/D159640
2022-10-24 19:19:00 +00:00
Robert Longson a546daf2d8 Bug 1795568 Part 1 - Remove plugin support code r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D159465
2022-10-24 18:56:41 +00:00
Tom Ritter 0ddf58f544 Bug 1792627: Add an updatebot job for irregexp r=iain
Depends on D158289

Differential Revision: https://phabricator.services.mozilla.com/D158290
2022-10-24 16:50:05 +00:00
Tom Ritter 6c0ad1d35d Bug 1792627: Use mach vendor-based updating for irregexp r=iain
Differential Revision: https://phabricator.services.mozilla.com/D158289
2022-10-24 16:50:05 +00:00
Matthew Gaudet 4852cc8cc4 Bug 1795914 - Remove JS Streams implementation r=jandem
Differential Revision: https://phabricator.services.mozilla.com/D159610
2022-10-24 16:05:58 +00:00
André Bargull f19c2477c9 Bug 1176235: Remove tests where both successors are effectively empty blocks. r=jandem
The existing optimisation didn't always work, for example when dead resume point
operands were added, represented by MConstant(JS_OPTIMIZED_OUT). Change the
optimisation to allow uses, as long as all uses are within the current block.
Because we also check that all instructions within the block are dead-if-unused,
all uses must also be dead-if-unused.

Differential Revision: https://phabricator.services.mozilla.com/D158403
2022-10-24 14:55:22 +00:00
André Bargull faf2f949d9 Bug 1141255: Prevent debugger from modifying unaliased const bindings. r=jandem
Differential Revision: https://phabricator.services.mozilla.com/D158402
2022-10-24 14:53:29 +00:00
Marian-Vasile Laza bfba58d8e6 Backed out 3 changesets (bug 1795873, bug 1796539) as req by the dev (arai). CLOSED TREE
Backed out changeset de1917baf71d (bug 1796539)
Backed out changeset 8326cc71c2dd (bug 1795873)
Backed out changeset 292542f833fe (bug 1795873)
2022-10-24 16:05:20 +03:00
Tooru Fujisawa be76847d32 Bug 1795873 - Part 1: Add profiler marker for ChromeUtils.importESModule static import. r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D159920
2022-10-24 12:22:30 +00:00
Jon Coppeard be12f96292 Bug 1796081 - Part 2: Only check the key color once when populating the ephemeron table r=sfink
Currently the table population is done separately from marking the entry which
means we check the key color twice, potentially getting different results if
another thread is marking at the same time. This could result in us not adding
ephemeron table entries when necessary.

The patch consolidates these two paths.

Depends on D159677

Differential Revision: https://phabricator.services.mozilla.com/D159678
2022-10-20 08:10:29 +00:00
Jon Coppeard 808b59fc16 Bug 1796081 - Part 1: Don't trace weak map values that are in the nursery r=sfink
We don't need to trace weakmap values that are in the nursery because these
will be kept alive in minor GC by the store buffer entry pushed by HeapPtr.

Differential Revision: https://phabricator.services.mozilla.com/D159677
2022-10-20 08:10:28 +00:00
Julian Seward 2b32ec36db Bug 1795848 - IRGenerator::stubName_: don't allocate these on the C++ heap. r=iain.
Profiling of tcampbell's React benchmark [1] using DHAT shows that
about 20000 of a total of 195000 C++ heap allocated blocks are
clones of C string literals, created by JS_smprintf.  This patch
removes those allocations entirely.  This problem was alluded to
some time back in [2].

[1] https://github.com/mozilla-spidermonkey/matrix-react-bench

[2] https://phabricator.services.mozilla.com/D148035#inline-815309

Differential Revision: https://phabricator.services.mozilla.com/D159586
2022-10-19 13:34:34 +00:00
Jon Coppeard 26dad90e64 Bug 1795845 - Check whether cyclic module fields are present before accessing them in GC r=arai
The allocation metadata builder hook means that we can GC during allocation and
observe this object in a partially initialized state.

Differential Revision: https://phabricator.services.mozilla.com/D159673
2022-10-19 12:01:23 +00:00
Jan de Mooij 6853e71921 Bug 1645358 - Handle DeadObjectProxy in js::CopyErrorObject. r=evilpie
Differential Revision: https://phabricator.services.mozilla.com/D159590
2022-10-19 09:03:53 +00:00
Jon Coppeard 1455b0c715 Bug 1795642 - Remove the buffering barrier tracer r=sfink
This removes the barrier tracer and marks GC things immediately when barriers
fire. This restores the original behaviour before the separate barrier tracer
was added.

Differential Revision: https://phabricator.services.mozilla.com/D159492
2022-10-19 08:37:56 +00:00
Jon Coppeard c903db84e5 Bug 1795634 - Remove unused WeakMap::markKeys method r=sfink
Differential Revision: https://phabricator.services.mozilla.com/D159487
2022-10-19 08:37:18 +00:00
Sandor Molnar 2395049305 Backed out 4 changesets (bug 1790626) for causing spider-monkey failures in js/src/wasm/WasmTypeDef.h CLOSED TREE
Backed out changeset 81ed136e034e (bug 1790626)
Backed out changeset 955d80c9d75c (bug 1790626)
Backed out changeset cc0a57db46c0 (bug 1790626)
Backed out changeset 91bfaab095a5 (bug 1790626)
2022-10-19 02:07:40 +03:00
Ryan Hunt f4d3b34fd1 Bug 1790626 - wasm: Use pointer to TypeDef instead of type index in PackedType. r=yury
This commit switches the representation of PackedType (and therefore ValType/FieldType)
to use a *TypeDef instead of type index.

There are several changes here:
  1. PackedTypeCode is always 64-bits now to pack the pointer. This penalizes 32-bit
     platforms, but we likely don't care about them enough to try to optimize this.
  2. RefType::TypeIndex is RefType::TypeRef
  3. RefType::typeIndex() is RefType::typeDef()
  4. TypeContext now stores a map from *TypeDef to original type index for printing errors
  5. Decoding a RefType now stores a *TypeDef instead of type index
  6. We now just transfer the SharedTypeContext from ModuleEnvironment to Metadata instead
     of copying definitions. This is needed for sharing the indexOf map.
  7. We now manually serialize/deserialize TypeContext
  8. TypeContext now stores SharedTypeDef in vector instead of TypeDef, this is needed so
     that *TypeDef is not invalidated across resizing the vector (asm.js does this)
  9. The initialization of TypeContext is refactored to keep the indexOf map in-sync
     with adding new types (asm.js needs this)
  10. We now manually serialize/deserialize PackedTypeCode using a new SerializedTypeCode
  11. Serialization now needs a TypeContext in order to get the index of type definitions
  12. Deserialization now constructs a TypeContext, and uses that when deserializing
      ValType/RefType/FieldType

Differential Revision: https://phabricator.services.mozilla.com/D157387
2022-10-18 22:28:13 +00:00
Ryan Hunt 17d79988c0 Bug 1790626 - wasm: Manually serialize/deserialize PackedType to prepare for it not being POD. r=yury
PackedType will store a pointer to *TypeDef in a later commit, making it
non-cacheable POD. We therefore need to specially handle it in serialization.
This commit starts preparing for that.

Differential Revision: https://phabricator.services.mozilla.com/D157386
2022-10-18 22:28:13 +00:00
Ryan Hunt 99578d6774 Bug 1790626 - wasm: Move 'immediate' type representation to FuncType and only use with call_indirect. r=yury
TypeIdDesc describes how to load the 'type id' for any type. Right now the
'type id' is an immediate integer for small function types, a *FuncType for
larger function types, and *RttValue for everything else.

The immediate integer case is an optimization for signature checks in
call_indirect. We can simplify our code by adding an 'immediateType_'
field to `FuncType` which stores an alternate representation of the
function type (if any) that can be used with call_indirect. Then
`TypeIdDesc`/`TypeDefWithId` are not needed during instantiation
anymore and we can just pass `TypeDefVector` from compilation to
runtime.

As a drive-by fix, some code for setting up the global data are of
Instance was simplified to allocate whole contiguous areas, instead
of looping, in some cases.

Some uses of TypeIdDesc still remain after this commit, but they are
only in codegen for figuring out how to emit signature checks. The
class is renamed and simplified to CallIndirectId to represent this.

Differential Revision: https://phabricator.services.mozilla.com/D157385
2022-10-18 22:28:12 +00:00
Ryan Hunt 7e4f84b28b Bug 1790626 - wasm: Remove redundant isValid() checks on PackedType. r=yury
PackedType calls isValid() frequently before calling some accessor on
PackedTypeCode which then also calls isValid(). PT and PTC have slightly
different isValid() methods, with the only difference that PT will ensure
that the typeCode is valid for ValType or FieldType, and that PTC will
ensure that the typeCode has been initialized.

Because we check PT.isValid() when constructing a PT, any check that
PTC has been initialized should be equivalent to PT.isValid().

Differential Revision: https://phabricator.services.mozilla.com/D157384
2022-10-18 22:28:12 +00:00
Mike Hommey 8f4d47c529 Bug 1795207 - Move the remainder of warning flags setup in old-configure to python. r=firefox-build-system-reviewers,andi
While we're here, make the setup more consistent across host/target
c/c++, and remove the C compiler warning flags from the C linker flags,
where they are irrelevant.

Differential Revision: https://phabricator.services.mozilla.com/D159358
2022-10-18 19:46:44 +00:00
Steve Fink 8fe85b6e62 Bug 1782462 - Realloc strings based on #bytes wasted, not #bytes used. r=jandem
Differential Revision: https://phabricator.services.mozilla.com/D159448
2022-10-18 19:25:15 +00:00
Andrew Halberstadt 6a19102333 Bug 1795063 - Stop disabling ASLR in spidermonkey builds from automation, r=sfink
Differential Revision: https://phabricator.services.mozilla.com/D159517
2022-10-18 17:58:18 +00:00
Mark Banner 2ffde1e92f Bug 1792341 - Migrate more toolkit/modules consumers to use direct ES module import. r=Gijs,webdriver-reviewers,perftest-reviewers,necko-reviewers,geckoview-reviewers,preferences-reviewers,application-update-reviewers,pip-reviewers,credential-management-reviewers,sgalich,owlish,bytesized,AlexandruIonescu,whimboo,mconley,mixedpuppy
Mainly automated changes. Some manual ESLint fixes and whitespace cleanup.

Differential Revision: https://phabricator.services.mozilla.com/D158452
2022-10-18 11:21:26 +00:00
Jan de Mooij 253c86b5e0 Bug 1782495 - Replace watchtower testing callback with a log-based mechanism. r=iain
The ability to run arbitrary JS can cause various problems. This replaces the callback
with a different mechanism to avoid this.

Differential Revision: https://phabricator.services.mozilla.com/D159513
2022-10-18 08:17:43 +00:00
Julian Seward 518297a7d8 Bug 1795644 - A bit of tuning of inlining in the JS parser. r=arai.
Some profiling of tcampbell's React benchmark [1] shows 6.1 million calls to
js::frontend::GeneralTokenStreamChars<..>::getFullAsciiCodePoint, using 110.57
million instructions (x86_64).  That comes out to only 18 insns per call,
which suggests the method is a good candidate for inlining, but it isn't
inlined.

Merely parking an inline annotation on it doesn't help much, because it gets
inlined into js::frontend::TokenStreamSpecific<..>::getCodePoint, but that
isn't inlined into *its* caller(s), so the 6.1 million calls move to
::getCodePoint instead.

This patch requests inlining for both ::getFullAsciiCodePoint and
::getCodePoint and adds some MOZ_NEVER_INLINE annotations to ensure that cold
paths *don't* get inlined into these two, to reduce code bloat and avoid
excessive register pressure.

IsAscii functions in mfbt/TextUtils.h have been marked inline as a precaution;
this probably isn't necessary.

Run time with config [2] is reduced from 0.390 seconds to 0.379 seconds
(2.8% speedup, best of 50 runs), and from 0.402 to 0.396 seconds
(median of 50 runs).

Instruction count falls from 3511.8 million to 3395.8 million, and the number
of data accesses from 1563.7 million to 1487.4 million -- a 4.8% reduction
that is probably caused by avoidance of save/restore sequences in the inlined
fns.

[1] https://github.com/mozilla-spidermonkey/matrix-react-bench

[2] Fedora 35, x86_64, Intel Core i5 1135G7 at 4 ish GHz
    configure: --disable-debug --enable-optimize="-g -O2"
    run:       --no-threads

Differential Revision: https://phabricator.services.mozilla.com/D159500
2022-10-18 05:22:03 +00:00
Cristian Tuns fc754caf43 Backed out changeset 30dbd4267a26 (bug 1794439) for causing multiple failures on BacktrackingAllocator.cpp CLOSED TREE 2022-10-18 00:38:04 -04:00
Doug Thayer 75845722c0 Bug 1794439 - Inline HasNativeDataPropertyPure cache lookup in Ion r=jandem
I saw something like a 5% improvement to the Elm, React, and React-Redux
subtests of speedometer with this, with maybe a 1% overall Speedometer
improvement, although the confidence is lower.

Differential Revision: https://phabricator.services.mozilla.com/D158983
2022-10-18 03:57:03 +00:00
Ryan Hunt 59e8c99e0c Bug 1794841 - wasm: Remove unneeded asm.js bytecode offset handling from baseline. r=jseward
Calls in original asm.js source code that result in function calls at the wasm level
require preservation of the original JS line number. This metadata is through a
callSiteLineNums vector which needs to be iterated through exactly in sync between
the compiler and bytecode generator. We have this logic in ion, but for some reason
it also exists in baseline, even though baseline is never used (and won't be) for
asm.js code.

This commit removes logic related to line numbers from baseline, simplifying the
logic. Previously, we needed to consume the potential line number at the beginning
of the instruction, then propagate it to wherever the function call would be. Now
we can just read the bytecode offset of the current instruction whenever we need
it.

Differential Revision: https://phabricator.services.mozilla.com/D159201
2022-10-18 02:14:01 +00:00
Ryan Hunt 184d1da6bf Bug 1794841 - wasm: Fix clang-tidy warnings. r=jseward
This commit fixes actionable clang-tidy warnings in js/src/wasm.

There are some slight functional changes here, but nothing major.

Most of the issues are:
  * Mismatched decl/def arg names
  * Redundant if (cond) return true; else return false;
  * Unsigned to signed is implementation defined
  * Unnused definitions
  * Typedef instead of using
  * Uninitialized definitions

There are still a bunch of clang-tidy warnings, but they're
cases where our style is not matched with clang-tidy.

Differential Revision: https://phabricator.services.mozilla.com/D159194
2022-10-18 02:14:01 +00:00
Ryan Hunt cc80a7029a Bug 1794841 - wasm: Clean up ValType free methods. r=jseward
SizeOf can be replaced with .size()
MIRType conversion methods can be made consistent.
IsNumberType is not used.

Differential Revision: https://phabricator.services.mozilla.com/D159193
2022-10-18 02:14:00 +00:00
Ryan Hunt 999a88cbbb Bug 1794841 - wasm Remove unneeded OptimizedBackend enum. r=jseward
This is not needed now that CL has been removed.

Differential Revision: https://phabricator.services.mozilla.com/D159192
2022-10-18 02:14:00 +00:00
Ryan Hunt e7bc4bed23 Bug 1794841 - wasm: Avoid unnecessary allocations in TagType. r=jseward
An exception handling tag `(tag $name)` will nearly always have at
least one param for communicating the pointer to the thrown exception.

We should increase the inline storage in this vector so that we
don't have to allocate in this case. We do this already with the
ValTypeVector used in this class.

Differential Revision: https://phabricator.services.mozilla.com/D159191
2022-10-18 02:13:59 +00:00
Ryan Hunt 7cacbab73c Bug 1794841 - wasm: Remove unused asm.js opcodes. r=jseward
Differential Revision: https://phabricator.services.mozilla.com/D159190
2022-10-18 02:13:59 +00:00
Cristian Tuns 73d2d7042e Backed out 6 changesets (bug 1794841) for causing build bustages CLOSED TREE
Backed out changeset fba05a94b614 (bug 1794841)
Backed out changeset 83fa047989c7 (bug 1794841)
Backed out changeset 2a4c88ddd548 (bug 1794841)
Backed out changeset 9fa0cc213d62 (bug 1794841)
Backed out changeset b3722221b4be (bug 1794841)
Backed out changeset 2daef03ea536 (bug 1794841)
2022-10-17 19:11:19 -04:00
Ryan Hunt f5b8a2c623 Bug 1794841 - wasm: Remove unneeded asm.js bytecode offset handling from baseline. r=jseward
Calls in original asm.js source code that result in function calls at the wasm level
require preservation of the original JS line number. This metadata is through a
callSiteLineNums vector which needs to be iterated through exactly in sync between
the compiler and bytecode generator. We have this logic in ion, but for some reason
it also exists in baseline, even though baseline is never used (and won't be) for
asm.js code.

This commit removes logic related to line numbers from baseline, simplifying the
logic. Previously, we needed to consume the potential line number at the beginning
of the instruction, then propagate it to wherever the function call would be. Now
we can just read the bytecode offset of the current instruction whenever we need
it.

Differential Revision: https://phabricator.services.mozilla.com/D159201
2022-10-17 22:46:04 +00:00
Ryan Hunt 477a87b345 Bug 1794841 - wasm: Fix clang-tidy warnings. r=jseward
This commit fixes actionable clang-tidy warnings in js/src/wasm.

There are some slight functional changes here, but nothing major.

Most of the issues are:
  * Mismatched decl/def arg names
  * Redundant if (cond) return true; else return false;
  * Unsigned to signed is implementation defined
  * Unnused definitions
  * Typedef instead of using
  * Uninitialized definitions

There are still a bunch of clang-tidy warnings, but they're
cases where our style is not matched with clang-tidy.

Differential Revision: https://phabricator.services.mozilla.com/D159194
2022-10-17 22:46:03 +00:00
Ryan Hunt cd5e982b39 Bug 1794841 - wasm: Clean up ValType free methods. r=jseward
SizeOf can be replaced with .size()
MIRType conversion methods can be made consistent.
IsNumberType is not used.

Differential Revision: https://phabricator.services.mozilla.com/D159193
2022-10-17 22:46:03 +00:00
Ryan Hunt 540a323026 Bug 1794841 - wasm Remove unneeded OptimizedBackend enum. r=jseward
This is not needed now that CL has been removed.

Differential Revision: https://phabricator.services.mozilla.com/D159192
2022-10-17 22:46:03 +00:00
Ryan Hunt 112713f6b0 Bug 1794841 - wasm: Avoid unnecessary allocations in TagType. r=jseward
An exception handling tag `(tag $name)` will nearly always have at
least one param for communicating the pointer to the thrown exception.

We should increase the inline storage in this vector so that we
don't have to allocate in this case. We do this already with the
ValTypeVector used in this class.

Differential Revision: https://phabricator.services.mozilla.com/D159191
2022-10-17 22:46:02 +00:00
Ryan Hunt bc9fdc2df0 Bug 1794841 - wasm: Remove unused asm.js opcodes. r=jseward
Differential Revision: https://phabricator.services.mozilla.com/D159190
2022-10-17 22:46:02 +00:00
Jon Coppeard 74f4da63ac Bug 1791975 - Don't sweep realms that were allocated during incremental GC r=jandem
When marking a BaseShape we mark its global, and we read the pointer to that
global from the realm. If a realm doesn't have a live global we can sweep the
realm but there may still be pointers to it in base shapes and these are left
dangling.

This happens when we hit OOM while creating a global during an incremental GC.
The BaseShape survives because it was allocated after the start of the GC. The
global itself is never successfully created and so the realm doesn't have a
live global and is swept. In this case, we trigger UAF when we try to compact
the heap and trace the base shape.

The patch adds an extra case for keeping a realm alive if it was created during
an incremental GC. This matches the way that GC things are not collected if
they are allocated after the start of a GC.

Differential Revision: https://phabricator.services.mozilla.com/D158022
2022-10-17 17:09:07 +00:00
Jon Coppeard 708068a79f Bug 1795524 - Part 3: Factor out ThrowUnexpectedModuleStatus r=arai
This is unrelated to the bug but is a tidyup that makes it easier to set
debugger breakpoints for this error.

Differential Revision: https://phabricator.services.mozilla.com/D159486
2022-10-17 13:54:00 +00:00
Jon Coppeard 617fe4587c Bug 1795524 - Part 2: Move ModuleObject slots for cyclic module record fields to CyclicModuleFields r=arai
This adds a new native structure to hold the cyclic module record fields. This
removes a bunch of marshalling to and from Values.

Differential Revision: https://phabricator.services.mozilla.com/D159485
2022-10-17 13:54:00 +00:00
Jon Coppeard b91625f2dd Bug 1795524 - Part 1: Move definition of FunctionDeclarationVector to SharedStencil.h to avoid dependency cycle r=arai
Annoyingly this definition is needed in builtin/ModuleObject.h which is included
via vm/Scope.h, but frontend/Stencil.h already includes vm/Scope.h. This moves
it to vm/SharedStencil.h.

Differential Revision: https://phabricator.services.mozilla.com/D159484
2022-10-17 13:54:00 +00:00
Kris Maglione 242c704d10 Bug 1795164: Replace Cu.generateXPCWrappedJS with Cu.getDebugName. r=mccr8
The only remaining user of this function uses it as an awkward way to get the
debug name of a timer callback function. We should just provide it with a
straightforward way to do that instead.

Differential Revision: https://phabricator.services.mozilla.com/D159335
2022-10-14 22:49:20 +00:00
Kris Maglione fc029513a6 Bug 1794424: Stop using `with()` to try to avoid the JIT. r=jandem,mccr8
It shouldn't actually keep us out of Baseline anymore, and `eval` should be
enough to prevent any heavy optimization.

I tried replacing the `eval()` with `Cu.exportFunction` to create native stack
frames in a definitely-not-JITtable way, but the frames were too small, and
the stub JS function calls started failing with stack overflow errors at the
same time as the "heavy" native calls.

That also happened to uncover a fairly obvious bug in the existing test, in
that we can't actually report a failed assertion when we're out of stack
space, and just wind up throwing another stack overflow or allocation error
instead.

Differential Revision: https://phabricator.services.mozilla.com/D159225
2022-10-13 20:50:08 +00:00
Dan Minor c81a0bf5bd Bug 1786853 - Synthesize accessor methods; r=arai
Differential Revision: https://phabricator.services.mozilla.com/D158765
2022-10-13 15:21:05 +00:00
Dan Minor 96be063db8 Bug 1786853 - Make fields with accessors private; r=arai
Differential Revision: https://phabricator.services.mozilla.com/D158764
2022-10-13 15:21:05 +00:00
Dan Minor 381dbe8b62 Bug 1786853 - Fix broken tests; r=arai
Differential Revision: https://phabricator.services.mozilla.com/D158763
2022-10-13 15:21:04 +00:00
Jon Coppeard e492626823 Bug 1790630 - Add telemetry for zones r=sfink
This adds telemetry for total zone count and number of zones collected.

Differential Revision: https://phabricator.services.mozilla.com/D157302
2022-10-13 09:22:38 +00:00
Tooru Fujisawa 3d1f25971b Bug 1794288 - Handle OOM during reporting warning. r=bthrall
Differential Revision: https://phabricator.services.mozilla.com/D159011
2022-10-13 02:56:15 +00:00
Yury Delendik 69b0c551f2 Bug 1787554 - Update tests and change call_ref parsing. r=rhunt
- Imports new spec tests
- Updates local call_ref tests
- Changes parsing logic to use call_ref type annotation
- Remove non-null call_ref optimization

Differential Revision: https://phabricator.services.mozilla.com/D158607
2022-10-13 01:42:20 +00:00
Yury Delendik 6873406709 Bug 1787554 - Vendor new versions of wast+dependencies. r=rhunt,supply-chain-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D158606
2022-10-13 01:42:20 +00:00
Kris Maglione 1225e9b8e7 Bug 1792334 - Decom nsIXPConnect and friends. r=mccr8
They haven't been scriptable in years, so there's no need for them to go
through XPIDL or for the methods to be virtual.

Differential Revision: https://phabricator.services.mozilla.com/D158081
2022-10-12 22:26:12 +00:00
Cristian Tuns c815815081 Backed out changeset b5b51c1be2f5 (bug 1792334) for causing build bustages on XPCWrappedJS.cpp CLOSED TREE 2022-10-12 18:05:39 -04:00
Kris Maglione 48e9d5b01f Bug 1794186: Remove remaining __exposedProps__ references. r=nika
Some more of these tests could probably be removed completely, but they still
leave some vestigial opaque COW tests that might still be worse something,
even though they should be completely redundant.

Differential Revision: https://phabricator.services.mozilla.com/D158997
2022-10-12 21:46:02 +00:00
Kris Maglione fd512a79f8 Bug 1792334 - Decom nsIXPConnect and friends. r=mccr8
They haven't been scriptable in years, so there's no need for them to go
through XPIDL or for the methods to be virtual.

Differential Revision: https://phabricator.services.mozilla.com/D158081
2022-10-12 21:45:13 +00:00
Ryan Hunt 4fe4e90677 Bug 1791361 - wasm: Fix the other point we setTryBodyEnd without checking for OOM. r=yury
The same issue as bug 1788213, this time in Ion.

Differential Revision: https://phabricator.services.mozilla.com/D157939
2022-10-12 18:40:03 +00:00
Cristian Tuns 50132285c1 Backed out changeset f6ede8dfcef8 (bug 1792228) for causing multiple failures on JSContext-inl.h CLOSED TREE 2022-10-12 14:18:49 -04:00
Iain Ireland 653af6e580 Bug 1794317: Free captureIndices on OOM r=mgaudet
Differential Revision: https://phabricator.services.mozilla.com/D159076
2022-10-12 17:27:20 +00:00
Iain Ireland 16e41aaea6 Bug 1792228: Use LoadObject instead of LoadProto for proto shape guards r=jandem
We noticed this while looking at the CacheIR generated for an add-slot stub.

The depth threshold of 4 was picked by browsing around on the web and dumping the observed depth. 4 is enough to cover 95%+ of the cases I saw.

There are a couple of other places where we use LoadProto: the no-teleporting case in `GeneratePrototypeGuards`, and `ShapeGuardPrototypeChainForCrossCompartmentHolder`. They didn't show up in my experiments, so I left them alone for now.

Differential Revision: https://phabricator.services.mozilla.com/D158037
2022-10-12 17:27:17 +00:00
Iain Ireland 8fed5a78e7 Bug 1791968: Save exception before rematerializing frame in OnLeaveIonFrame r=jandem
Differential Revision: https://phabricator.services.mozilla.com/D158001
2022-10-12 17:27:14 +00:00
Jon Coppeard a8344b1f34 Bug 1712762 - Check if module load requests have already been cancelled in ModuleLoaderBase::CancelDynamicImport r=yulia
I don't know whether this is the problem, but if we try and cancel a request
that has already been cancelled it would produce this crash.

Differential Revision: https://phabricator.services.mozilla.com/D159167
2022-10-12 16:26:20 +00:00
Tim Chevalier 2244e565d8 Bug 1765477: Allow wrapping ExtendedPrimitives in dom::MaybeWrapValue() r=edgar,nchevobbe
The dom::MaybeWrapValue() method was calling `isObject()` rather than
`hasObjectPayload()`, causing an assertion failure when passed a value
representing an ExtendedPrimitive (record or tuple). This was causing a crash
when evaluating a record or tuple literal either in the navigation bar or
the developer console. In addition, js::ToBooleanSlow() was missing a case
for ExtendedPrimitives, which would also cause an assertion failure in the
same scenario.

For documentation, I also added explicit assertions to dom::...Wrap...()
methods defined in BindingUtils.h that aren't expected to support
ExtendedPrimitives.

I also added placeholders for pretty-printing records and tuples in the
console (fully rendering these values is left for Bug 1772157).

Depends on D156494

Differential Revision: https://phabricator.services.mozilla.com/D148062
2022-10-12 15:00:35 +00:00
Nicolas B. Pierron 14e66fd517 Bug 1789528 - Add a new option type to skip the delazification-mode CLI. r=bthrall
The --delazification-mode set a parsing mode which is incompatible with code
coverage. This patch works around this limitation by changing `-e` and adding an
equivalent of `-f`, named `-p` to parse everything eagerly until the skip
condition can be evaluated.

This patch also updates the test suite harness to prefix the `prologue.js` file
with `-p` to avoid crashes with the delazification-mode and JS code coverage.

Differential Revision: https://phabricator.services.mozilla.com/D158851
2022-10-12 13:03:25 +00:00
Alexandre Poirot f48160c87a Bug 1793602 - Test getModuleImportStack only on nightly builds in test_import_devtools_loader.js. r=arai
Differential Revision: https://phabricator.services.mozilla.com/D159060
2022-10-12 10:24:57 +00:00
Yury Delendik 92f834f86c Bug 1778751 - Implement BFloat16 product instruction. r=jseward
Differential Revision: https://phabricator.services.mozilla.com/D152224
2022-10-11 22:12:09 +00:00
Yury Delendik 8bf1b45e8f Bug 1783723 - Fix ordering for FMA and FNMA. r=jseward
- Rename everything FMS to FNMA
- Change ordering operands

Differential Revision: https://phabricator.services.mozilla.com/D158715
2022-10-11 19:15:54 +00:00
Andrew McCreight cbfad78f92 Bug 1793227, part 9 - Automated fixes for js/xpconnect/tests/browser/. r=kmag
Differential Revision: https://phabricator.services.mozilla.com/D158508
2022-10-10 22:22:02 +00:00
Andrew McCreight 1e9cfa44fc Bug 1793227, part 8 - Manual eslint fixes for js/xpconnect/tests/browser/. r=kmag
browser_exception_leak.js is intentionally creating a leak, so maybe the unused
doc is intentional.

browser_import_mapped_jsm.js is deliberately testing the behavior of Cu.import,
so ignore the failure there.

Differential Revision: https://phabricator.services.mozilla.com/D158507
2022-10-10 22:22:02 +00:00
Andrew McCreight 6667e48501 Bug 1793227, part 7 - Manual fixes for XPCOMUtils.sys.mjs. r=kmag
One place was missing an explicit return.

The eslint-disable-next-line is needed because the analysis doesn't
seem to understand the non-static string.

The return was split into a separate line because that made eslint
complain that we needed to be consistent about returns, though
the return type of defineModuleGetter is undefined.

Finally, I updated the ChromeUtils.import() calls so they weren't using
the deprecated argument.

Differential Revision: https://phabricator.services.mozilla.com/D158506
2022-10-10 22:22:02 +00:00
Andrew McCreight c41c392332 Bug 1793227, part 6 - Automated fixes for XPCOMUtils.sys.mjs. r=kmag
Differential Revision: https://phabricator.services.mozilla.com/D158505
2022-10-10 22:22:01 +00:00
Andrew McCreight 5aaf8f6590 Bug 1793227, part 5 - Clean up some named function cruft in XPCOMUtils.sys.mjs. r=kmag
This used to be needed to improve the debugging information, but isn't any more.

I fixed up the whitespace at the same time to match what the automated formatter
would have done in the next patch, to reduce gratuitous churn.

Differential Revision: https://phabricator.services.mozilla.com/D158970
2022-10-10 22:22:00 +00:00
Andrew McCreight 5ca7bf0e94 Bug 1793227, part 4 - Manual eslint fixes for js/xpconnect/tests/chrome. r=kmag
I removed test_bug596580.xhtml because it is testing JS versioning for
the subscript loader, which is long gone.

This adds XPCNativeWrapper as a valid global object. It is already allowed
for the other two kinds of mochitests.

Differential Revision: https://phabricator.services.mozilla.com/D158504
2022-10-10 22:22:00 +00:00
Andrew McCreight d8c43d0ea1 Bug 1793227, part 3 - Automatic fixes for js/xpconnect/tests/chrome. r=kmag
Also change .eslintignore to cover the other directories.

This also fixes the indentation the automatic fixer messed up in a few XHTML files.

Differential Revision: https://phabricator.services.mozilla.com/D158503
2022-10-10 22:22:00 +00:00
Andrew McCreight a2486eeeb0 Bug 1793227, part 2 - Manually convert some http:// URLs to https:// in chrome XPConnect tests. r=kmag
The eslint autofixer makes URLs that appear in strings in JS into https://
URLs. However, it does not change any URLs in the HTML part of the tests, which
caused some tests to fail. To try to ensure that the autofixer didn't break
tests in any way that doesn't show up as a failure, I did a light audit of the
tests. Specifically, I looked at files in js/xpconnect/tests/chrome/ containing
the string "example." in a URL string in more than one place. I switched these
URLs over to https://, both in JS and HTML.

I left alone test_secureContexts.html, which uses an http:// URL in HTML, but
is clearly trying to test http://.

I did a similar check for mochi.test but there weren't any tests that used it
more than once.

The tests that originally were broken by the autofix were:
  * test_evalInWindow.xhtml
  * test_expandosharing.xhtml
  * test_wrappers.xhtml
  * test_xrayic.xhtml

My audit didn't find any other instances that looked like they might fail. I
did fix a few other places, but I think in those cases the HTML and JS URLs were
cross origin anyways so it shouldn't really matter if one is https:// and the
other is http://.

I also changed single quotes to double quotes for the URLs I changed, because
the autofix is going to do that anyways.

Differential Revision: https://phabricator.services.mozilla.com/D158502
2022-10-10 22:21:59 +00:00
Andrew McCreight b9091631a4 Bug 1793227, part 1 - Disable generated QI errors in two places. r=kmag
Disable this so the autofix doesn't erroneously change them.

Differential Revision: https://phabricator.services.mozilla.com/D158501
2022-10-10 22:21:59 +00:00
Doug Thayer 9b68d17dda Bug 1792235 - Change ZydisAPI print LIMIT variable to 48 from 36 r=jandem
If there's something I'm missing here that's totally fine, I just keep making
this change locally and reverting it and it would be convenient to just leave
it.

Differential Revision: https://phabricator.services.mozilla.com/D158038
2022-10-10 16:13:26 +00:00
Zhao Jiazhong b553b8225d Bug 1792981 - [loong64] Enable JIT compiler of loong64 port by default. r=jandem
Fix a build with JIT issue on native loongarch64 machine, and enable JIT by default.

Differential Revision: https://phabricator.services.mozilla.com/D158397
2022-10-10 13:22:35 +00:00