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

90722 Коммитов

Автор SHA1 Сообщение Дата
Jon Coppeard e314b376d3 Bug 1858200 - Interrupt wasm when a major GC is requested r=jandem
Currently wasm ignores GCs triggered by allocation, which can lead to unbounded
memory growth when running purely in wasm. Making the GC interrupt also
interrupt wasm fixes this.

Differential Revision: https://phabricator.services.mozilla.com/D190669
2023-10-11 12:11:34 +00:00
tiuna.angelini 72975e5947 Bug 1857747 - Removed duplicate include r=mccr8 DONTBUILD
Differential Revision: https://phabricator.services.mozilla.com/D190614
2023-10-10 19:18:38 +00:00
Jon Coppeard bccbf4cce2 Bug 1857730 - Relax nursery poisioning assertion r=sfink
The refactored assertions were actually slightly more strict that the original
ones and it turns out that we can pass start == end here.

Differential Revision: https://phabricator.services.mozilla.com/D190447
2023-10-10 15:05:55 +00:00
Emilio Cobos Álvarez 25c0d10932 Bug 1624819 - Remove TaskCategory and other quantum dom remnants. r=smaug,media-playback-reviewers,credential-management-reviewers,cookie-reviewers,places-reviewers,win-reviewers,valentin,mhowell,sgalich,alwu
Sorry this is not a particularly easy patch to review. But it should be
mostly straight-forward.

I kept Document::Dispatch mostly for convenience, but could be
cleaned-up too / changed by SchedulerGroup::Dispatch. Similarly maybe
that can just be NS_DispatchToMainThread if we add an NS_IsMainThread
check there or something (to preserve shutdown semantics).

Differential Revision: https://phabricator.services.mozilla.com/D190450
2023-10-10 08:51:12 +00:00
Butkovits Atila 1aa2f4362c Backed out changeset 8822469d696e (bug 1846893) for causing bustages at JSContext.h. CLOSED TREE 2023-10-09 17:43:02 +03:00
Tom Schuster 0dc1d31a2c Bug 1846893 - Add JSContext checks. r=mgaudet
Differential Revision: https://phabricator.services.mozilla.com/D185993
2023-10-09 14:13:29 +00:00
Jon Coppeard b428371be1 Bug 1832153 - Stop valgrind thinking zero-capacity slots allocations are leaked r=jandem
For objects with dynamic slots allocations, NativeObject::slots_ stores a
pointer that points just past the end of the slots header. For zero-capacity
allocations this pointer points outside the allocation itself.

Currently this causes valgrind to think that the slots allocation is leaked. To
fix this the patch adds an extra unused slot to zero capacity slots allocations
on valgrind builds only.

Differential Revision: https://phabricator.services.mozilla.com/D190274
2023-10-09 07:42:20 +00:00
Julian Seward cfe79a85ba Bug 1857001 - Enable TrapSite-placement checking for arm32. r=rhunt.
Bug 1846474 added a mechanism to detect incorrectly placed TrapSites.  This
was complete for x86_{32,64} and arm64, but was incomplete and disabled for
arm32.

This patch completes and enables support for arm32.  Most of the work --
instruction recognition for arm32 -- was already done in bug 1846474, so this
patch merely changes the return type of a few arm32 MacroAssembler routines
from `void` to `FaultingCodeOffset`, hence completing the required plumbing.

Differential Revision: https://phabricator.services.mozilla.com/D190148
2023-10-09 07:37:51 +00:00
Yury Delendik 0b1d2c2503 Bug 1856733 - [wasm] Include imported globals in init_expr validation. r=rhunt
Change validation logic and cleanup around DecodeConstantExpression.

Differential Revision: https://phabricator.services.mozilla.com/D190302
2023-10-07 00:05:52 +00:00
Jamie Nicol f119fb6127 Bug 1857507 - Don't use PROT_EXEC when mmapping jitdump files on Android. r=dpalmeiro
mmap with PROT_EXEC fails on some Android devices, and is not required
for simpleperf to function, so avoid using that flag on Android.

Depends on D190289

Differential Revision: https://phabricator.services.mozilla.com/D190290
2023-10-06 18:58:00 +00:00
Olli Pettay 62f8fe2f07 Bug 1857529 - Use longer timer value for AsyncFreeSnowWhite, r=mccr8
Differential Revision: https://phabricator.services.mozilla.com/D190295
2023-10-06 16:17:12 +00:00
Jan de Mooij 7988d54778 Bug 1857237 - Use the external string cache also for the inline string path. r=jonco
In `NewMaybeExternalString` we have a fast path for short Latin1 strings. This case is
very common.

Changing the cache to handle these too is very effective: the `lookupInline` method
has a hit rate of at least 90% on Speedometer 3.

Differential Revision: https://phabricator.services.mozilla.com/D190206
2023-10-06 11:27:49 +00:00
anonymous0000007 e32fc64068 Bug 1856243 - Scheduling.cpp: using mozilla::TimeStamp; r=sylvestre
Differential Revision: https://phabricator.services.mozilla.com/D190086
2023-10-06 09:17:06 +00:00
Jon Coppeard 334315689d Bug 1857218 - Part 6: Remove owner fields from individual store buffers r=sfink
We can refactor this so we don't need to store a back pointer to the owning
StoreBuffer in all the individual buffers.

Differential Revision: https://phabricator.services.mozilla.com/D190194
2023-10-06 08:36:55 +00:00
Jon Coppeard fcfa1a036f Bug 1857218 - Part 5: Change NurseryChunk::poisonRange to take end offset rather than size r=sfink
In every caller it's simpler to pass in the end offset rather than the size.

Differential Revision: https://phabricator.services.mozilla.com/D190193
2023-10-06 08:36:55 +00:00
Jon Coppeard ea4585ae48 Bug 1857218 - Part 4: Rename Nursery::setCurrentChunk() r=sfink
This renames setCurrentChunk to moveToStartOfChunk to make it clearer what's happening.

Differential Revision: https://phabricator.services.mozilla.com/D190192
2023-10-06 08:36:54 +00:00
Jon Coppeard 34ef5d5f01 Bug 1857218 - Part 3: Rename Nursery::setStartPosition() r=sfink
Reading this code I found I did not know what the position the start was being
set to. The patch renames this to make it clear that it's being set to the
current position.

Differential Revision: https://phabricator.services.mozilla.com/D190191
2023-10-06 08:36:54 +00:00
Jon Coppeard 551493433a Bug 1857218 - Part 2: Remove Nursery::spaceToEnd() r=sfink
This is only used by Nursery::committed() which can be simplified by
implementing it another way.

Differential Revision: https://phabricator.services.mozilla.com/D190190
2023-10-06 08:36:53 +00:00
Jon Coppeard 65f97c15d8 Bug 1857218 - Part 1: Rename Nursery::currentStartChunk_ and currentStartPosition_ r=sfink
These members specify the start of the nursery (usually they are zero, but can
be different in generational zeal mode). They are constant between collections.

Calling them 'current' implies that they change often and this could lead to
confusion with currentChunk, which does change between collections. It's
simpler to remove the 'current'.

Differential Revision: https://phabricator.services.mozilla.com/D190189
2023-10-06 08:36:53 +00:00
Steve Fink 3ab7874b7d Bug 1857099 - Make JSDependentString::new_() always return a dependent string. r=jandem
This is a pure refactoring that just moves the inline string logic out into NewDependentString so that all *String::new_ creation functions are low-level and return a string of the class they are called on.

Differential Revision: https://phabricator.services.mozilla.com/D190127
2023-10-06 00:35:55 +00:00
Olli Pettay 1708a8a34d Bug 1856577 - Consider to trigger minor GC before a page load, r=jonco
This doesn't cover all the page loads, need to run some more performance tests before using this everywhere.

Depends on D189917

Differential Revision: https://phabricator.services.mozilla.com/D189918
2023-10-05 18:11:36 +00:00
Emilio Cobos Álvarez 3f833f02dd Bug 1855074 - Avoid some string copies in WebIDL/XPCOM->JS string conversion. r=edgar
We can convert strings to jsval without mutating the string nowadays.
Make that efficient.

Differential Revision: https://phabricator.services.mozilla.com/D189171
2023-10-05 17:16:28 +00:00
Matthew Gaudet 018423f60b No Bug - Fix spelling error 'detatched' r=allstarschh DONTBUILD
Depends on D190114

Differential Revision: https://phabricator.services.mozilla.com/D190115
2023-10-05 14:16:47 +00:00
Jan de Mooij fbb6831612 Bug 1856910 part 2 - Call EqualChars directly in jit::StringsEqual. r=iain
This bypasses some checks that are redundant with the fast paths all callers use in JIT code.

Differential Revision: https://phabricator.services.mozilla.com/D190020
2023-10-05 11:40:10 +00:00
Jan de Mooij 745949f4a1 Bug 1856910 part 1 - Check for atoms in js::EqualSrings. r=iain
This matches the fast path we have in JIT code.

Differential Revision: https://phabricator.services.mozilla.com/D190019
2023-10-05 11:40:09 +00:00
Jon Coppeard fd0ea3e684 Bug 1856739 - Remove assertion that dependent strings do not have a permanent atom as a base r=sfink
This assertion is unnecessary and doesn't hold. It was added to replace a check
for permanent atoms which is now handled by the mark check, since permanent
atoms are now always marked.

Differential Revision: https://phabricator.services.mozilla.com/D190021
2023-10-04 17:41:30 +00:00
Steve Fink f31f183e6a Bug 1854929 - JS::EnsureNonInlineArrayBufferOrView should not crash if given wrong type r=spidermonkey-reviewers,mgaudet
Differential Revision: https://phabricator.services.mozilla.com/D190067
2023-10-04 17:34:47 +00:00
Vinny Diehl 1326cc854c Bug 1854214 - Add tests for getRealmConfiguration and getBuildConfiguration r=mgaudet
Differential Revision: https://phabricator.services.mozilla.com/D189037
2023-10-04 16:51:36 +00:00
Otto Länd d9236cfee8 Bug 1839396: apply code formatting via Lando
# ignore-this-changeset
2023-10-04 15:22:47 +00:00
Nicolas B. Pierron 7f01a1efbb Bug 1839396 part 20 - Rename Sprinter to StringPrinter and create 2 variants. r=sfink
In the previous patches, Sprinter was given the ability to generate JS strings,
in order to avoid some of the use case where Sprinter allocated a buffer, just
to see it being copied once more to make a JSString out of the generated
content. Except that when compiling against jemalloc, we allocate JSString in a
different arena than the default one.

This patch is a follow up, which rename Sprinter to StringPrinter and create 2
variants named Sprinter (String allocation) and JSSprinter (JSString
allocation).

In addition to the renaming, we can now specialize the JSSprinter to use the
StringBufferArena as well as enforcing the use of a JSContext and the reporting
of out-of-memory. As opposed to the Sprinter interface which keeps the old
flexibility.

Differential Revision: https://phabricator.services.mozilla.com/D189150
2023-10-04 15:18:21 +00:00
Nicolas B. Pierron b9f2484212 Bug 1839396 part 19 - Add documentation to GenericPrinter classes. r=mgaudet
Differential Revision: https://phabricator.services.mozilla.com/D183761
2023-10-04 15:18:21 +00:00
Nicolas B. Pierron 5046f10666 Bug 1839396 part 18 - Remove GenericPrinter::putAsciiPrintable. r=mgaudet
`putAsciiPrintable` was added temporarily as a substitute for externalizing the
logic done by `QuoteString`, while providing an interface which is as efficient.

Now, `EscapePrinter` is used to replace the content of `QuoteString` while
providing the same implementation, except that it is based on `put` instead of
`putAsciiPrintable`. The `EscapePrinter` already provides the guarantees that
are asserted by `putAsciiPrintable`, thus there is no longer any need for it.

As this patch set introduced `putAsciiPrintable`, there is not yet any external
consumer of it, and `EscapePrinter` should cover all use cases where non-ascii
inputs are provided.

Differential Revision: https://phabricator.services.mozilla.com/D183760
2023-10-04 15:18:20 +00:00
Nicolas B. Pierron 74af1d594a Bug 1839396 part 17 - Make QuoteString and JSONQuoteString infallible. r=mgaudet
The previous patch reimplemented QuoteString to use a `StringSegmentRange`,
which should avoid mutating the inner parts of `JSRope`, while remaining fast on
`JSAtom`-s.

As the StringSegmentRange does not need to allocate with `ensureLinear`, then
all the failures are reported by the `put` functions using the `GenericPrinter`
mechanism, and the `release` functions of `Sprinter` would report the failure if
any.

Thus, there is no need for retuning a boolean value anymore from `QuoteString`
and `JSONQuoteString`, while this is still necessary to check the returned value
variant of `QuoteString` which returns `UniqueChars` by using the `release`
function of `Sprinter`.

Differential Revision: https://phabricator.services.mozilla.com/D183759
2023-10-04 15:18:20 +00:00
Nicolas B. Pierron 580dad9063 Bug 1839396 part 16.2 - GenericPrinter::putString: Handle StringSegmentRange failures. r=arai
When reporting failure, we have to prevent continuation iterating over the
string segments, and stop early, as well as not ignoring the errors.

Differential Revision: https://phabricator.services.mozilla.com/D188248
2023-10-04 15:18:19 +00:00
Nicolas B. Pierron 6364f2f305 Bug 1839396 part 16.1 - Reimplement QuoteString using EscapePrinter. r=arai,mgaudet
`QuoteString` is today only available as a mean to serialize a `JSString` to a
`Sprinter`, or by making an extra temporary allocation whch is most likely
discarded once the serialized content has been used once.

This implementation provide a generic escaping mechanism, named `EscapePrinter`,
which can be used on top of any existing Printer class, and with any escaping
logic such as different quotes, or different quotation marks if needed. The
different quoting strategies are implemented using a class which provides
`isSafeChar` and `convertInto` to normalize the `JSString` input characters into
characters which are properly encoded for the Printer.

This change keep the original `QuoteString` behavior, while replacing its
fallible implementation by an infallible implementation. `QuoteString` had an
undocummented side-effect of linearizing the strings while reading them, which
causes memory allocation and potential GC failures. This change replaces the
`ensureLinear` call by the new `GenericPrinter::putString` function which relies
on `StringSegmentRange` to iterate over the string fragments and serialize the
content which does not have the same side-effects.

If performance issue arise from this modification, calls to `ensureLinear`
should be added before the `QuoteString` calls.

Differential Revision: https://phabricator.services.mozilla.com/D183758
2023-10-04 15:18:19 +00:00
Nicolas B. Pierron 8258cb18d0 Bug 1839396 part 16.0 - Add JSContext* argument to Sprinter::putString. r=mgaudet
`putString` requires a JSContext, and it is taken out of Sprinter, which does
not make much sense. Making it explicit that a JSContext is required to print
JSString would make things simpler for users instead of failing during the
execution.

Differential Revision: https://phabricator.services.mozilla.com/D187202
2023-10-04 15:18:19 +00:00
Nicolas B. Pierron 1b29435e30 Bug 1839396 part 15 - Replace Sprinter::jsprintf. r=mgaudet
Sprinter::jsprintf is nowadays the same as GenericPrinter::printf which Sprinter
inherit from. This patch removes all calls to Sprinter::jsprintf and replaces
them by Sprinter::printf.

The advantage of using GenericPrinter::printf is that this reduce the dependency
on Sprinter-specific interface and moves us toward being able to move more
consumers over to the GenericPrinter.

Differential Revision: https://phabricator.services.mozilla.com/D181500
2023-10-04 15:18:18 +00:00
Nicolas B. Pierron ab23000ed9 Bug 1839396 part 14 - GC: Bubble-up infallible print functions. r=jonco
Now that Sprinter::put and Sprinter::jsprintf functions are infallible, there is
no need to return a boolean from Nursery::printProfileDurations and
Statistics::printProfileTimes functions.

Differential Revision: https://phabricator.services.mozilla.com/D181499
2023-10-04 15:18:18 +00:00
Nicolas B. Pierron 365fb4c12c Bug 1839396 part 13 - Convert GenericPrinter::put to be infallible. r=mgaudet
Remove the boolean returned value of printing functions of the GenericPrinter
and all descendant classes.

The goal being that error checking is the responsibility of the wrapping
function in charge of the GenericPrinter, and that functions in charge of
providing content should assume that everything is always written successfully.

This patch only look at the GenericPrinter methods, consumers of these functions
would be updated in subsequent patches.

Differential Revision: https://phabricator.services.mozilla.com/D181498
2023-10-04 15:18:17 +00:00
Nicolas B. Pierron 83f0b6e8e1 Bug 1839396 part 12 - Make Fprinter / LSPrinter short-circuit on previous errors. r=mgaudet
As we are going to remove the returned value, and to be extra cautious, we skip
future re-entry in case of previous failures.

Differential Revision: https://phabricator.services.mozilla.com/D181497
2023-10-04 15:18:17 +00:00
Nicolas B. Pierron 2e66bd47c0 Bug 1839396 part 11 - Make Sprinter put functions infallible. r=mgaudet
As functions are made infallible, only the 2 release functions are reporting
errors. The advantage of this approach is that the error reporting and checking
would only happen in the release functions calls in the future.  This enables
the upcoming set of patches to change the return type of put functions to make
them infallible, reduce the number of visible branches in debugging code.

This makes the Sprinter class more like a "Sink allocator", where the smell of
allocation failures does not propagate immediatly through the sinking water until
all the water has been through.

Differential Revision: https://phabricator.services.mozilla.com/D181496
2023-10-04 15:18:16 +00:00
Nicolas B. Pierron 3e655b8954 Bug 1839396 part 10 - Replace Sprinter::string by Sprinter::release. r=mgaudet
When using Sprinter::string, one assumes that out-of-memory errors have been
reported earlier. As the code is being converted to be infallible, the
out-of-memory is thus needed when the release function is called. This change
replaces all Sprinter::string by Sprinter::release and explicit the error
checking code path which would be relevant when the Sprinter::put function would
become infallible in follow-up patches.

Differential Revision: https://phabricator.services.mozilla.com/D181495
2023-10-04 15:18:16 +00:00
Nicolas B. Pierron 2bb0a61131 Bug 1839396 part 9 - Add Sprinter::releaseJS. r=mgaudet
Sprinter::releaseJS centralize a mechanism which used in many places across the
JS engine, and replaces it with a single function call as well as democratising
the proper handling of UTF8 which might be added to Sprinter allocated strings.

Differential Revision: https://phabricator.services.mozilla.com/D181494
2023-10-04 15:18:15 +00:00
Nicolas B. Pierron 0db6013480 Bug 1839396 part 8 - Remove Sprinter::operator[]. r=mgaudet
Differential Revision: https://phabricator.services.mozilla.com/D181493
2023-10-04 15:18:15 +00:00
Nicolas B. Pierron 14aecdbac6 Bug 1839396 part 7 - Update Sprinter::put to remove stringAt usage. r=mgaudet
Differential Revision: https://phabricator.services.mozilla.com/D181492
2023-10-04 15:18:15 +00:00
Nicolas B. Pierron d1d5faa63b Bug 1839396 part 6 - Add Sprinter::length. r=mgaudet
Differential Revision: https://phabricator.services.mozilla.com/D181491
2023-10-04 15:18:14 +00:00
Nicolas B. Pierron 30f3d15e9e Bug 1839396 part 5 - Move GenericPrinter::flush after print/put functions. r=mgaudet
Differential Revision: https://phabricator.services.mozilla.com/D181490
2023-10-04 15:18:14 +00:00
Nicolas B. Pierron f47981dfaa Bug 1839396 part 4 - ExpressionDecompiler::getOutput reuse Sprinter allocation. r=arai
Sprinter already create strings, and the ExpressionDecompiler duplicates this
logic to copy the content of the Sprinter buffer. While there is a benefit in
case we over-allocated ahead using Sprinter, this should still reduce the peak
memory allocation.

Differential Revision: https://phabricator.services.mozilla.com/D181489
2023-10-04 15:18:13 +00:00
Nicolas B. Pierron efdc203e4d Bug 1839396 part 3 - Extract Sprinter::putAsciiPrintable with mozilla::Span. r=mgaudet
QuoteString is currently specialized with a Sprinter argument, but to do that it
relies on the `operator[]`, which implies being able to read the bytes. While
there is no issue today, this goes against making the *Printers infallible.

Thus, this change moves the append logic to a dedicated `putAsciiPrintable`,
removing the `getOffset()` and `operator[]` usage from `QuoteString`.

Differential Revision: https://phabricator.services.mozilla.com/D181488
2023-10-04 15:18:13 +00:00
Nicolas B. Pierron 4915ed8e3e Bug 1839396 part 2 - GenericPrinter: avoid double exception report. r=mgaudet
The `GenericPrinterPrintTarget` uses the same `GenericPrinter`, which already
handles the out-of-memory reporting. Thus, there is no need to report it once
more in `GenericPrinter::vprintf`.

Differential Revision: https://phabricator.services.mozilla.com/D181487
2023-10-04 15:18:12 +00:00