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

3408 Коммитов

Автор SHA1 Сообщение Дата
Butkovits Atila 80ba5dd933 Backed out 2 changesets (bug 1688616) for casing failures on test_large_arraybuffers.html. CLOSED TREE
Backed out changeset 560718ce8d2c (bug 1688616)
Backed out changeset 7985fd012bc7 (bug 1688616)
2021-01-30 18:10:09 +02:00
Jan de Mooij 2192481240 Bug 1688616 part 2 - Check for large ArrayBuffer{View}s in WebIDL bindings. r=edgar,lth
The dom::TypedArray type currently represents its length as uint32_t. Changing
that to size_t/uint64_t would cause problems (truncation) for many 'Length()' callers.
Instead of requiring a length check for each of those call sites, for now check for
and reject large array buffers and views in the generated bindings.

Code and tests are based on the implementation of the [AllowShared] attribute.
Additional tests for the new JSAPIs will be added as part of bug 1674777.

Depends on D102911

Differential Revision: https://phabricator.services.mozilla.com/D102912
2021-01-27 14:01:44 +00:00
Jan de Mooij 950369e123 Bug 1688616 part 1 - Add a browser pref for large ArrayBuffers. r=lth
The pref is only checked on startup and sets a process-wide flag, so that we
don't have to worry about the value changing from under us.

Differential Revision: https://phabricator.services.mozilla.com/D102911
2021-01-27 11:53:23 +00:00
Jon Coppeard b03fa64f6b Bug 1689394 - Simplify TraceKind definition to reduce code generated by switch statements r=sfink
Currently we arrange for the low thre bits of the TraceKind value be set for all trace kinds greater than seven (see definition of JS::TraceKind). This is to save a branch creating a GCCellPtr in GCCellPtr::checkedCast.

This has the side effect of generating an 80 entry lookup table when we switch on TraceKind when there are only 12 distinct trace kinds. And clang doesn't use a branch in checkCast anyway.

The patch changes TraceKind so that the values increment by one each time. This affects performance by increasing inlining opportunities in the marking code.

Depends on D103501

Differential Revision: https://phabricator.services.mozilla.com/D103502
2021-01-29 19:47:47 +00:00
Jon Coppeard 4234a7dca4 Bug 1689394 - Make updating tracing context information unconditional on the tracer kind r=sfink
One thing we have to do when tracaing is udpate context information (e.g. edge name) if the tracer is a kind that requires it. It's simpler and more efficient to give all tracers this context and perform an unconditional write to the stack.

Mostly we can get away without saving/restoring context information too. This adds AutoClearTracingContext for the one place we need to do this because of nested use of the same tracer while tracing something else.

Differential Revision: https://phabricator.services.mozilla.com/D103500
2021-01-30 11:21:28 +00:00
Jon Coppeard 681a1c23e1 Bug 1689140 - Refactor SliceBudget API r=sfink
This patch does several things:
 - make the counter type int64_t like the work budget parameter (the original purpose of this bug)
 - simplify implementation by using a Variant to discriminate between different kinds of budget
 - remove the global initialization
 - remove makeUnlimited() (and replace uses with assignment from SliceBudget::unlimited())
 - add convenience methods to get the original budget parameters
 - add basic API tests

The use of Variant had the consequence that we now have to pass SliceBudget by reference now to make the linter happy.

Differential Revision: https://phabricator.services.mozilla.com/D103318
2021-01-28 19:11:42 +00:00
Jason Orendorff 41c4b03378 Bug 1683727 - Improve error messages when private fields are not found. r=mgaudet
Previously we always said "Trying to read" even when the error occurred while
trying to write.

The use of "object" in the new messages is inaccurate when the user is trying
to set a private field on a primitive value, but this is the best I can do
without adding fields to the error message--which would have to affect
bytecode.

Differential Revision: https://phabricator.services.mozilla.com/D100258
2021-01-26 14:46:15 +00:00
Jon Coppeard 7d27eb1bf3 Bug 1686249 - Replace the 'GC mode' with two GC parameters r=sfink
This doesn't change the current defaults, only the comments and default values which were wrong/misleading - see the current call to setGCMode() in the GCRuntime constructor.

Differential Revision: https://phabricator.services.mozilla.com/D102717
2021-01-23 08:49:17 +00:00
Tooru Fujisawa 51226a3690 Bug 1688190 - Part 6: Make JS::RealmBehaviorsRef return const reference. r=tcampbell
Depends on D102761

Differential Revision: https://phabricator.services.mozilla.com/D102762
2021-01-22 21:52:30 +00:00
Tooru Fujisawa 38b499c75e Bug 1688190 - Part 5: Add JS::SetRealmNonLive. r=tcampbell
Depends on D102760

Differential Revision: https://phabricator.services.mozilla.com/D102761
2021-01-22 21:52:29 +00:00
Jon Coppeard 7ef3b06126 Bug 1687956 - Refactor chunk data structures to inherit from a common base class r=sfink
Differential Revision: https://phabricator.services.mozilla.com/D102620
2021-01-22 09:16:13 +00:00
Jon Coppeard 8d00792ac3 Bug 1687336 - Rename Chunk to TenuredChunk r=allstarschh
Finally rename Chunk itself. I went with TenuredChunk rather than TenuredHeapChunk for brevity.

Depends on D102395

Differential Revision: https://phabricator.services.mozilla.com/D102396
2021-01-20 13:19:03 +00:00
Jon Coppeard e09d49dff8 Bug 1687336 - Rename tenured heap chunk data structures to distinguish them from nursery ones r=allstarschh
This renames the data structures inside Chunk:

  ChunkInfo -> TenuredChunkInfo
  PerArenaBitmap -> DecommitBitmap
  ChunkBitmap -> MarkBitmap
  ChunkBase -> TenuredChunkBase

This also renames TenuredChunkBase::bitmap to markBits.

Depends on D102394

Differential Revision: https://phabricator.services.mozilla.com/D102395
2021-01-20 13:18:55 +00:00
Jon Coppeard 05b9a46394 Bug 1687646 - Refactor NurseryDecommitTask so that Chunk doesn't need to know about it r=sfink
Currently the decommit task uses Chunk's next pointer to for a singly linked list of chunks awaiting decommit. This is kind of dubious since they are supposed to be NurseryChunks at this point.

This changes the decommit task to use a vector and simplifies the threading requirements by having us always wait for the previous decommit to finish before starting a new one.

Depends on D102393

Differential Revision: https://phabricator.services.mozilla.com/D102394
2021-01-21 02:46:36 +00:00
Jon Coppeard 3d157b0908 Bug 1687335 - Remove chunk location field and use storebuffer pointer to determine which chunks are in the nursery r=sfink,jandem
The ChunkLocation field is not necessary because we can tell the different between nursery chunks and tenured heap chunks based on whether the storebuffer pointer is null or not. This patch removes the field.

Jan, is there any impact on the generated JIT code for doing it this way?

This allows us to get one more arena per chunk on 64 bit systems with the small chunk size.

Differential Revision: https://phabricator.services.mozilla.com/D102393
2021-01-21 12:04:12 +00:00
Jon Coppeard bea08bb81b Bug 1687335 - Remove padding from Chunk data structures r=sfink
Remove the unnecessary padding. This lets us have one more arena per chunk on 32 bit Android builds with the small chunk size.

Differential Revision: https://phabricator.services.mozilla.com/D102392
2021-01-21 12:03:59 +00:00
Jon Coppeard 93420d0a2a Bug 1687002 - Fix incremental marking validator r=sfink
This patch makes ChunkBitmap::getMarkWordAndMask into an instance method so that the uses in MarkingValidator access the correct bitmap.

Depends on D101778

Differential Revision: https://phabricator.services.mozilla.com/D102207
2021-01-19 15:20:25 +00:00
Jon Coppeard e9ee99f363 Bug 1686219 - Store chunk information at the start rather than the end of the chunk r=sfink
This moves the chunk metadata to the start of the chunk and defines the data structures in the public header.  This simplifies accessing this data and removes the need for hardcoded offsets.

Requesting review from jandem for JIT updates.

Differential Revision: https://phabricator.services.mozilla.com/D101778
2021-01-20 10:04:29 +00:00
Jan de Mooij 59b31a0b91 Bug 1686936 part 3 - Clean up setNumber/NumberValue implementations in Value.h. r=anba,tcampbell
All integral to NumberValue conversions are now handled by the setNumber template,
except for NumberValue(uint32_t) which has to stay constexpr to not add static
constructors to the DOM bindings when compiling with GCC.

This ensures setNumber(x) and NumberValue(x) behave consistently.

Remove unnecessary setMagic/setNumber implementations from HeapBase: the setMagic
implementation was wrong (would always assert) and they should just be inherited
from the base class.

Differential Revision: https://phabricator.services.mozilla.com/D102184
2021-01-19 16:32:41 +00:00
André Bargull cd2be63a71 Bug 1685482 - Part 2: Disallow identifiers named "async" in for-of loops. r=yulia
`for-of` loops mustn't start with the token sequence `async of`, because that
leads to a shift-reduce conflict when parsing `for (async of => {};;)` or
`for (async of [])`. This restriction doesn't apply to `for-await-of` loops,
because `async` in `for await (async of ...)` is always parsed as an identifier.

Parsing `for (async of ...)` already results in a SyntaxError, but that happens
because `assignExpr()` always tries to parse the sequence `async [no LineTerminator] of`
as the start of an async arrow function. That means `forHeadStart()` still needs
to handle the case when `async` and `of` are separated by a line terminator.

Part 3 will update the parser to allow `for await (async of ...)`.

Spec change: https://github.com/tc39/ecma262/pull/2256

Depends on D100994

Differential Revision: https://phabricator.services.mozilla.com/D100995
2021-01-14 16:09:50 +00:00
Tom Schuster 71555984ed Bug 1687063 - Improve error messages when trying to consume a Reponse for WebAssembly. r=lth
Differential Revision: https://phabricator.services.mozilla.com/D102055
2021-01-18 12:16:33 +00:00
Jan de Mooij 5d1032ff8b Bug 1686445 part 7 - Change some APIs to take int64_t/size_t instead of int32_t/uint32_t. r=sfink
This prevents truncation in the structured clone code.

Differential Revision: https://phabricator.services.mozilla.com/D101740
2021-01-14 21:50:32 +00:00
Luke Wagner 96147a3ab6 Bug 1647791 - WebAssembly: add telemetry for duplicate imports r=lth
Differential Revision: https://phabricator.services.mozilla.com/D100555
2021-01-07 23:50:38 +00:00
Ted Campbell a8e1541ef9 Bug 1686572 - Return JS::OffThreadToken* from off-thread script compile. r=arai
Instead of using both an optional out-param and a boolean return value, we
can simply return the token directly. This is less error-prone and requires
no change to callers that did not use the out-param.

Differential Revision: https://phabricator.services.mozilla.com/D101654
2021-01-14 00:51:13 +00:00
Steve Fink a75149f6b8 Bug 1684123 - Implement GetArrayBufferViewFixedData and dom::TypedArray_base::FixedData(). r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D100426
2021-01-13 22:17:40 +00:00
Mihai Alexandru Michis bf411e8d30 Backed out 2 changesets (bug 1684123, bug 1682068) for causing bustages.
CLOSED TREE

Backed out changeset e6df68a131a3 (bug 1682068)
Backed out changeset 91ad893cc4d4 (bug 1684123)
2021-01-13 20:34:56 +02:00
Steve Fink 7f06a7503b Bug 1684123 - Implement GetArrayBufferViewFixedData and dom::TypedArray_base::FixedData(). r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D100426
2021-01-13 18:03:25 +00:00
Tooru Fujisawa 33a5756351 Bug 1681308 - Add alignment requirement to XDR buffer. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D101125
2021-01-13 02:18:26 +00:00
Tooru Fujisawa 982f8abe40 Bug 1681304 - Add lifetime requirement to XDR buffer. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D101124
2021-01-08 11:47:24 +00:00
Jon Coppeard bd439acf7f Bug 1685132 - Remove the special case for tenuring in TraceEdgeInternal r=sfink
This simplifies tracing by removing the special case for the tenuring tracer in
TraceEdgeInternal. TenuringTracer becomes a GenericTracer and this path uses
virtual dispatch.

Most tenuring is not done by this path however and the compiler can optimise
away the virtual dispatch in the TenuringTracer::traverse methods.

I measured around 15% improvement for evicting a full nursery in local
benchmarking with this change.

Differential Revision: https://phabricator.services.mozilla.com/D100876
2021-01-08 09:06:33 +00:00
Jon Coppeard fc91cd019c Bug 1681533 - Only collect the nursery when necessary in major GC r=sfink
This rearranges a few things so that we can run a minor GC inside a major GC
slice, so we don't have to be conservative about collecting the nursery at the
start of a slice.

Differential Revision: https://phabricator.services.mozilla.com/D99366
2021-01-04 17:01:50 +00:00
Sylvestre Ledru b58ddc19df Bug 1519636 - Reformat recent changes to the Google coding style r=andi
Updated with Debian clang-format version 11.0.1-1

# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D100934
2021-01-06 17:17:23 +00:00
smolnar fbf90ef232 Backed out changeset 7da8f779dc24 (bug 1681533) at developer's request for causing Bug 1683870. a=backout DONTBUILD 2020-12-28 12:18:01 +02:00
André Bargull 9e65668038 Bug 1672862 - Part 11: Remove failSoft mode from ObjectOpResult. r=tcampbell,evilpie
Parts 3-4 removed the only callers to `ObjectOpResult::failSoft()`.

Differential Revision: https://phabricator.services.mozilla.com/D99400
2020-12-22 16:18:23 +00:00
André Bargull caa4592d76 Bug 1672862 - Part 3: Update TypedArray [[DefineProperty]]. r=tcampbell
Update TypedArray [[DefineProperty]] to match the current spec. This includes
throwing in `js::DefineTypedArrayElement` for out-of-bounds indices and
detached buffers. V8 already ships with this behaviour, so it should be
web-compatible for us to throw errors. We can't reuse the existing
`JSMSG_BAD_INDEX` error code, because that throws a `RangeError`.

As a side-effect of this change, `Object.seal()` will now throw non-empty
TypedArrays.

Differential Revision: https://phabricator.services.mozilla.com/D99382
2020-12-22 16:10:38 +00:00
Jon Coppeard af859fd8ec Bug 1681533 - Only collect the nursery when necessary in major GC r=sfink
This rearranges a few things so that we can run a minor GC inside a major GC
slice, so we don't have to be conservative about collecting the nursery at the
start of a slice.

Differential Revision: https://phabricator.services.mozilla.com/D99366
2020-12-17 17:57:33 +00:00
Jon Coppeard c9ac8f6feb Bug 1681297 - Refactor JS::shadow::Zone flags into a single enum and make it const r=jandem
Following on from the previous patch which moved the individual flags for the
zone kind into shadow::Zone, we can replace these by a single kind enum which
is set once when the zone is created.

Depends on D99782

Differential Revision: https://phabricator.services.mozilla.com/D99787
2020-12-16 11:06:23 +00:00
Jon Coppeard 264aac87e3 Bug 1681297 - Skip pre-write barriers triggered on background threads r=sfink
The problem here is that we can trigger this barrier when background
finalization destroys HeapPtrs to things in the atoms zone, since the atoms
zone may still be marking at this point. (Usualy cross-zone edges are stored in
the private pointer of a cross-compartment wrapper.)

To avoid the possiblity of races the patch checks the current thread when the
target thing is in the atoms zone. To make this work without pulling the whole
of Zone.h into Cell.h I had to move some of the zone's flags into shadow::Zone.
I'll tidy that a little in the next patch.

Differential Revision: https://phabricator.services.mozilla.com/D99782
2020-12-15 15:34:55 +00:00
Matthew Gaudet 791451f924 Bug 1680602 - Split `TrySkipAwait` into two opcodes r=arai
The TrySkipAwait opcode optimization is challenging to JIT compile because of
the complicate semantics of its return values. In order to make this
dramatically more simple to JIT implement, this patch splits TrySkipAwait into
two ops: `CanSkipAwait` and `MaybeExtractAwaitValue`.

The first op, `CanSkipAwait` does the preparation to ensure that it would be
legal to skip the await enqueue. The second op, `MaybeExtractAwaitValue` uses
the result of the `CanSkipAwait` to decide if it should leave the value alone
or instead replace it with the awaited value. This pair of ops is a bit easier
for Warp to model in MIR than a single op.

Differential Revision: https://phabricator.services.mozilla.com/D98756
2020-12-15 16:26:23 +00:00
André Bargull 3dfe4e9095 Bug 1654116 - Part 2: Enable Intl.DisplayNames by default. r=jwalden
Differential Revision: https://phabricator.services.mozilla.com/D93231
2020-12-15 15:23:09 +00:00
Jon Coppeard 88e248703f Bug 1677765 - Perform arena unmarking concurrently r=sfink
This adds a new background task for unmarking which gets kicked off in the
first GC slice. There's a new explicit 'prepare' state for both the GCRuntime
and zones. The GC proper starts in a second (or later) slice when this has
finished.  Because of this we have to be a bit careful when checking GC
state because the 'prepare' state is not part of the GC from the point of view
of snapshot-at-the-beginning.

I had to update a bunch of test code that assumed that GC started in the mark
state.

This fixes cancelleling a parallel task in the case that the task was idle so
that it doesn't leave the cancel flag set.

Also it stops us sending telemetry about how much was collected in GCs that
were reset as we don't always have the data for the original heap sizes by this
point if the reset happened while we were in the prepare phase.

Finally there's a new zeal mode to test this, named YieldBeforeRootMarking
(slightly confusing but in line with the other modes).

Differential Revision: https://phabricator.services.mozilla.com/D98481
2020-12-15 13:13:07 +00:00
Lars T Hansen 810305d3e2 Bug 1672160 - SIMD wormhole. r=rhunt
Introduce a mechanism for experimenting with unary and binary SIMD
instructions (x64 + ion only, nightly only, and behind flags).
Basically this is useful for performance experiments.

A specific pattern of the first 15 bytes of the mask of the shuffle
opcode is recognized as a trigger; the last byte has the opcode 0..31.
For unary operations the two input values should be the same; the lhs
will always be chosen.  The pattern is recognized during lowering and
translated to specific machine instructions.

This mechanism is preferable to custom opcodes because it allows
existing tools (emscripten/llvm/binaryen/linkers) to be used without
change.

To trigger this, use --wasm-compiler=ion --wasm-simd-wormhole in the
shell or set javascript.options.wasm_baselinejit=false and
javascript.options.wasm_simd_wormhole=true in about:config.

This patch is mostly infrastructure but also introduces three
experimental opcodes: one to test for the presence and operation of
the wormhole, one to invoke the Intel PMADDUBSW instruction, and one
to invoke the Intel PMADDWD instruction.

Differential Revision: https://phabricator.services.mozilla.com/D94101
2020-12-15 09:49:35 +00:00
Jon Coppeard a3c605929b Bug 1681268 - Check zone pointers passed into the API and add a callback for zone destruction r=sfink
This adds assertions that zone pointers passed in refer to zones we know about
and adds and API that's called when zones are destroyed. It also adds some
standard assertions for other related APIs.

Differential Revision: https://phabricator.services.mozilla.com/D99071
2020-12-15 09:36:12 +00:00
Butkovits Atila 5f456b2985 Backed out changeset ab835b3d50f9 (bug 1672160) for causing bustage on codegen-x64-test.js. CLOSED TREE 2020-12-15 10:43:44 +02:00
Lars T Hansen e67a161e57 Bug 1672160 - SIMD wormhole. r=rhunt
Introduce a mechanism for experimenting with unary and binary SIMD
instructions (x64 + ion only, nightly only, and behind flags).
Basically this is useful for performance experiments.

A specific pattern of the first 15 bytes of the mask of the shuffle
opcode is recognized as a trigger; the last byte has the opcode 0..31.
For unary operations the two input values should be the same; the lhs
will always be chosen.  The pattern is recognized during lowering and
translated to specific machine instructions.

This mechanism is preferable to custom opcodes because it allows
existing tools (emscripten/llvm/binaryen/linkers) to be used without
change.

To trigger this, use --wasm-compiler=ion --wasm-simd-wormhole in the
shell or set javascript.options.wasm_baselinejit=false and
javascript.options.wasm_simd_wormhole=true in about:config.

This patch is mostly infrastructure but also introduces three
experimental opcodes: one to test for the presence and operation of
the wormhole, one to invoke the Intel PMADDUBSW instruction, and one
to invoke the Intel PMADDWD instruction.

Differential Revision: https://phabricator.services.mozilla.com/D94101
2020-12-15 07:39:15 +00:00
Ryan Hunt c87b1f7727 Bug 1675602 - Use WebAssembly's type system for TypedObject. r=lth
This commit removes TypedObject's type system (StructTypeDescr,
ArrayTypeDescr, ScalarTypeDescr) and replaces it with a
wasm::TypeHandle to a wasm::TypeDef inside the global
wasm::TypeContext. TypeDescr is left as a JSObject that
wraps a wasm::TypeHandle for a TypedObject. In the future
it will likely be re-used for a RttValue.

When instantiating a module, types are transferred to
the global context and TypeDescr objects wrapping the type handles
are created. The TypeDescr objects are placed in TlsData
for the TypeIdDesc corresponding to the StructType.

Differential Revision: https://phabricator.services.mozilla.com/D96223
2020-12-13 01:13:56 +00:00
Ryan Hunt 82287f3b5b Bug 1675602 - Unify handling of unexposable types between coercion functions. r=lth
The major difference between the two separate implementations
of ToJSValue is that the one operating on void* to have
!isExposable() filtered out by callers and generates a plausible
value for !isExposable() values. This allows the function to be
used by the debugger and not trigger errors in functions that have
v128.

This commit unifies both ToJSValue implementations to expect
!isExposable() values filtered out by callers and will return
a plausible value (now 'undefined') for users like debuggers
who want something. All callers that expect an error now check
isExposable() before calling the coercion function.

Differential Revision: https://phabricator.services.mozilla.com/D96221
2020-12-13 01:15:49 +00:00
Steve Fink dad68c3ddf Bug 1662254 - Rename CC_WAITING -> CC_FINISHED r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D94792
2020-12-11 19:04:31 +00:00
Steve Fink d5e1bc3adf Bug 1662254 - Move bodies of large inline CCGCScheduler methods after the class declaration r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D94791
2020-12-11 19:04:27 +00:00
Butkovits Atila 81c02c9a1c Backed out changeset b4072f201205 (bug 1677765) for failures on ProtectedData.h. CLOSED TREE 2020-12-10 14:50:47 +02:00