Commit graph

862 commits

Author SHA1 Message Date
Doug Thayer
c860b29212 Bug 1828496 - Replace PropertyName* with PropertyKey for megamorphic accessor ops r=iain
Differential Revision: https://phabricator.services.mozilla.com/D175678
2023-04-27 18:10:05 +00:00
Doug Thayer
8e80085dab Bug 1827338 - Grow slots from MegamorphicSetElement's cache path r=iain
This does get a bit hairy, and I am curious if there is a better way to manage
the registers. See the comment in MacroAssembler.cpp.

Differential Revision: https://phabricator.services.mozilla.com/D175096
2023-04-14 21:21:03 +00:00
Doug Thayer
bd05a00ee4 Bug 1827338 - Avoid polluting MegamorphicSetPropCache from Baseline r=iain
Differential Revision: https://phabricator.services.mozilla.com/D175095
2023-04-14 21:21:03 +00:00
Jon Coppeard
b7672019c8 Bug 1827918 - Part 2: Move dynamic slot allocation out of GC allocation path r=jandem
This moves the dynamic slot allocation code that is currently duplicated
between nursery and tenured allocation paths into NativeObject instead.

Differential Revision: https://phabricator.services.mozilla.com/D175373
2023-04-14 09:38:40 +00:00
Jan de Mooij
4a9e8a0fca Bug 1811310 part 2 - Use TaggedSlotOffset for megamorphic setprop cache too. r=dthayer
Probably either neutral on Speedometer or a tiny improvement on some subtests.

Differential Revision: https://phabricator.services.mozilla.com/D172100
2023-03-10 07:54:00 +00:00
Jan de Mooij
00ea1649b5 Bug 1811310 - Cache isFixedSlot in MegamorphicCacheEntry. r=dthayer
This makes our JIT code for the megamorphic cache lookup a bit more compact by
caching the slot's offset + `isFixedSlot` flag in a single 32-bit value.

This improves some local micro-benchmarks a bit, but it's hard to see an improvement
on Speedometer. Maybe it improves some of the subtests a tiny bit and combined with
the shorter and simpler JIT code that might be good enough.

It's possible to go further and combine the load instruction for fixed vs dynamic,
and to replace the `isFixedSlot` branch with a CMOV instruction, but that seemed to
be a bit harder on the CPU (the branch is probably quite predictable in practice)
so this is the more conservative approach.

Differential Revision: https://phabricator.services.mozilla.com/D171532
2023-03-05 14:09:31 +00:00
Iain Ireland
7a8fa7d365 Bug 1799023: Add AssertPropertyLookup r=jandem
To avoid slowing debug builds down too much, I'm currently only turning this on in baseline.

Differential Revision: https://phabricator.services.mozilla.com/D171523
2023-03-04 00:58:24 +00:00
Norisz Fay
40b60faa5e Backed out 5 changesets (bug 1799023) for causing SM bustages on VMFunctions.cpp CLOSED TREE
Backed out changeset 56f65b56a14d (bug 1799023)
Backed out changeset 0565f6b81c8d (bug 1799023)
Backed out changeset ae0512a7262c (bug 1799023)
Backed out changeset aca07fd972df (bug 1799023)
Backed out changeset 673700951b68 (bug 1799023)
2023-03-04 01:56:45 +02:00
Iain Ireland
0881d812b1 Bug 1799023: Add AssertPropertyLookup r=jandem
To avoid slowing debug builds down too much, I'm currently only turning this on in baseline.

Differential Revision: https://phabricator.services.mozilla.com/D171523
2023-03-03 23:38:53 +00:00
Doug Thayer
27b36d50a8 Bug 1816981 - Inline baseline megamorphic cache lookups r=jandem
So, this patch is a few things in one. The core idea is that we want to inline
megamorphic gets in Baseline, following the success of doing so in Ion.
However, Baseline misses the cache more often than Ion, so any extra costs
which are only incurred on cache miss are going to be more of an issue there.
Accordingly, this patch eliminates most of the overhead of inlining the cache
lookup by passing the cache entry pointer through the ABI call on miss,
allowing the C++ code to forgo the lookup.

Differential Revision: https://phabricator.services.mozilla.com/D169961
2023-03-01 00:51:43 +00:00
Jon Coppeard
928e672d3a Bug 1814928 - Add a single element cache in front of the whole cell buffer for use from JIT code r=jandem
This patch reduces the time taken by the workload in bug 1814796 by about 10%.

This only checks the cache when called from optimised code. I didn't add the
check for baseline or cache IR.

Differential Revision: https://phabricator.services.mozilla.com/D168825
2023-02-06 14:08:53 +00:00
Doug Thayer
d05d1a3ef5 Bug 1809359 - Inline SetElementMegamorphic r=jandem
Differential Revision: https://phabricator.services.mozilla.com/D166401
2023-01-19 23:53:40 +00:00
Jan de Mooij
b81f9832e3 Bug 1703508 part 3 - Replace TypedArrayObject::maxByteLength() with MaxByteLength constant. r=rhunt
Depends on D165028

Differential Revision: https://phabricator.services.mozilla.com/D165029
2022-12-21 09:25:24 +00:00
Jan de Mooij
326592ff60 Bug 1804253 part 3 - Add NativeShape base class. r=jonco
The `Shape` methods related to property information and number of fixed slots are
moved into `NativeShape`, to improve type safety.

Differential Revision: https://phabricator.services.mozilla.com/D164213
2022-12-13 10:58:29 +00:00
André Bargull
a0e9b710fc Bug 1669942: Add CacheIR op to linearise strings for char-accesses. r=jandem
We can't inline `String.prototype.charAt` and `String.prototype.charCodeAt` in a
couple of JetStream tests because the input is a nested rope.

Before this change, we can observe the following number of non-inlined calls to
these functions:

crypto
  String.prototype.charCodeAt 360'000

pdfjs
  String.prototype.charCodeAt 21'910'000

typescript
  String.prototype.charCodeAt 17'840'000

base64-SP
  String.prototype.charCodeAt 39'300'000

crypto-md5-SP
  String.prototype.charCodeAt 41'750'000

crypto-sha1-SP
  String.prototype.charCodeAt 30'180'000

acorn-wtb
  String.prototype.charCodeAt 3'370'000

jshint-wtb
  String.prototype.charAt 2'450'000
  String.prototype.charCodeAt 200'000

uglify-js-wtb
  String.prototype.charAt 450'000


After this change, only the WBT sub-benchmarks still have non-inlined calls:

acorn-wtb
  String.prototype.charCodeAt 1'150'000

jshint-wtb
  String.prototype.charAt 2'450'000
  String.prototype.charCodeAt 200'000

uglify-js-wtb
  String.prototype.charAt 450'000

Differential Revision: https://phabricator.services.mozilla.com/D162726
2022-12-01 14:33:24 +00:00
Iain Ireland
269d1ff77d Bug 1797486: Align visitOutOfLineStoreElementHole with CacheIR implementation r=jandem,nbp
The existing implementation of StoreElementHole could handle indices > length, but we never actually used that path, because the corresponding code in `CacheIRCompiler::emitStoreDenseElementHole` only handles the index == initLength case (where we are adding one past the end). By aligning the Ion code more closely with the CacheIr implementation, we can remove some complexity. In particular, bailing out when index != length handles negative indices for free, which lets us remove the `needsNegativeIntCheck` code.

Differential Revision: https://phabricator.services.mozilla.com/D163280
2022-11-30 07:26:17 +00:00
Doug Thayer
5fb5ca9039 Bug 1798365 - Fold MMegamorphicLoadSlotByValue where possible r=jandem
This was showing up in the constant symbol lookup in isConcatSpreadable in
matrix-react-bench.

Differential Revision: https://phabricator.services.mozilla.com/D160821
2022-11-03 14:21:19 +00:00
Iain Ireland
0df6469cf1 Bug 1791893: Initialize entry to nullptr r=nbp
In addition to appeasing Coverity, this also fixes the `MOZ_ASSERT_IF(JitOptions.enableWatchtowerMegamorphic, entry)` in `GetNativeDataPropertyPureFallback`, which clearly expects `entry` to be null if megamorphic watchtower is disabled.

Differential Revision: https://phabricator.services.mozilla.com/D158855
2022-10-07 17:42:09 +00:00
Doug Thayer
cc6395c43d Bug 1789457 - Inline megamorphic cache lookup in Ion r=jandem
This inlines the megamorphic cache lookup, netting us about a 30-40%
improvement for the microbenchmark on top of the prior optimizations. There is
no measured performance losses for speedometer or matrix-react, and maybe a
1% win overall, though I need to do more runs with the cleaned up patch to be
confident.

We could do similar inlining for the CacheIRCompiler version and for
MegamorphicLoadSlotByValue - however, we wouldn't be able to include the id and
id hash as immediates, which would mean we'd need another register and several
more instructions to make it work, and it would be awkward to share the masm
code because of the different register requirements.

Differential Revision: https://phabricator.services.mozilla.com/D156615
2022-09-19 20:07:53 +00:00
Doug Thayer
85a73ad9eb Bug 1789457 - Move NativeObject check after cache lookup r=jandem
Initially we explored caching this check on the shape, which still seems like
a decent idea. However, we can also just sidestep the problem for the most part
be moving the check after the cache lookup, since we can't get a cache hit if
it's not a NativeObject anyway, and we're hoping that a cache hit should be the
dominant path in most cases.

Differential Revision: https://phabricator.services.mozilla.com/D156614
2022-09-19 20:07:53 +00:00
André Bargull
8aa045d5de Bug 1791162 - Part 2: Bail out from ArrayPush when we can't add a dense element. r=jandem
Similar to part 1, also prefer a bailout for ArrayPush.

Differential Revision: https://phabricator.services.mozilla.com/D157549
2022-09-19 16:53:35 +00:00
André Bargull
c7cfddbfe5 Bug 1791162 - Part 1: Bail out from SetDenseElement when we can't add a dense element. r=jandem
Use a bailout instead of calling `DefineDataElement`. This won't lead to
performance issues, because calling `DefineDataElement` will add an indexed
property and indexed properties will cause shape guards to fail the next time
this operation is called.

That means we can also change the function to an ABI call, which is slightly
faster than a VM call. We need additional temp registers for the ABI call,
therefore change the Spectre-temp to a normal, unconditional temp register.

Differential Revision: https://phabricator.services.mozilla.com/D157548
2022-09-19 16:53:35 +00:00
Jan de Mooij
bba5141ddc Bug 1790791 part 3 - Add a fast path for megamorphic set/add on plain objects. r=iain
More than 94% of calls to `SetElementMegamorphic` on matrix-react-bench, Speedometer 2,
and a number of popular websites can be optimized with this fast path.

This makes a micro-benchmark 1.72x faster and should eliminate most of the overhead,
but we could potentially optimize this more in the future with the megamorphic
cache.

Depends on D157331

Differential Revision: https://phabricator.services.mozilla.com/D157332
2022-09-15 08:56:56 +00:00
Jan de Mooij
ba83a254e1 Bug 1790791 part 2 - Add js::jit::SetElementMegamorphic. r=iain
Depends on D157330

Differential Revision: https://phabricator.services.mozilla.com/D157331
2022-09-15 08:56:56 +00:00
André Bargull
bbdd254dcc Bug 1790543: Remove an overzealous assertion. r=jandem
The assertion also rejects (non-frozen) dense elements on the prototype chain,
even though those are actually allowed.

Differential Revision: https://phabricator.services.mozilla.com/D157190
2022-09-13 08:27:55 +00:00
André Bargull
93c6e48cfa Bug 1790275 - Part 5: Change ArrayPushDense to use [[Define]] instead of [[Set]] semantics. r=jandem
This is just nice to have at this point, but might make it a bit more clearer
what should happen when `setOrExtendDenseElements` returns `Incomplete`. For
example we don't want to execute a [[Set]] operation which might trigger
accessors on the prototype chain. (`array_push` uses [[Set]] internally.)

Depends on D157104

Differential Revision: https://phabricator.services.mozilla.com/D157105
2022-09-12 12:44:32 +00:00
André Bargull
c518b868d3 Bug 1790275 - Part 4: Remove no longer used "strict" flag from OutOfLineStoreElementHole. r=jandem
Depends on D157103

Differential Revision: https://phabricator.services.mozilla.com/D157104
2022-09-12 12:44:31 +00:00
André Bargull
c3ff5ca8e9 Bug 1790275 - Part 3: Change SetDenseElement to use [[Define]] instead of [[Set]] semantics. r=jandem
Define has the correct semantics whether or not this is a PropInit operation
and it helps to avoid reintroducing bug 1607443.

Depends on D157102

Differential Revision: https://phabricator.services.mozilla.com/D157103
2022-09-12 12:44:31 +00:00
André Bargull
e9b9710af2 Bug 1790275 - Part 2: Bailout for negative indices in StoreElementHole. r=jandem
This matches CacheIR more closely and might allow to re-add the alias set which was
removed in bug 1607443.

Depends on D157101

Differential Revision: https://phabricator.services.mozilla.com/D157102
2022-09-12 12:44:30 +00:00
André Bargull
6b8a0c6aa4 Bug 1341937 - Part 16: Remove extra barrier in CallObject::create ool-path. r=jandem
Depends on D156801

Differential Revision: https://phabricator.services.mozilla.com/D156802
2022-09-08 13:47:04 +00:00
André Bargull
90636aeb84 Bug 1341937 - Part 12: Remove CopyLexicalEnvironmentObject. r=jandem
No longer needed after the last two parts.

Differential Revision: https://phabricator.services.mozilla.com/D156788
2022-09-08 13:47:02 +00:00
Julian Seward
6333bc359a Bug 1785776 - Clean up WasmArrayObject and TypedObject logic following bug 1774836 (Part 3). r=rhunt.
Some non-functional, renaming-style cleanups:

* TypedObject has been consistently renamed to WasmGcObject, both as a class
  name and as file names.

* WasmGcObject.h (new name):
  - removed unused IsWasm{Struct,Array}ObjectClass()
  - removed unused JSObject::is<js::Wasm{Struct,Array}Object>()

* WasmGcObject.cpp (new name) has been re-sequenced to match its header file.

* TypedObject-inl.h has been removed.  Its one-and-only method
  ::allocKindForRttValue() has been moved back to the "standard" header
  (WasmGcObject.h).  The only use point for that method is from an
  expensive-looking method (caller) so there's no point in inlining it.  Can
  be reinstated later if profiling shows it is hot.

Differential Revision: https://phabricator.services.mozilla.com/D156045
2022-09-08 06:52:32 +00:00
Steve Fink
0d809970b9 Bug 1628014 - Add typed Cell::NewCell<T>() and cx->newCell<T>() methods r=jonco,tcampbell
Differential Revision: https://phabricator.services.mozilla.com/D135435
2022-08-25 23:26:53 +00:00
Steve Fink
876f784fce Bug 1746699 - Avoid UB when allocating JSStrings and BigInts r=tcampbell
Add emplace methods to JSString and BigInt types to reduce amount of C++
undefined-behaviour by running the constructor of the concrete derived type.
This is in contrast to previous behaviour of allocating a gc::Cell and then
simply casting to the final type. We still first allocate as a Cell from the GC
and then use placement-new to initialize as the correct type.

Differential Revision: https://phabricator.services.mozilla.com/D134095
2022-08-25 23:26:51 +00:00
André Bargull
9e0da95d46 Bug 1786471 - Part 1: Remove unnecessary includes in js/src/vm. r=jonco
This one was extra tricky, because removing includes from header files in
"js/src/vm" often leads to build errors in other files due to missing header
files which were previously only transitively included.

Differential Revision: https://phabricator.services.mozilla.com/D155342
2022-08-23 13:48:30 +00:00
criss
dada96c730 Backed out 3 changesets (bug 1786471) for causing SM failures on jsrtfuzzing.cpp . CLOSED TREE
Backed out changeset 64c823e0df9c (bug 1786471)
Backed out changeset 5723d1994900 (bug 1786471)
Backed out changeset 53910f7dd1f8 (bug 1786471)
2022-08-23 13:08:50 +03:00
André Bargull
8bb4ce1b5d Bug 1786471 - Part 1: Remove unnecessary includes in js/src/vm. r=jonco
This one was extra tricky, because removing includes from header files in
"js/src/vm" often leads to build errors in other files due to missing header
files which were previously only transitively included.

Differential Revision: https://phabricator.services.mozilla.com/D155342
2022-08-23 09:38:02 +00:00
Tooru Fujisawa
287c234f6b Bug 1781641 - Add JS::NativeStackBase, JS::NativeStackSize, and JS::NativeStackLimit. r=bthrall
Depends on D152783

Differential Revision: https://phabricator.services.mozilla.com/D152854
2022-07-30 04:45:22 +00:00
Matthew Gaudet
6b6c723297 Bug 1777529 - Remove TraceLogger headers where no longer needed. r=jandem
Differential Revision: https://phabricator.services.mozilla.com/D150781
2022-07-13 15:26:53 +00:00
Matthew Gaudet
e8e5f5c407 Bug 1777529 - Remove TraceLogger event handling r=jandem
Differential Revision: https://phabricator.services.mozilla.com/D150780
2022-07-13 15:26:52 +00:00
Jan de Mooij
ba8e631b26 Bug 1772824 - Don't use the megamorphic cache for GetBoundName. r=iain
Differential Revision: https://phabricator.services.mozilla.com/D150097
2022-06-24 10:54:30 +00:00
Jan de Mooij
ef28bcca07 Bug 1775422 part 2 - Split JitFrameLayout::argv in actualArgs and thisAndActualArgs. r=iain
The `argv` method on `BaselineFrame` does not include `this`, but the one on `JitFrameLayout` does.
We can be a bit more explicit about this.

Depends on D149962

Differential Revision: https://phabricator.services.mozilla.com/D149963
2022-06-23 07:57:45 +00:00
Jan de Mooij
dea42a526c Bug 1774390 part 1 - Use separate ExitFrameType for EnsureBareExitFrame. r=iain
This will be used by a later patch, but it's also nice for assertions to use
a different type.

Differential Revision: https://phabricator.services.mozilla.com/D149376
2022-06-16 12:59:16 +00:00
Bogdan Szekely
c078765353 Backed out 4 changesets (bug 1774390) for causing assertion failures on Trampoline-x64.cpp CLOSED TREE
Backed out changeset bdfcc8363de5 (bug 1774390)
Backed out changeset 6072f76850e7 (bug 1774390)
Backed out changeset e1792844b5b1 (bug 1774390)
Backed out changeset 45576a2dc383 (bug 1774390)
2022-06-16 14:02:00 +03:00
Jan de Mooij
6490c6b3d1 Bug 1774390 part 1 - Use separate ExitFrameType for EnsureBareExitFrame. r=iain
This will be used by a later patch, but it's also nice for assertions to use
a different type.

Differential Revision: https://phabricator.services.mozilla.com/D149376
2022-06-16 08:09:05 +00:00
Ted Campbell
8a74036a4f Bug 1773368 - Remove deprecated internal typedefs for string-related types. r=iain
Differential Revision: https://phabricator.services.mozilla.com/D148955
2022-06-13 17:09:46 +00:00
Ted Campbell
c2a92129aa Bug 1773368 - Remove deprecated typedefs for ArrayObject. r=iain
Differential Revision: https://phabricator.services.mozilla.com/D148822
2022-06-10 15:58:10 +00:00
Ted Campbell
5d2decc798 Bug 1773368 - Remove deprecated typedefs for NativeObject. r=iain
Differential Revision: https://phabricator.services.mozilla.com/D148821
2022-06-10 15:58:10 +00:00
Ted Campbell
b69ff4441c Bug 1773368 - Remove deprecated typedefs for PlainObject. r=iain
Differential Revision: https://phabricator.services.mozilla.com/D148820
2022-06-10 15:58:09 +00:00
Ted Campbell
6cae800ee4 Bug 1773368 - Remove deprecated typedefs for js::Scope. r=jandem
Differential Revision: https://phabricator.services.mozilla.com/D148817
2022-06-10 15:58:08 +00:00