100 Commits
Author SHA1 Message Date
Jakob Kummerow a6f1ecd6ff [wasm][sandbox] Check signature of inlining candidate
A corrupted sandbox might confuse the type feedback processor
into inlining the wrong function, so the inlining mechanism
should check to make sure the inlining candidate's signature
is compatible with the call.

Bug: 336507783
Change-Id: I5fb99b7894f060a2bcc754349175e2570b5a6045
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5621153
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Reviewed-by: Matthias Liedtke <mliedtke@chromium.org>
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/main@{#94386}
2024-06-12 08:05:55 +00:00
Jakob Kummerow e25efe6cf2 [wasm][sandbox] Verify signatures in js-to-wasm wrappers
This ports the recently introduced signature verification from
call_ref to compiled (i.e. non-generic) js-to-wasm wrappers, to
prevent escaping from a corrupted sandbox by calling broken Wasm
functions from JS.

Bug: 336507783
Change-Id: I2946424b39ca345ab6f6d31ad8308327cd5be1e5
Fixed: 336009921
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5622490
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Thibaud Michaud <thibaudm@chromium.org>
Cr-Commit-Position: refs/heads/main@{#94382}
2024-06-11 17:35:02 +00:00
Jakob Kummerow 2b431212d6 [wasm] Increase maximum number of canonicalized types
By no longer encoding canonicalized types in {ValueType}s,
we can support more of them.

Change-Id: I0bdb0a3319e422dad76d7a0bbd03001d25346690
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5615591
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/main@{#94368}
2024-06-11 11:49:18 +00:00
Jakob Kummerow 422cdc5edd [wasm] Enforce maximum number of canonicalized types
Storing canonical indices in ValueTypes doesn't work well if the
canonical index is too large.

Fixed: 344608204
Change-Id: I0b0746f1e9f1ce106150115dbcf9459fa90037b0
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5604265
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/main@{#94294}
2024-06-06 17:28:35 +00:00
Jakob Kummerow 47ac44d6c9 [wasm][sandbox] Verify signatures for call_ref
To prevent sandbox escapes, this adds signature verification to each
call_ref / return_call_ref instruction. In-sandbox corruption could
modify funcrefs, but with these checks that cannot lead to tagged vs.
untagged type confusion in the callee.
Since part of the work happens in a builtin, there is no runtime flag
to disable the feature.

Bug: 336507783
Change-Id: Icb463973c3acb3595e920cac453e59303d749b00
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5577681
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Reviewed-by: Matthias Liedtke <mliedtke@chromium.org>
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/main@{#94267}
2024-06-05 14:05:57 +00:00
Jakob Kummerow 0713cd9bf7 [wami] --mjsunit: support self-referential types
And mutually recursive types too.

Change-Id: Idc89c16f5d83b605462115b498600a9a09225afd
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5600338
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Matthias Liedtke <mliedtke@chromium.org>
Cr-Commit-Position: refs/heads/main@{#94263}
2024-06-05 13:22:39 +00:00
Jakob Kummerow 910cb91733 [wasm][liftoff][arm64] Fix DropExceptionValueAtOffset
We cannot exit the iteration early, we must update all entries
in the cache state.

Fixed: 343748812
Change-Id: I8353acb7bd0edc4b979db92e44d24cb9028fd92b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5596273
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/main@{#94244}
2024-06-04 15:44:00 +00:00
Jakob Kummerow ef731a7bf8 [wasm] Make --wasm-eager-tier-up-function more robust
Handle OOB values gracefully (by ignoring them).
No impact on production behavior.

Fixed: 344359523
Change-Id: Ifc0f9736fcc8a098211e5bade43339aea98c7701
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5596551
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Samuel Groß <saelo@chromium.org>
Cr-Commit-Position: refs/heads/main@{#94232}
2024-06-04 12:34:11 +00:00
Jakob Kummerow 8dc0701804 [turboshaft] Phis with protected-load inputs can't be compressed
When a Phi has an input that's a load of a ProtectedPointer, we must not
choose compressed representation for this Phi, because we can't restore
its uncompressed value by using the heap cage base.

Fixed: 343035068
Change-Id: I9b6c13f446ec254b426fd905d4aa58436cc2ed74
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5592473
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Darius Mercadier <dmercadier@chromium.org>
Reviewed-by: Darius Mercadier <dmercadier@chromium.org>
Cr-Commit-Position: refs/heads/main@{#94213}
2024-06-03 14:48:05 +00:00
Jakob Kummerow 59399c8562 [wasm][liftoff][arm64] Fix PrepareTailCall
Both available temp registers are already in use, so we must
carefully arrange instructions to not require additional temp
registers under the MacroAssembler's hood.

Fixed: 343633071
Change-Id: Ie7dffbb2eacbcc641dfd050aaf2f3b36ecfb15c0
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5591671
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Daniel Lehmann <dlehmann@chromium.org>
Commit-Queue: Daniel Lehmann <dlehmann@chromium.org>
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/main@{#94201}
2024-06-03 11:01:21 +00:00
Jakob Kummerow b2df50672c [wasm] Reorder return values by taggedness
This patch introduces reordering of return values into an untagged
and a tagged block, just like what we already do for parameters.
This is a prerequisite for efficient signature verification: it
allows us to compare the sizes of these blocks, instead of needing
large bit maps to store each return value's taggedness.

Bug: 336507783
Change-Id: Ic6ea16e3fad333068d2e087bb1e9e4ad1f944667
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5580042
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/main@{#94159}
2024-05-29 15:06:33 +00:00
Jakob Kummerow f6287729bb [gm.py] Auto-replace deprecated rbe_cfg_dir option
"rbe_cfg_dir" is replaced by "reclient_cfg_dir".
This fixes a GN warning.

No-Try: true
Change-Id: I7e84cb69460e30027a14b08f1a8703d017a28cbc
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5580354
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Matthias Liedtke <mliedtke@chromium.org>
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Cr-Commit-Position: refs/heads/main@{#94151}
2024-05-29 10:23:37 +00:00
Jakob Kummerow ca6d6bdbbb [wasm][turbofan] kPure != kEliminatable
For some string-related operations, the difference between "kPure"
(=doesn't depend on effects) and "kEliminatable" (=does depend on
effects, hence cannot be rescheduled across control flow) matters.

No regression test because the only repro I know of turns into an
endless loop when the bug is fixed.

Fixed: 342197919
Change-Id: Id57771e3bbdf0c4e432b21effb31fb2a2e983262
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5569137
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Reviewed-by: Matthias Liedtke <mliedtke@chromium.org>
Cr-Commit-Position: refs/heads/main@{#94096}
2024-05-27 11:16:24 +00:00
Jakob Kummerow 10cc6be0d3 [wasm][simd][liftoff] Fix i32x4.dot_i8x16_i7x16_add_s
Liftoff register allocation needs to be more careful to avoid
aliasing, considering the complexity of the assembler backend
implementations for this operation.

Fixed: 341947685
Change-Id: Ia0369311c4c49735ab163c57998dc04cd71d0a40
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5563329
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Thibaud Michaud <thibaudm@chromium.org>
Reviewed-by: Thibaud Michaud <thibaudm@chromium.org>
Cr-Commit-Position: refs/heads/main@{#94068}
2024-05-24 10:15:12 +00:00
Jakob Kummerow 6a1f1b9afe [test] Speed up mjsunit/regress-708247
We only had a very slow reproducer for the original bug; after all
this time (seven years!), there's not much value in spending so much
time on this test in every run of the test suite.

Bug: 40087250
Change-Id: Ibc0cf40f8df4e44f5444cf399b9eea02293d77cb
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5547838
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93972}
2024-05-17 13:42:27 +00:00
Jakob Kummerow 8facb6f7ff [turbofan] Fix DCHECK in MapData for Wasm objects
Do not try to read `map->UnusedPropertyFields()` when the map
is a map for a Wasm struct/array.

Fixed: 339984212
Change-Id: I6ed2b04afbf485515ea520c1b7401e970c3e9a54
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5537985
Reviewed-by: Matthias Liedtke <mliedtke@chromium.org>
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93952}
2024-05-16 15:29:20 +00:00
Jakob Kummerow 3450db3674 [gm.py] Automatically delete goma_dir = entries
to avoid GN warnings about unrecognized options.
Also restore the functionality to migrate `use_goma` to `use_remoteexec`,
which was recently dropped accidentally.

No-Try: true
Change-Id: I32ef14d419d8f958062b109d0f476701d678f35d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5544140
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93951}
2024-05-16 14:48:04 +00:00
Jakob Kummerow bffd751b86 [maglev] String.fromCharCode: mask before one-byte check
String.fromCharCode silently masks the char_code value to 16 bits
before creating a string. Maglev was our only compiler that didn't
apply this mask *before* checking whether the value is in range for
cached one-byte strings, which caused it to e.g. return a freshly
allocated two-byte string for the input value 0x10000.
This was flushed out by Factory::NewCopiedSubstring making a slightly
brittle assumption that two-byte strings have underlying two-byte
FlatContents. This patch makes that code more robust as well.

Fixed: 339681888
Change-Id: If37f86d8f12c4a7286629ab1404577858435c605
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5538158
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Victor Gomes <victorgomes@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93948}
2024-05-16 12:43:48 +00:00
Jakob Kummerow bacbfe2c1f [turboshaft] Clean up representations.h
Two functions were unused, two were almost duplicates of each other,
and the recently introduced ProtectedPointer representation was
handled a bit inconsistently.
This patch isn't expected to change any observable behavior.

Bug: 42202729
Change-Id: Ia5c46b7503f4d2bdcceff3fbe92d9592895d7579
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5529247
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Darius Mercadier <dmercadier@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93916}
2024-05-15 12:04:46 +00:00
Jakob Kummerow a25e4c501c [wasm][sandbox] ExportedFunctionData: link to TrustedInstanceData
Replacing the WasmExportedFunctionData's pointer to an on-heap
WasmInstanceObject with a protected pointer to the corresponding
WasmTrustedInstanceData eliminates an easy way for in-sandbox
corruption to affect the coupling between these two objects.

Bug: 336507783
Change-Id: Iec3ce21ab5b39479a0413e72f77079595f1a69a4
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5535193
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Matthias Liedtke <mliedtke@chromium.org>
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93894}
2024-05-14 13:11:02 +00:00
Jakob Kummerow fe67713b2f Fix and clean up some JSObject::cast()
A few of these should account for the possibility of the object
not being a JSObject.
Some of them were simply redundant.

Change-Id: Ic4a57debb268be008e3336f354c3c080d580ddca
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5528004
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93843}
2024-05-13 07:07:23 +00:00
Jakob Kummerow 850eb545d1 [wasm][sandbox] Add WasmTrustedInstanceData::native_module
Giving the WasmTrustedInstanceData a trustworthy way to retrieve the
associated NativeModule (whereas the existing multi-hop pointer path
to it required going through potentially-corrupted heap objects).

Bug: 336507783
Change-Id: Iff2247d63f2f0668ac658198bbf0fd499836f7f0
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5529236
Reviewed-by: Matthias Liedtke <mliedtke@chromium.org>
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93831}
2024-05-10 14:35:47 +00:00
Jakob Kummerow 445ffee081 [wasm] Mark --wasm-lazy-validation as experimental
To avoid any confusion around VRP eligibility.
We currently have no plans to ship this feature, and don't care
to see it used as a load-bearing building block of submitted bug
reports.

Change-Id: I17b8c0f5b70d0c26747ba2750a51ff35c2618e50
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5518455
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93740}
2024-05-06 16:17:24 +00:00
Jakob Kummerow 3528936f95 [wasm][fuzzers] Fix --wasm-fuzzer-gen-test for invalid sig_index
When block types refer to nonexistent signature indices, just print
that raw index, rather than trying to get a name for it.

Bonus change: speed up a quadratically slow DCHECK in Turboshaft.

Fixed: 338071688
Change-Id: I0009f9f58c590fe99f20ba6a3fd858cae1bcccb4
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5510483
Reviewed-by: Matthias Liedtke <mliedtke@chromium.org>
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93685}
2024-05-02 16:18:20 +00:00
Jakob Kummerow 0f647b4d19 [wasm][liftoff] Fix overly strict DCHECK
The DCHECK added in crrev.com/c/4567490 didn't consider that we
also use floating-point registers for SIMD values.

Fixed: 337870524
Change-Id: Ia49c598fa850f38903a700b759873c1cce546dec
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5509656
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Matthias Liedtke <mliedtke@chromium.org>
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93681}
2024-05-02 14:33:13 +00:00
Jakob Kummerow 5942a14103 [wasm][sandbox] Fix sandbox escapes via i32 high word
In-sandbox corruption could cause i64 values to be passed to
functions expecting an i32. This patch unconditionally zeros
the high word of i32 register parameters to prevent that.

Bug: 334120897
Change-Id: Ia19925e5133b6c560ca8308fd84ae64ff0208b86
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5494364
Reviewed-by: Matthias Liedtke <mliedtke@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93680}
2024-05-02 13:15:29 +00:00
Jakob Kummerow 260f80b537 [wasm] --trace-turbo: fix UBSan report about nullptr
When processing empty names of imports/exports, the code currently
ends up doing `memcpy(nullptr, ..., 0)`, which is Undefined Behavior
because the `dst` argument must be non-nullptr (even when the length
is zero).

Fixed: 337141854
Change-Id: Iaff83fa71bd8cbe4ab9690f4bf0f29750291284c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5496964
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Reviewed-by: Matthias Liedtke <mliedtke@chromium.org>
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93644}
2024-04-30 07:13:39 +00:00
Jakob Kummerow cf9373a0d6 [wasm][sandbox] Make WasmFunctionData trusted
This moves the WasmFunctionData object hierarchy to trusted space,
which addresses some of the ways how Wasm functions can currently
be used for escaping from a compromised V8 sandbox.

Bug: 334120897
Change-Id: I23aa5bc7b1205ff29d0b6dac6fe301494275565e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5484107
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Reviewed-by: Samuel Groß <saelo@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93633}
2024-04-29 13:53:03 +00:00
Jakob Kummerow 05cb35d10e [gm.py] Fix "mkgrokdump" target on arm64
Building "arm64.release.mkgrokdump" already worked, but building
"arm64.release mkgrokdump" added the mkgrokdump target to the
wrong hard-coded target architecture.

No-Try: true
Change-Id: I2e7e68911e6bae59310f28fdf1355909db4269ae
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5492430
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93631}
2024-04-29 12:29:51 +00:00
Jakob Kummerow d02fe6bc87 [wasm-stringref] Fix return type of StringViewWtf8Encode builtin
The spec wants two i32 values, Turboshaft expects two i32 values,
the builtin should return two i32 values, CSA can be taught to
support two i32 values.

Fixed: 336007398
Change-Id: I29c1821ec6e54fc55df794f7122a549633575dc4
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5478967
Commit-Queue: Manos Koukoutos <manoskouk@chromium.org>
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Manos Koukoutos <manoskouk@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93561}
2024-04-24 14:09:53 +00:00
Jakob Kummerow f1742a1617 [gm.py] Avoid creating empty lines in args.gn
Even if {BUILD_DISTRIBUTION_LINE} is empty.

No-Try: true
Change-Id: I003eb9fcb36f6364ec53c76116c80fbde6058c28
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5481790
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93550}
2024-04-24 10:24:42 +00:00
Jakob Kummerow 693e966dea [wasm-fuzzer-gen-test] Use type codes where appropriate
We need to distinguish between printing "kWasmAnyRef" e.g. in
type definitions, and "kAnyRefCode" inside function bodies.

No-Try: true
Change-Id: Ifdfe9d4e16a60567729bd0eafe1b589df9de17f3
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5478987
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Matthias Liedtke <mliedtke@chromium.org>
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93548}
2024-04-24 08:15:47 +00:00
Jakob Kummerow 683abc09b0 [wasm-stringref] Make stringviews non-nullable
The previous in-between state where views were supertypes of 'none'
but not subtypes of 'any' was too inconsistent to be workable. This
patch forces the three view types to be non-nullable references,
which effectively puts them into single-occupant type hierarchies
of their own.

Fixed: 335640704
Bug: 42202811
Change-Id: I58f9a590c85bf90023d2b0bcdf1b1fbd071cda99
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5471674
Reviewed-by: Matthias Liedtke <mliedtke@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93534}
2024-04-23 15:12:35 +00:00
Jakob Kummerow f4c20cf519 [gm.py] Mac-arm64: refuse running x64 tests
To protect users from their own muscle memory.
Bonus change: port the logic to automatically run mkgrokdump to arm64
machines.

No-Try: true
Change-Id: Idd7b6a3455702259ce54d5113762912703963d16
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5471665
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93496}
2024-04-22 13:00:18 +00:00
Jakob Kummerow 63c5dca2dd [wasm][sandbox][liftoff][arm64] Fix LoadTrustedPointer
We get a {tag} parameter, so use it, don't discard it.

Test coverage will be provided by crrev.com/c/5465514, whose
currently-failing try jobs should be fixed by this.

Bug: 42204510
Change-Id: I053257e1b5546b80d2b1b3e4aa565d85085498f2
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5467824
Reviewed-by: Eric Leese <leese@chromium.org>
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Eric Leese <leese@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93476}
2024-04-19 16:58:11 +00:00
Jakob Kummerow 0aeef824d6 [tools][wasm] Fix mjsunit test generation for signatures
When printing return types, we should use GetReturn(), not GetParam().

No-Try: true
Change-Id: I4f95f7cdc9bc82ffdbf819e68656d1e24114c830
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5468106
Reviewed-by: Eva Herencsárová <evih@chromium.org>
Commit-Queue: Eva Herencsárová <evih@chromium.org>
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93473}
2024-04-19 16:12:33 +00:00
Jakob Kummerow e49c1742d2 [wasm] --trace-turbo: use wat format
This switches the disassembly format shown in Turbolizer from
"mjsunit"/kExprFoo syntax to wat syntax.
The motivation is to be able to remove the disassembler that
emits the former format; whereas we need the wat disassembler
for DevTools anyway.

Change-Id: I2d7d382441bbf1e6b1d60ddf3299bf2800e48fb5
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5463120
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Matthias Liedtke <mliedtke@chromium.org>
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93432}
2024-04-18 09:55:29 +00:00
Jakob Kummerow 760abb1a89 [wasm][fuzzer] --wasm-fuzzer-gen-test: use new implementation
This CL changes the implementation of the --wasm-fuzzer-gen-test
flag to the new and improved implementation that was recently
introduced for wami's --mjsunit output mode.
As a side effect, this lets us drop the "populate explicit recgroups"
support from the module decoder.

Change-Id: Ia3ab79131e1b62be6a9f1a6760fbd6f96a389229
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5458515
Reviewed-by: Matthias Liedtke <mliedtke@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93419}
2024-04-17 17:35:49 +00:00
Jakob Kummerow 57aac21be8 [wasm][stringref] Support memory64 and multi-memory
The memory-accessing stringref instructions:
 - string.new_{utf8,lossy_utf8,wtf8}
 - string.new_wtf16
 - string.encode_{utf8,lossy_utf8,wtf8}
 - string.encode_wtf16
 - stringview_wtf8.encode_{utf8,lossy_utf8,wtf8}
 - stringview_wtf16.encode
were not yet prepared to access 64-bit memories, or memories with
an index other than zero. This patch adds the missing support.

Bug: v8:12868
Change-Id: I122f448c0c7dad723d58a33a8509fbdfce1ea16c
Fixed: 333275999
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5447114
Reviewed-by: Matthias Liedtke <mliedtke@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93376}
2024-04-15 19:00:10 +00:00
Jakob Kummerow 3fedab9b46 [wasm-imported-strings] constants: require non-null globals
Per https://github.com/WebAssembly/js-string-builtins/pull/29,
imported globals that are populated with "magic" constants should
have non-nullable type.

Bug: v8:14179
Change-Id: I08f427d9fa55dc0e7df21c39b22c30bd52d1b3a6
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5447196
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Reviewed-by: Matthias Liedtke <mliedtke@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93348}
2024-04-12 17:02:39 +00:00
Jakob Kummerow 8e8325388b [wasm-imported-strings] Support "magic" imports for constants
Per the discussion at:
https://github.com/WebAssembly/js-string-builtins/issues/13
this patch implements imported externref globals that can be
requested to be automatically populated with string constants,
with the string's value equaling the respective import's name.

Bug: v8:14179
Change-Id: Ie86dc28b5a337c64ef03cb879e45adf340001a00
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5438375
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Matthias Liedtke <mliedtke@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93301}
2024-04-10 17:28:32 +00:00
Jakob Kummerow ff9ad962ec [wasm] Simplify LinkError handling
We don't need to pass around "module_name" and "import_name", as
we can get both easily from the "import_index".

Change-Id: Ice2fd8e183e652722cf8097d042b931b193fdbdb
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5438373
Reviewed-by: Matthias Liedtke <mliedtke@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93260}
2024-04-09 11:21:27 +00:00
Jakob Kummerow 44ecc94b4b [wasm-imported-strings] Include proper offset in LinkErrors
This includes the correct offset in any LinkErrors about incorrect
signatures of compile-time imported string functions.

Bug: v8:14179
Change-Id: I07c90e4fb4769a699f4f957c54a29a0648398129
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5435048
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Reviewed-by: Matthias Liedtke <mliedtke@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93251}
2024-04-09 08:25:08 +00:00
Jakob Kummerow 4dccc0ef9c [tools] Add tools/dev/setup-reclient.py
For conveniently setting up reclient support.
Currently supports Linux and Mac, both Google-managed and external.

No-Try: true
Change-Id: I7085643d6ba448407a6a07d3b177e44584c8656b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5380194
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Matthias Liedtke <mliedtke@chromium.org>
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93193}
2024-04-05 14:13:15 +00:00
Jakob Kummerow ad6df30db5 [wasm][fuzzer] Fix over-zealous tierup triggering
When fuzzing, we enable --wasm-sync-tier-up via flag implication,
which contrary to production code didn't reset the tiering budget
when triggering tier-up, and didn't check whether the function is
already tiered up. So for long-running loops, we executed a fresh
synchronous compilation job at each back edge.
This patch fixes both problems: it resets the tiering budget, and
skips repeated tier-up requests when the NativeModule already has
optimized code for the given function.

Fixed: 330745165
Change-Id: Ie733180f0b47cf07a2e26a1b7bc67eb3624428ed
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5412662
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93121}
2024-04-02 15:51:53 +00:00
Jakob Kummerow 1017c6c277 [wasm-stringref] Allow array inputs with type "none"
The four instructions that take i8/i16 arrays as inputs (i.e.
string.{new,encode}_wtf{8,16}_array) already considered these
to be nullable references, but optimistically rejected inputs
that were statically known to have type "none".
That doesn't match the general principle of allowing implicit
upcasting, so this patch relaxes the decoder to permit "none"
types at validation time (they'll trap at runtime, of course).

Context: https://github.com/WebAssembly/stringref/issues/66

Bug: v8:12868
Change-Id: I813f8adc273c9e7ac23590ce239e47ce6117973b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5385442
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Matthias Liedtke <mliedtke@chromium.org>
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92942}
2024-03-21 12:25:55 +00:00
Jakob Kummerow 9bf38176b0 [intl] Speed up Intl.Segmenter iteration
Segmenting a string into words or graphemes returns a
"Segment Data Object" for every segment. By predefining these
objects' map, we can populate their properties much faster than
with CreateDataProperty().
This speeds up the microbenchmark from the linked bug (c#5) by
around 3x.

Bug: 326176949
Change-Id: I2791143f514654ab3d1673a94169b4fb96238840
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5382161
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92928}
2024-03-20 20:52:01 +00:00
Jakob Kummerow 53b462c233 [test][asm.js] Robustify mjsunit/asm/log-lazy-code
Sampling the stack isn't always reliable, so this patch slightly
loosens the test's expectations to be more robust.

Fixed: v8:14653
Change-Id: I53f721aea759bee8a6810c0f80369245040a4248
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5378403
Reviewed-by: Nikolaos Papaspyrou <nikolaos@chromium.org>
Commit-Queue: Nikolaos Papaspyrou <nikolaos@chromium.org>
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92890}
2024-03-19 11:43:02 +00:00
Jakob Kummerow 73f62bd588 [wasm] Fix ClearWeakScriptHandleTask shutdown issue
When an Isolate shuts down at an inconvenient moment and instructs its
task runner to destroy all waiting tasks, these tasks must not free
memory that later steps in the Isolate shutdown sequence will still
write to. This patch fixes such a situation for ClearWeakScriptHandleTasks
by letting the Isolate itself own the memory in question.

I have never been able to reproduce the reported issue myself, so
this is a somewhat speculative fix.

Fixed: 326607001
Change-Id: Ie708439d924e9344c2df6bbba1cd864336756881
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5372733
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92882}
2024-03-18 15:48:28 +00:00
Jakob Kummerow b0331fe898 [wasm-gc][liftoff] Fix off-by-one in RefAsNonNull
When we implement `ref.as_non_null` as a fake load from the object
(which would trap if the object is null, handled by the trap handler),
we should take into account that the object base address is tagged,
so the "word after the map word" is at offset +3, not +4. Otherwise,
in the special case where the object is a non-null zero-fields struct
that was allocated right before the end of a page, we'd get an invalid
memory access and hence erroneously consider the struct to be `null`.

Fixed: 329145803
Change-Id: Ib8ce2668b767de9de6bf4632b022c71a3b8bd027
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5378140
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92879}
2024-03-18 15:29:24 +00:00
Jakob Kummerow 38f83e8b78 Fix building x64 with GCC-12
- Mostly making unreachable code paths easier for the compiler
  to detect
- Dropping one unused field from a struct
- Dropping one unnecessary std::move preventing copy elision

Other target platforms than x64 may need additional fixes.
The build takes a long time but it does finish eventually.

Change-Id: I314b1ca41959d7433d83bc2065facdcada91cc52
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5318004
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Camillo Bruni <cbruni@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Nico Hartmann <nicohartmann@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92877}
2024-03-18 13:55:47 +00:00
Jakob Kummerow e215c29036 [turbofan] Fix CHECK in ConstantNoHole
Comparing NaNs works best by bit-casting them to an integer.

Change-Id: I087c2943d9e7e79c69b57b3d4448afa262fb827e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5366452
Reviewed-by: Nico Hartmann <nicohartmann@chromium.org>
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92856}
2024-03-15 15:41:45 +00:00
Jakob Kummerow ab6d2d00cb [turboshaft] Drop NaN handling in ConstantOp::operator==
We used to have a special case to make "op1 == op2" return true if
both ops were NaN constants (with possibly different bit patterns).
This special case is unnecessary for JavaScript, because we canonicalize
JS NaNs anyway, and a spec violation for Wasm, because Wasm must
preserve the payloads of NaN values that are being passed around.

Fixed: 328209289
Change-Id: I7a4595b72f17643d57cfd1e739d9a5409fb5bd0a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5366030
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Nico Hartmann <nicohartmann@chromium.org>
Commit-Queue: Nico Hartmann <nicohartmann@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92847}
2024-03-15 11:46:33 +00:00
Jakob Kummerow 162af01028 [wasm][fuzzer] Catch OOMs with NearHeapLimitCallback
and treat them like exceeding "max steps".
This is meant to handle cases where randomly-generated functions
allocate many live heap objects, which would previously crash
the fuzzer process when running into the heap limit.

Fixed: 328146362
Change-Id: Id998947a57c94c5ad2e3a978aa1cd1015ab78f59
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5366886
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92823}
2024-03-14 10:35:09 +00:00
Jakob Kummerow cc228d780e [arm64] Fix veneers for large code objects
Consider the following scenario:
  [previous code]
  b.eq label     # instruction 0
  [20KB of code]
  tbz label      # instruction 1
  [20KB of code]
  tbz label      # instruction 2
  [12KB of code]
  <<< position 1
  [around 960KB of code]
  <<< position 2
  [more code]
  label:
When we reach "position 1", instruction #1 is reaching the end of its
encodable jump distance, so we emit a veneer for it. We would like to
rewire the instruction chain so that instruction #2 points at #0, but
that is also out of encodable range, so we make instruction #0 branch
to the veneer as well, and mark instruction #2 as the end of the chain
of linked branch instructions referring to the label.
However, instruction #0 is still in the list of unresolved branches,
from which we must remove it; otherwise when we reach position 2,
where instruction #0's encodable jump distance ends, we will try to
emit a veneer for it, which involves trying to find it by walking the
label's chain of linked instructions -- where we won't find it, because
that chain now ends at instruction #2.

This bug was flushed out by --turboshaft-wasm, but is neither Wasm nor
Turboshaft specific (e.g. in a local repro that is too slow to check
in as a regression test, I can trigger it with Turbofan as well).

Fixed: 328738218
Change-Id: Ic98eaddbecf52bce72e25ea256e1f00d33a29b66
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5367100
Reviewed-by: Darius Mercadier <dmercadier@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92817}
2024-03-13 15:20:50 +00:00
Jakob Kummerow 00c3c4a0d2 [wasm] Introduce flag --wasm-eager-tier-up-function
Making it easier to test compiler issues that are triggered by a
particular function.

Change-Id: I974be8f1046513ba6ca9a2b84e4be877e2dab46a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5367022
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Matthias Liedtke <mliedtke@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92791}
2024-03-12 16:42:00 +00:00
Jakob Kummerow 29829daa01 [wasm-stringref] Fix string-from-data shortcut
It turns out that the right combination of instructions from the
stringref proposal also ends up on the fast path we built for
imported strings, where we shortcut an array-from-data and a
string-from-array operation to a combined string-from-data. Since
stringref instructions support additional strictness modes
(specifically: kUtf8NoTrap, i.e. attempt strict UTF-8 decoding, and
return `null` instead of trapping on failure), the fast path needs
to support these too.

Fixed: v8:14657
Change-Id: I4610cf821e709d56459fb5b1b2515d4bf4c691fc
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5355703
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Reviewed-by: Matthias Liedtke <mliedtke@chromium.org>
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92757}
2024-03-11 16:59:03 +00:00
Jakob Kummerow c163161b23 [bigint] Harden Divide/Modulo for sandbox fuzzing
Requesting division by zero (which is only possible with already-
corrupted heap contents) should CHECK-fail in Release mode to
prevent subsequent escalation to off-heap memory corruption.

Fixed: 328692018
Change-Id: If7b96eac0a39eb0de3185d5851528549e2b8e47d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5355705
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Samuel Groß <saelo@chromium.org>
Commit-Queue: Samuel Groß <saelo@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92736}
2024-03-08 15:19:04 +00:00
Jakob Kummerow 21b24dd93f [wami] mjsunit mode
This adds `wami --mjsunit`, producing JS source that uses the
WasmModuleBuilder from test/mjsunit/wasm/wasm-module-builder.js
to define the module.

Change-Id: I6ad43c033de60f6252fc09d3a5e5436344a34250
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5339908
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Reviewed-by: Matthias Liedtke <mliedtke@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92696}
2024-03-06 17:10:50 +00:00
Jakob Kummerow c85852ef2a [wasm-fuzzer] Add NaN check to Relaxed FMA operations
To stop the fuzzer from reporting NaN-related differences.

Fixed: 328279045
Change-Id: Id1a6adb5eb41502d103c9b648d0e32da64725621
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5349361
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92693}
2024-03-06 15:52:51 +00:00
Jakob Kummerow 8dd7bd9b98 [wasm-imported-strings] Fix string-from-data fast path
There were two bugs:
- Turboshaft failed to take the fast path despite meaning to.
- The fast path accidentally inherited the stringref proposal's
  stricter throw-on-invalid-data behavior, while imported string
  operations are supposed to silently use the replacement character.

Fixed: 327643791
Change-Id: I536c8355d2a8e4dcd4f41af16a0fa1da062aef4a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5345411
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Matthias Liedtke <mliedtke@chromium.org>
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92672}
2024-03-05 16:41:56 +00:00
Jakob Kummerow dc7219333b [wasm-disassembler] Expose OffsetsProvider in .h
And also expose uint64_t printing.
This CL is just moving code in preparation for future work, there
are zero functional changes here.

Change-Id: Ic140a0e44bc08be476741096084d7f5256074f36
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5339907
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Matthias Liedtke <mliedtke@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92656}
2024-03-05 09:59:16 +00:00
Jakob Kummerow 5b1b767a31 [wasm][cleanup] Misc fixes to tests and disassembler
Minor improvements I noticed while working on other things.
See review comments for details.

Change-Id: I7ac3d52b1d28f6ff324c8ca6a768bf249bb32263
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5339906
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Matthias Liedtke <mliedtke@chromium.org>
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92654}
2024-03-05 09:11:42 +00:00
Jakob Kummerow 4f16e2f78a [asm.js] Use unsigned LEBs where appropriate
When building Wasm modules from asm.js sources, we should use
unsigned LEBs where appropriate, specifically: for global indices
and branch depths.
Using signed LEBs should be harmless, but is wasteful, because it
can require an additional byte that would be avoidable. For an
extreme example, see "TestLargeSwitch" near the end of
test/mjsunit/wasm/asm-wasm-switch.js.

Change-Id: Id04f4ca51819b3054ff6589bdbcb54113dbdc814
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5339888
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92651}
2024-03-05 06:47:03 +00:00
Jakob Kummerow 030f11450b [wasm-imported-strings] Fix Number-to-uint32 conversions
The helper function we used previously produced unexpected results
for negative inputs.

Fixed: 327517308
Change-Id: Iceb2e79c357e1f09622ad5ae0e0f52e9234769ef
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5339898
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Matthias Liedtke <mliedtke@chromium.org>
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92643}
2024-03-04 15:05:17 +00:00
Jakob Kummerow 57adeced2d [turbofan] Fix gap moves in End block
The End block doesn't have a frame, so trying to access spill slots
inside it will DCHECK-fail.

Fixed: 326904344
Change-Id: Ie2b1d7a87493b057e07eab26ffd2ba0f6a1ee004
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5320907
Reviewed-by: Darius Mercadier <dmercadier@chromium.org>
Commit-Queue: Darius Mercadier <dmercadier@chromium.org>
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92544}
2024-02-27 08:53:22 +00:00
Jakob Kummerow 3fe82e7f4a [wasm-gc] Relax static type reqs for call_indirect
As discovered on https://github.com/WebAssembly/binaryen/pull/6336,
we erroneously required that the immediate type of a call_indirect
instruction be a subtype of the referenced table's type, but there
is no such requirement in the spec. This patch drops the check.
This change is backwards-compatible because it makes V8's behavior
strictly more permissive.

Bug: v8:9495
Change-Id: I198822e3d1ef8d8dd349fa92ed9e49d043d5d192
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5319505
Commit-Queue: Manos Koukoutos <manoskouk@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Manos Koukoutos <manoskouk@chromium.org>
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92509}
2024-02-23 14:29:41 +00:00
Jakob Kummerow 82d6168cb2 [wasm-imported-strings][turbofan] string-from-data must always check for traps
We erroneously marked the optimized string-from-data path (replacing an
array-from-data + string-from-array sequence) as "eliminatable", which
means when its result is unused, the operation could be dropped entirely,
even when it would have trapped.
To avoid differences in trapping behavior between optimized/unoptimized
code, we must never eliminate this operation.

Fixed: 326260438
Change-Id: If15c0b66455e70c4ee51f3c4f69e07f4e87d1366
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5314730
Reviewed-by: Matthias Liedtke <mliedtke@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92475}
2024-02-22 12:12:05 +00:00
Jakob Kummerow 4ccb925fe5 [wasm-compile-fuzzer] Various fixes and improvements
- Switch --wasm-tier-mask-for-testing to apply to declared (as opposed
  to possibly-imported) function indices. This makes sure that the
  fuzzer's selection of functions to be optimized has an effect.
- Disable lazy compilation for the fuzzer, to make sure we compile
  everything right away.
- Before giving up on a generated module that runs for too long, tier
  up all functions in it, to possibly catch compiler DCHECKs. To avoid
  non-determinism, we perform this tier-up synchronously on the main
  thread, using a new flag --wasm-sync-tier-up.
- Make the fuzzer check for compile-time imports properly.
- Leave tiering enabled for fuzzer runs, to be closer to production
  behavior and enable inlining based on call counts.
- Fix: when clearing the global type canonicalizer, also clear the
  per-heap list of cached canonical RTTs to prevent them from being
  reused erroneously.
- Fix: when checking whether a function should be compiled with
  Turboshaft, compare the mask bit "!= 0" instead of "== 1".

Changes: 
Change-Id: I11ac329b82bc9c8acb5157bc418ee48b2a85198f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5314659
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92463}
2024-02-21 18:58:41 +00:00
Jakob Kummerow cfe1cccfb8 [wasm-imported-strings][turbofan] Use HeapType::kExternString
...instead of the concept of "implicit internalization".

Bug: v8:14179
Change-Id: I3bc8ac7e3204a3ba4f71af526f433829d12bb920
Fixed: 326091470
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5314561
Reviewed-by: Matthias Liedtke <mliedtke@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92461}
2024-02-21 18:21:12 +00:00
Jakob Kummerow 07ecad0536 [wasm][fuzzer] Mark certain instructions as "heavy"
Our somewhat simplistic detection mechanism for long-running
randomly-generated modules relies on counting executed Wasm
instructions. Some instructions ("bulk" instructions operating
on tables/memories/arrays/strings) can take significantly longer
to execute than simple instructions, so when functions used many
of those, they could run long enough to cause timeouts without
bumping into the "max steps" budget. This CL mitigates that by
marking relevant instructions as "heavy", so they count as 1000
steps.
We could be fancier and take actual lengths into account, but
perhaps this simple approach is good enough.

Fixed: 325738876
Change-Id: Ib325be4d6864db2840ec7d81a6d13cdf24fd01ad
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5307538
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92418}
2024-02-20 10:28:39 +00:00
Jakob Kummerow 246a3d1c15 [gm.py] Reclient config update for manual build dirs
The automatic args.gn update to apply the goma->reclient change
only worked for "managed" output directories; this patch brings
them to "manual mode" output directories (`gm out/foo`).

No-Try: true
Change-Id: Ia970d111f612cbd907cc370981f6c8cb744a9795
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5306762
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92415}
2024-02-20 09:19:55 +00:00
Jakob Kummerow 3f04ab3849 [wasm][liftoff][arm64] Fix LoadTaggedPointer
The previous way to compute the protected_load_pc didn't account for
the possibility of a constant pool getting emitted.

Fixed: 325359458
Change-Id: I7c284175d3c0e9d802ad307adf8d93e721d35361
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5307536
Reviewed-by: Manos Koukoutos <manoskouk@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92412}
2024-02-19 19:39:34 +00:00
Jakob Kummerow 4765e4b73f [wasm-imported-strings] Fixup Turbofan part of bb756705
We shouldn't use an IfFalse as a value node. The regression test
has been extended to cover this mistake.
Bonus: clean up some unused things in the regression test.

Bug: 324690505
Change-Id: Ifb6d9ee5a718d6abb99a3d8646af75b46fe7e567
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5300308
Reviewed-by: Matthias Liedtke <mliedtke@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92370}
2024-02-16 15:55:54 +00:00
Jakob Kummerow 04288c568f [wasm][turboshaft] Fix call_ref in unreachable code
Part of the implementation of CallRef() does not work when generating
unreachable operations, so bail out in that case.

Fixed: 325372946
Change-Id: I3da38247d967f2fc9fde9ae6207c27417f4d5fb4
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5300306
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Matthias Liedtke <mliedtke@chromium.org>
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92368}
2024-02-16 14:58:58 +00:00
Jakob Kummerow bb75670599 [wasm-imported-strings] Fix IsArrayNewSegment in unreachable code
The node we query is invalid in unreachable code, so we must check
for that before fetching it from the graph.

Bonus: running the regression test in Turbofan revealed an unrelated
issue having to do with reachability of catch blocks after replacing
a well-known import, so this CL includes a fix for that too.

Fixed: chromium:324690505
Change-Id: If648faf7dd466ed857d723eec44fc01fc7a6a6fc
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5300801
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Matthias Liedtke <mliedtke@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92362}
2024-02-16 12:03:24 +00:00
Jakob Kummerow 5940108953 [wasm-gc] Update disassembler for type section
- Print recgroups
- Print "sub" and "sub final" instead of outdated "_subtype" suffix
- Since offsets must now always be computed, the performance impact
  is mitigated by collecting them during initial decoding when we
  are decoding just for the disassembler. (When disassembling an
  existing module, we have no choice but to let the OffsetsProvider
  decode it again.)

Bug: v8:14034
Change-Id: I41f55d597e05fae7e6599a7810240ed4ce25a1fc
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5286275
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Matthias Liedtke <mliedtke@chromium.org>
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92280}
2024-02-12 19:31:27 +00:00
Jakob Kummerow d6f3ed466c [tools] update-compile-commands.py: support reclient
No longer start Goma.
Run `gcert` for Googlers who need it.
Drive-by: modernize string templates to f-strings.

No-Try: true
Change-Id: Ib956619872386bdbb9103d38e66d3cfcbd3eceea
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5279554
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Matthias Liedtke <mliedtke@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92274}
2024-02-12 11:04:33 +00:00
Jakob Kummerow 3814fa528f [wasm-strings] FromCodePoint can trap
Optimizing compilers must not optimize out string.from_codepoint even
when the result is unused, because an invalid codepoint traps, which
is observable.
Drive-by fix: Liftoffs corresponding error message in the imported
strings variant didn't include the to-uint conversion of the codepoint.

Fixed: chromium:324475066
Change-Id: I0066350da25936b3b48ae0f2c1b3adb89aa77133
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5279449
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Reviewed-by: Matthias Liedtke <mliedtke@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92257}
2024-02-09 17:26:15 +00:00
Jakob Kummerow 08170169a3 [wasm-imported-strings] Implement encodeStringToUtf8Array
Contrary to the "Into" variant, this implicitly allocates an array
of appropriate size.

Bug: v8:14179
Change-Id: I01974624683eef961f6c8b8c6cbe33aa65d2df6a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5273182
Reviewed-by: Matthias Liedtke <mliedtke@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92216}
2024-02-06 15:16:10 +00:00
Jakob Kummerow b2b1ebad4c [wasm-compile-fuzzer] Minor tuning around i32
- Give higher probability to i32 values in general
- Distribute i32 constants over their possible bit widths

Change-Id: I03c23c2ff0a60e9edcaa3d166a58720dcb017ec9
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5268508
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Matthias Liedtke <mliedtke@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92205}
2024-02-05 17:28:17 +00:00
Jakob Kummerow b776fc756a [wasm-imported-strings] Fuzzer support
This adds support for imported strings to the wasm-compile fuzzer.
Drive-by: fix the first bug that this fuzzing support uncovered,
which is an over-zealous DCHECK when validating modules that have
no imports but enable compile-time imports.

Bug: v8:14179
Change-Id: I6a2b3dea76456f42df4f8cae499eee5d32736342
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5253193
Reviewed-by: Matthias Liedtke <mliedtke@chromium.org>
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92201}
2024-02-05 15:30:51 +00:00
Jakob Kummerow 5d5060da81 [test][wasm] Fix and speed up mjsunit/wasm/module-memory.js
The final loop in this test had a typo in its starting point, which
caused it to skip an interesting value, and a typo in its end point,
which caused it to do much more work than intended.

Change-Id: I7604b95478f6975244932339607607bc089c1750
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5263197
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92184}
2024-02-05 10:40:26 +00:00
Jakob Kummerow 2ccb82b047 [heap] Optimize WriteBarrierForRange
When only the generational and/or shared write barries are
needed, we can skip pointers to uninteresting targets quickly
if they are located on a page that has already been determined
to be uninteresting. Remembering all uninteresting pages would
be slow, but remembering the last uninteresting page improves
a microbenchmark by around 2x.

Change-Id: I15c9b72608971d61f5964e1b00c8f59d11a54bf3
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5262698
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92182}
2024-02-05 09:05:40 +00:00
Jakob Kummerow 86ae25eb72 [wasm-compile-fuzzer] Refactor handling of struct/array types
This refactors the wasm-compile fuzzer to use arrays of struct/array
type indices instead of implicitly-known ranges of type indices.
This mirrors how function signature types have already been handled.
This is a prerequisite for adding fuzzer support for imported strings,
the included addition of default i8/i16 array types is a first step
in this direction.

Bug: v8:14179
Change-Id: I6d46d3a75a50640523c7a14fc4da11b7de4d909d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5253192
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Matthias Liedtke <mliedtke@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92151}
2024-02-01 15:04:34 +00:00
Jakob Kummerow 65861d096e [wasm][relaxed-simd] LaneSelect: Make TF/Liftoff consistent
This ports crrev.com/c/4035091 to Liftoff: ia32 and x64 can use
`blendvps` and `blendvpd` for 32/64 bit wide lane selection, as
opposed to using bytewise selection regardless of lane width.
Turbofan/Turboshaft do this already; this patch brings the same
logic to Liftoff, ensuring that functions compute the same results
before and after optimization.

Fixed: chromium:1516878
Change-Id: Iff69603954661cf2701fe48805edc3e41dc2307c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5239025
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92065}
2024-01-29 14:57:33 +00:00
Jakob Kummerow c19c0fc365 [wasm-imported-strings] Mark as "staged"
Reflecting the fact that there's an active Origin Trial.

Bug: v8:14179
Change-Id: I2fbc8aeaef7266b21f5699aab0cbac7f1b87c8b4
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5239029
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Samuel Groß <saelo@chromium.org>
Reviewed-by: Samuel Groß <saelo@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92029}
2024-01-26 12:38:05 +00:00
Jakob Kummerow 25bf4a691f [wasm][turboshaft][ia32] Fix certain atomic stores
The MachineOperatorReducer can create the situation that an atomic
store has both an index and a displacement, which the ia32
instruction selector didn't support.

Fixed: chromium:1520312
Change-Id: I291dcf2915c9ecd9002c0e0ddc5a46b3bf5db158
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5237267
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Darius Mercadier <dmercadier@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92006}
2024-01-25 15:28:36 +00:00
Jakob Kummerow e0a43f23ca [turboshaft][wasm] Fix 64-bit atomic load/store on 32-bit arch
Int64Lowering currently cannot deal with "elem_size_log2" scaling
parameters, because AtomicWord32Pair doesn't support them. So the
MachineOptimizationReducer shouldn't produce these parameters on
this particular configuration.

Fixed: chromium:1520311
Change-Id: I68f5cf48fc2d617bd62aeced018983eb6e77d56c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5232164
Commit-Queue: Nico Hartmann <nicohartmann@chromium.org>
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Nico Hartmann <nicohartmann@chromium.org>
Cr-Commit-Position: refs/heads/main@{#91985}
2024-01-24 14:34:14 +00:00
Jakob Kummerow 45d94ebafc [wasm][ia32] Fix F64x2ReplaceLane instruction selection
When unifying this with other ReplaceLane operations in
crrev.com/c/5191568, I missed that there was a difference
in "g.Use" vs. "g.UseRegister".

Fixed: chromium:1520130
Change-Id: I7c985c57b439dba4b2765cf93294d0c77af127fa
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5227862
Reviewed-by: Eva Herencsárová <evih@chromium.org>
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Eva Herencsárová <evih@chromium.org>
Cr-Commit-Position: refs/heads/main@{#91963}
2024-01-23 18:49:24 +00:00
Jakob Kummerow 499a5646b8 [wasm][liftoff] Fix alignment checks for atomic ops
This fixes an issue in crrev.com/5180736 where an atomic memory
access with a statically known index and incorrect alignment
does not trap even though it should.

Fixed: chromium:1520780
Change-Id: I0f59728acbfd5a8ca02c67ebf5093e8be923e1c5
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5224982
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/main@{#91950}
2024-01-23 12:42:28 +00:00
Jakob Kummerow fb9a925cdc [wasm-imported-strings] Support compile-time imports
All WebAssembly.* functions that can trigger compilation get an
additional "options" parameter, which for now can express a list
of built-in imports packages that the module wishes to use. These
imports are then available at compile time already, and are ignored
at instantiation time.

Bug: v8:14179
Change-Id: I64f89a8a2e1f817199c877235c2b018e5e150ad1
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5217133
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/main@{#91931}
2024-01-19 21:17:39 +00:00
Jakob Kummerow f6c245d706 [wasm-imported-strings] Update the set of functions
Keeping up with the upstream proposal:
- "MeasureUTF8" and "IntoUTF8Array" are new,
- "FromUTF8Array" replaces "FromWTF8Array",
- the internal debug names of the string builtins are updated;
  updating their public names will follow in the next CL.

Also, "Cast" and "Test" get Turbofan implementations (to avoid a
dependency on the Turboshaft launch).

Bug: v8:14179
Change-Id: Idbb4de7e3e3b56cfb44c15651cbea9d4fb1b6d85
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5217053
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/main@{#91924}
2024-01-19 14:38:00 +00:00
Jakob Kummerow 1dd45099de [gm.py] Fix detection of non-Google reclient machines
We checked the conditions in the wrong order: machines that have
both "rbe_instance" and "download_remoteexec_cfg" in their .gclient
must be classified as non-Google.

No-Try: true
Change-Id: Ib9331531709b7bea6fcba5e31a24d010554e9ecd
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5217151
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/main@{#91923}
2024-01-19 13:10:30 +00:00
Jakob Kummerow 6cfd2a028b [gm.py] Automatically run 'gcert' if needed
When the Reclient/Google configuration is detected, check if
a valid cert is present, and run `gcert` otherwise.

No-Try: true
Change-Id: Ia56bf467d85dce2ba133958d5d5393b9cda5fc8a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5201150
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/main@{#91876}
2024-01-17 09:35:43 +00:00
Jakob Kummerow cf6c8f2818 [wasm] Fix deadlock in EstimateCurrentMemoryConsumption
To read the current size of a CompilationStateImpl more accurately,
we need to acquire a mutex, which can deadlock when that mutex is
held elsewhere by another thread. To fix this, we replace the
mutex-guarded field reading with heuristics, which should only cause
a small loss of accuracy in this case.

Fixed: chromium:1497386
Change-Id: Ice6c4e6ff96235ff688b26c8837575a37e97e492
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5199991
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/main@{#91861}
2024-01-16 13:58:32 +00:00
Jakob Kummerow f3308e90c9 [turboshaft][ia32] Instruction Selector part 4
This completes the series, and stages the ia32 turboshaft
instruction selector behind --turboshaft-future.

Bug: v8:12783
Change-Id: If7cf6c84cf8538de2c5d3562ac3e8e040d4f366d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5193705
Reviewed-by: Matthias Liedtke <mliedtke@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/main@{#91839}
2024-01-15 12:23:46 +00:00
Jakob Kummerow bc99a57e78 [turboshaft][ia32] Instruction Selector part 3
This now passes mjsunit/wasm/*.

Bug: v8:12783
Change-Id: I54008423601aaeb89e06e6e4f4df54a284a43120
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5191568
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Matthias Liedtke <mliedtke@chromium.org>
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Cr-Commit-Position: refs/heads/main@{#91829}
2024-01-14 22:35:52 +00:00
Jakob Kummerow e69744a58f [turboshaft][ia32] Instruction Selector part 2
mjsunit/wasm/turboshaft/instruction-selection passes now, but
much work remains to be done for the rest of the test suite.

Bug: v8:12783
Change-Id: I7ec0869abe9a03585f3ddc2707fffe1882c9b594
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5192366
Reviewed-by: Matthias Liedtke <mliedtke@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/main@{#91821}
2024-01-12 17:15:08 +00:00
Jakob Kummerow d4bf4c7b22 [turboshaft][ia32] Instruction Selector part 1
Part 1: just enough to make it through the "TrivialFunctions" test.

Bug: v8:12783
Change-Id: Ic90faed53fd4a7c9637b0f71b70b8c345d0fa4fc
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5189150
Reviewed-by: Matthias Liedtke <mliedtke@chromium.org>
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/main@{#91807}
2024-01-12 11:29:10 +00:00