100 Commits
Author SHA1 Message Date
Matthias Liedtke 291f350165 [deoptimizer][wasm] Add minimal test case
It doesn't test anything new, just as a minimal test case to debug if
all wasm deopts tests fail.

This might also be helpful for anybody (including me) having to port
the deoptimization entry to other platforms than the already
implemented x64 builtin.

Bug: 42204618
Change-Id: I97f1da3e6723c107579211921f9473a22c0cf3e4
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5623151
Reviewed-by: Daniel Lehmann <dlehmann@chromium.org>
Commit-Queue: Daniel Lehmann <dlehmann@chromium.org>
Auto-Submit: Matthias Liedtke <mliedtke@chromium.org>
Cr-Commit-Position: refs/heads/main@{#94392}
2024-06-12 11:13:54 +00:00
Matthias Liedtke 846febf19a [compiler][wasm] Fix --trace-turbo for wasm wrapper compilation
The wrappers seem to use the flag IsWasmBuiltin(), IsWasm() returns
false.

Fixed: 345393147
Change-Id: Id8c08ee2e826dc50c0e50465bbe4d8154ede7f75
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5615491
Reviewed-by: Darius Mercadier <dmercadier@chromium.org>
Auto-Submit: Matthias Liedtke <mliedtke@chromium.org>
Commit-Queue: Darius Mercadier <dmercadier@chromium.org>
Cr-Commit-Position: refs/heads/main@{#94355}
2024-06-11 07:09:55 +00:00
Matthias Liedtke bd8f9f51f6 [deoptimizer][wasm] Preserve signaling NaNs for F32 & F64
Bug: 42204618
Change-Id: Ie2ebc7de96b80641a0e18cad2f8a92d391c3c6a6
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5608452
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Auto-Submit: Matthias Liedtke <mliedtke@chromium.org>
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Cr-Commit-Position: refs/heads/main@{#94344}
2024-06-10 16:14:27 +00:00
Matthias Liedtke e7f4df245f [deoptimizer][wasm] Support deopt on most trivial call_indirect
Also properly zero-extend 32 bit register values.

Bug: 42204618
Change-Id: I7ad9e864b831dd936366eb652cd4b05907980a3b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5611291
Reviewed-by: Manos Koukoutos <manoskouk@chromium.org>
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Cr-Commit-Position: refs/heads/main@{#94342}
2024-06-10 15:55:15 +00:00
Matthias Liedtke 066438f3dd [deoptimizer][wasm] Don't delete processed feedback, mark it outdated
Deleting the cached feedback can cause races with background
compilation jobs that require this feedback to be present.
Instead we only mark it as outdated. There is still a race where an
enqueued background compilation job can read the feedback after the
deopt but before the cached feedback was updated. However, in this case
it only wastes a background compilation that will likely be running into
the deopt again.

In most cases there won't be other compile jobs for the deopted
functions enqueued or they will not be processed before the main thread
reached the TriggerTierUp call in CallRefIC which will then get an
exclusive lock and reprocess the feedback.

This CL also disables --jit-fuzzing in most deopt test cases as they
check assertFalse(%IsTurboFanFunction(wasm.main)) after the deopt which
cannot be guaranteed in this mode.

Fixed: 345403263
Bug: 42204618
Change-Id: Ice7fed0fc6c4d8f60b3e82f4edf0e43245aa6d4e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5604483
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Auto-Submit: Matthias Liedtke <mliedtke@chromium.org>
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Cr-Commit-Position: refs/heads/main@{#94298}
2024-06-06 18:48:44 +00:00
Matthias Liedtke 68a671e17f [deoptimizer][wasm] Reset tiering budget at deopt
This will give us some more time of liftoff execution to collect
valuable feedback and reduce the risk of additional deopts.

It also fixes flakes in test cases as the unpredictable tiering budget
makes it harder to write stable tests / assert the current tier after
a deopt.

Fixed: 344849329
Bug: 42204618
Change-Id: Id478b23671d41c787e2e80d49cb0ddd73bc79043
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5600265
Auto-Submit: Matthias Liedtke <mliedtke@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/main@{#94262}
2024-06-05 13:12:46 +00:00
Matthias Liedtke 4c616e7920 [mjsunit] Skip wasm deopt tests with S128 on non-simd hardware
Fixed: 344572163
Change-Id: I5ddb3bc67e52867c17af3f775fb5d584a06636d2
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5600541
Commit-Queue: Eva Herencsárová <evih@chromium.org>
Reviewed-by: Eva Herencsárová <evih@chromium.org>
Auto-Submit: Matthias Liedtke <mliedtke@chromium.org>
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Cr-Commit-Position: refs/heads/main@{#94259}
2024-06-05 10:56:31 +00:00
Matthias Liedtke f6a60e1b20 [wami] Mjsunit: Fix leb encoding used in variable names
The mjsunit mode generated some invalid expressions like
  let ...wasmUnsignedLeb($func130) = builder.addFunction(...);
where just the JS variable name should be printed ("$func130").

In general we have to differentiate between 3 cases:
- the variable name, e.g. for the `let $table130 = ...`
- the index, e.g. the third argument in
  `builder.addExportOfKind($table130, kExternalTable, $table130.index)`
- the index in LEB, e.g. the second and third value in
  `kExprCallIndirect, $sig25, ...wasmUnsignedLeb($table130.index)`

Change-Id: I847773fe274f27a7a27c60c4e70dca91af9932be
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5589246
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/main@{#94256}
2024-06-05 09:48:38 +00:00
Matthias Liedtke fff22aac2b [turboshaft][wasm-gc] Also derive type information for array.get
Not sure how we (I) missed this. This probably doesn't change much in
terms of performance, still this was done properly by Turbofan while
Turboshaft just "forgets" all the static type information on array.get
without this change.

Bug: 42204049
Change-Id: I19975293fde6bf5cc8914af2fba6702ce89ec8a4
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5589244
Auto-Submit: Matthias Liedtke <mliedtke@chromium.org>
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Reviewed-by: Eva Herencsárová <evih@chromium.org>
Cr-Commit-Position: refs/heads/main@{#94181}
2024-05-31 16:28:40 +00:00
Matthias Liedtke 3b037e1756 [turboshaft][wasm-gc] Unpack i8 and i16 to i32 in type optimizations
Fixed: 342602616
Change-Id: Ib82e19241c5b3562db3f86a31b6e3be56e77cadd
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5587860
Reviewed-by: Eva Herencsárová <evih@chromium.org>
Auto-Submit: Matthias Liedtke <mliedtke@chromium.org>
Commit-Queue: Eva Herencsárová <evih@chromium.org>
Cr-Commit-Position: refs/heads/main@{#94179}
2024-05-31 13:18:08 +00:00
Matthias Liedtke 740ddbdc5c [deoptimizer][wasm] Allow new dynamic tierup after deopt
Bug: 42204618
Change-Id: I2a853522f75afb22829fea50d0c220140534d9bb
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5580356
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/main@{#94163}
2024-05-29 17:09:09 +00:00
Matthias Liedtke 26d6312320 Revert "[heap][handles] Revise parking invariants for direct handles"
This reverts commit 239f4e587f.

Reason for revert: Failures on TSAN bots:
https://logs.chromium.org/logs/v8/buildbucket/cr-buildbucket/8746694747325887153/+/u/Check/ConcurrentAllocationInLargeSpace

Original change's description:
> [heap][handles] Revise parking invariants for direct handles
>
> Until now, when parking a background thread, a DCHECK would fail if
> the thread's stack contained direct handles, practically allowing
> only limited use of direct handles in background threads. With
> https://crrev.com/c/5331543, the stacks of parked background threads
> are correctly scanned (in builds with conservative stack scanning
> enabled) and therefore this restriction can now be eliminated.
>
> This CL:
>
> - allows unrestricted use of direct handles in background threads;
> - revises the methods and scopes for parking threads, to make sure
>   that the trampoline is entered every time a thread is parked and
>   the stack marker is set and reset appropriately;
> - disallows explicit use of ParkedScope; and
> - updates tests that used the previous logic.
>
> Change-Id: Ia01343d5685cfe4537202e8940bf0cd7d614d8fc
>
> Bug: 41480448
> Bug: 42203211
> Change-Id: Ia01343d5685cfe4537202e8940bf0cd7d614d8fc
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5563331
> Commit-Queue: Nikolaos Papaspyrou <nikolaos@chromium.org>
> Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
> Reviewed-by: Omer Katz <omerkatz@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#94134}

Bug: 41480448
Bug: 42203211
Change-Id: I785f56d0af6e3bcfe08547081db718b2ba21032f
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5575089
Owners-Override: Matthias Liedtke <mliedtke@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Cr-Commit-Position: refs/heads/main@{#94138}
2024-05-28 13:09:32 +00:00
Matthias Liedtke d7751fd0a0 Update V8 DEPS (trusted) instrumented_libraries
Rolling third_party/instrumented_libs
https://chromium.googlesource.com/chromium/third_party/instrumented_libraries/+log/0172d67..563ee6c

Change-Id: I2e569f05c8c3d5b7d55dad8a2a66f5ed8e10060a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5575027
Reviewed-by: Eva Herencsárová <evih@chromium.org>
Commit-Queue: Eva Herencsárová <evih@chromium.org>
Auto-Submit: Matthias Liedtke <mliedtke@chromium.org>
Cr-Commit-Position: refs/heads/main@{#94133}
2024-05-28 11:55:04 +00:00
Matthias Liedtke e61685a1b6 Update V8 DEPS (trusted)
Manual change: Not Rolling third_party/instrumented_libs!
Planned:
https://chromium.googlesource.com/chromium/third_party/instrumented_libraries/+log/0172d67..f75a3f1
This caused errors with `checkout_instrumented_libraries`:
  File "[...]/v8/depot_tools/gclient_eval.py", line 643, in _convert
    raise ValueError('invalid "and" operand %r (inside %r)' %
ValueError: invalid "and" operand 'non_git_source' (inside '(checkout_instrumented_libraries and non_git_source) and (checkout_instrumented_libraries)')

Rolling build: https://chromium.googlesource.com/chromium/src/build/+log/d273a5a..5ecb9a9

Rolling third_party/catapult: https://chromium.googlesource.com/catapult/+log/ec40c25..24a969a

Rolling third_party/depot_tools: https://chromium.googlesource.com/chromium/tools/depot_tools/+log/09c232e..97246c4

Rolling third_party/googletest/src: https://chromium.googlesource.com/external/github.com/google/googletest/+log/9b4993c..305e5a2

Rolling third_party/libc++abi/src: https://chromium.googlesource.com/external/github.com/llvm/llvm-project/libcxxabi/+log/5067b87..b663b9c

Rolling third_party/libunwind/src: https://chromium.googlesource.com/external/github.com/llvm/llvm-project/libunwind/+log/e0a4f35..8c5b971

Rolling tools/clang: https://chromium.googlesource.com/chromium/src/tools/clang/+log/9772a0a..7d6eb60

Roll created at https://cr-buildbucket.appspot.com/build/8746726292535774945

Change-Id: Ic10c09d5bf19a049030b14cdf2e4ce5fd57c11c7
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5572657
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Reviewed-by: Eva Herencsárová <evih@chromium.org>
Cr-Commit-Position: refs/heads/main@{#94132}
2024-05-28 11:31:42 +00:00
Matthias Liedtke 2c80eed7cb [owners] Add evih@ to COMMON_OWNERS
Change-Id: I5ed1938b758e79365b0151674d0d52743caa8661
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5575031
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Auto-Submit: Matthias Liedtke <mliedtke@chromium.org>
Cr-Commit-Position: refs/heads/main@{#94131}
2024-05-28 11:15:01 +00:00
Matthias Liedtke 81f93e10b8 [deoptimizer][wasm] Test memory access after deopt
Liftoff caches the memory start address and reuses it on repeated
accesses. Deopt points may only be at calls at which liftoff
invalidates the cached register anyways.

Bug: 42204618
Change-Id: I07e26d5720b97745c1edfd74872df44b9ca42fed
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5573729
Auto-Submit: Matthias Liedtke <mliedtke@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Cr-Commit-Position: refs/heads/main@{#94126}
2024-05-28 09:26:50 +00:00
Matthias Liedtke 4c1c3557af [deoptimizer][wasm] Unset thread_in_wasm flag in deoptimizer
Bug: v8:42204618
Change-Id: I53005c936388d54bb756d2739953d3d286a6a8cd
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5573725
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Auto-Submit: Matthias Liedtke <mliedtke@chromium.org>
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Cr-Commit-Position: refs/heads/main@{#94124}
2024-05-28 09:06:47 +00:00
Matthias Liedtke 2694af8ba6 [deoptimizer][wasm] Address a few minor TODOs
Bug: 42204618
Change-Id: I1bb92e8447bcb2ea4a13d581d2a5378df41a20ec
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5562404
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Auto-Submit: Matthias Liedtke <mliedtke@chromium.org>
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Cr-Commit-Position: refs/heads/main@{#94105}
2024-05-27 12:18:51 +00:00
Matthias Liedtke 8eee400159 [turboshaft][wasm] Improve inlining traces
Just adding a little bit more information to the tracing that was
included in the turbofan traces as well.

Bug: 41480394
Change-Id: I158b6bae46d43dc001e6fa1cb0d99e785c7ed75c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5569192
Auto-Submit: Matthias Liedtke <mliedtke@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Cr-Commit-Position: refs/heads/main@{#94075}
2024-05-24 11:44:51 +00:00
Matthias Liedtke 06949a68d0 [deoptimizer][wasm] Support deopt inside inlined call_ref
This requires passing information to liftoff if the location for which
we request the LiftoffFrameDescriptionForDeopt for call_ref is actually
about a deopt point (i.e. at the beginning of the call_ref instruction
and therefore prior to the call or about an inlined location in which
case it is about the location at the call / directly after the call.

Bug: 42204618
Change-Id: Ibca128fc307049072bda5a0491780790275e8967
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5558965
Reviewed-by: Manos Koukoutos <manoskouk@chromium.org>
Commit-Queue: Manos Koukoutos <manoskouk@chromium.org>
Auto-Submit: Matthias Liedtke <mliedtke@chromium.org>
Cr-Commit-Position: refs/heads/main@{#94058}
2024-05-23 12:43:12 +00:00
Matthias Liedtke 05dc8e041c [wasm] Enable inlining by default
This enables the wasm-into-wasm inlining by default for non wasm-gc
modules (for wasm-gc modules it has already been enabled by default
since launching wasm-gc).

Also use atomic accesses to `WasmModule::num_small_functions` which is
read by background compilation jobs.

Bug: 40898108
Change-Id: Id4b34aea6b63e3b67d9dd9a1c19230f400c40071
Fixed: 341971943
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5562486
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Auto-Submit: Matthias Liedtke <mliedtke@chromium.org>
Cr-Commit-Position: refs/heads/main@{#94055}
2024-05-23 11:43:13 +00:00
Matthias Liedtke aace42af90 [deoptimizer][wasm] Support deopt inside inlined direct return call
Pseudo code example:
  function a(target) {
    return_call b(target);
  }
  function b(target) {
    call_ref(target)();
  }
  function c() {}
  function d() {}

In this case we might have type feedback for b that target == c.
When we optimize a, we inline b and speculatively inline c with a
deoptIfNot(target == c).
Now, if we call a(d), even though a is the optimized function with the
"wrong" speculation, we only construct an unoptimized output frame for
b, but not for a, as the return_call has already happened.
We still need to "throw away" the optimized code for a though as it
contains the mis-speculation.

Bug: 42204618
Change-Id: I6b6a9de6b47b97cefee610e273b63f1048e27d41
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5554494
Auto-Submit: Matthias Liedtke <mliedtke@chromium.org>
Reviewed-by: Manos Koukoutos <manoskouk@chromium.org>
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Cr-Commit-Position: refs/heads/main@{#94024}
2024-05-22 10:01:08 +00:00
Matthias Liedtke 826de929e0 [deoptimizer][wasm] Correct handling of inlined parameter stack slots
- fix using the wrong parameter stack slot count in case of inlined
  frames
- zero out the intermediate parameter stack slots to support GC runs
  on the deoptimized frames
- fix the frame slot calculation for the trusted instance in case of
  inlined frames
- fix the calculation of caller_frame_top_ in case of inlined frames
  with different parameter counts
- fix the feedback vector lookup in case of imported functions
- fix the smi tagging of the frame type marker on non-pointer-
  compressed builds: The tagging always performs a left shift by 1
  while the smi tagging shifts by 32...

Bug: 42204618
Change-Id: I9bfc15504a674d9a84e9846942614fa4be623ee0
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5545239
Auto-Submit: Matthias Liedtke <mliedtke@chromium.org>
Reviewed-by: Manos Koukoutos <manoskouk@chromium.org>
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Cr-Commit-Position: refs/heads/main@{#94003}
2024-05-21 11:21:20 +00:00
Matthias Liedtke 5ac1c1ddf7 [deoptimizer][wasm] Remove trusted intance from deopt data
The trusted instance is stored at a known location in the optimized
stack frame, so we don't need to waste any bytes on storing extra
deopt data for it.

Bug: 42204618
Change-Id: I872cc686668dfce94ae4eaf0697954a99c5b03ad
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5543928
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Reviewed-by: Manos Koukoutos <manoskouk@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93973}
2024-05-17 13:45:19 +00:00
Matthias Liedtke d7ae23bbc8 [codegen] Re-enable frame type check for wasm deopts
Differently to JavaScript in Wasm optimized and unoptimized frames have
the same frame type marker, so this check should indeed hold true even
in case of deopts.

Bug: 42204618
Change-Id: I99c9bf20625c425b0636dee630d855bd50b93f9e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5543926
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Reviewed-by: Darius Mercadier <dmercadier@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93971}
2024-05-17 13:41:23 +00:00
Matthias Liedtke 42e12febbd [deoptimizer][wasm] Basic handling of inlined frames on deopt
This adds some basic implementation for having inlined frames at the
deopt point. This requires mapping the one "input" / optimized frame to
multiple output liftoff frames.

The test cases do not cover the intricacies of parameter stack slots,
preserving the correct values of stack slots in general and also only
provides an implementation for inlining at call_direct, while all tail
call variants as well as call_ref and call_indirect are not implemented
yet.

Bug: 42204618
Change-Id: I4ccc18767c6ebad1df96dae6477680abc1b07771
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5538057
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Reviewed-by: Manos Koukoutos <manoskouk@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93970}
2024-05-17 13:06:38 +00:00
Matthias Liedtke 1fd82da404 [wasm][fuzzer] Limit size of array.new_fixed for non-defaultable types
The fuzzer still creates coverage for larger array.new_fixed for
defaultable element types for which the fuzzer can always generate an
easy struct.new_default.

Fixed: 340651309
Change-Id: I49b84374f80adc79a6eadeae137514dbcfa276fd
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5544137
Auto-Submit: Matthias Liedtke <mliedtke@chromium.org>
Reviewed-by: Eva Herencsárová <evih@chromium.org>
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93946}
2024-05-16 12:07:02 +00:00
Matthias Liedtke ec8a6ecfc1 [turboshaft] V<>ify Turboshaft
Operations processed:
- StructGet
- StructSet

Bug: 331100916
Change-Id: If521dc0469a5341a4ea65be8cbc4927c7ae8e595
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5538171
Auto-Submit: Matthias Liedtke <mliedtke@chromium.org>
Reviewed-by: Darius Mercadier <dmercadier@chromium.org>
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93927}
2024-05-15 17:08:51 +00:00
Matthias Liedtke 31d3aab93c [cleanup] Rename Simd128 array types
Follow-up to https://crrev.com/c/5513446.

Bug: 42204618
Change-Id: I6eee3fba9740f0485d28e635d26d63257ebf02dd
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5522444
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93926}
2024-05-15 17:06:27 +00:00
Matthias Liedtke bc7c7b002a [deoptimizer][wasm] Properly handle tagged stack slots
The previous implementation used wasm::value_kind_size() to determine
the size of the liftoff stack slot. This doesn't work for reference
types as value_kind_size() is 4 (e.g. when stored in an object) but the
stack slot stores the uncompressed pointer (meaning kSystemPointerSize
on 64 bit systems).

Also update `TODO(14667)` to `TODO(42204618)` due to updated bug
numbers after the issue tracker migration.

Bug: 42204618
Change-Id: I5501947748132167d704f0e5810ed84f8fda8bca
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5518456
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Reviewed-by: Manos Koukoutos <manoskouk@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93922}
2024-05-15 15:37:19 +00:00
Matthias Liedtke 566f734f40 [deoptimizer][wasm] Support Simd128 values
Attention: This CL changes how JavaScript handles double registers!

This CL adds support for Simd128 values in the deoptimizer for wasm.
Note that wasm deoptimizations are WIP and the current state is only
implemented for x64.
However, to support Simd128, the deoptimizer needs to know about
Simd128 register values which overlap with double register values.
So we need to migrate double register value handling to use Simd128
registers instead (meaning the 128 bit registers instead of the 64 bit
variants).

For JavaScript, this means that we need to move twice the amount of
data for the double registers. In most cases: Push the value from the
register to the stack, then copy it from the stack to the input
FrameDescription, copy it from the FrameDescription to the
TranslatedValue, from there into the outgoing FrameDescription and
finally from there back into the register (if it's still in a register
that is).

Bug: 42204618
Change-Id: I7253d037460a095f893cea239d448b1977007d41
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5513446
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93911}
2024-05-15 10:15:29 +00:00
Matthias Liedtke d4ca3766ac Revert "[interpreter] Only Clear/Restore pending messages when CMD_RETHROW"
This reverts commit 1f2786cb07.

Reason for revert: This fails the dawn linux webgpu tests on the roll
Tested here: https://chromium-review.googlesource.com/c/v8/v8/+/5537909
Example failing run: https://ci.chromium.org/ui/p/chromium/builders/try/dawn-linux-x64-deps-rel/b8747993766768639409/test-results?q=ExactID%3Aninja%3A%2F%2Fchrome%2Ftest%3Atelemetry_gpu_integration_test%2Fgpu_tests.webgpu_compat_cts_integration_test.WebGpuCompatCtsIntegrationTest.webgpu%3Aapi%2Cvalidation%2Cimage_copy%2Cbuffer_related%3Abytes_per_row_alignment%3Amethod%3D%22CopyT2B%22%3Bformat%3D%22astc-10x10-unorm-srgb%22%3Bdimension%3D%222d%22+VHash%3Add4a1acfa6306716&clean=&sortby=&groupby=

Original change's description:
> [interpreter] Only Clear/Restore pending messages when CMD_RETHROW
>
> We only need to save/restore pending messages when we're catching and rethrowning an exception, so push the code to paths that handle CMD_RETHROW. (We always pass through RETHROW if we caught since we might rethrow. This could be overwritten later of course, in which case we won't restore.)
>
> This is a reland of https://chromium-review.googlesource.com/c/v8/v8/+/5529233 with a test for the blocking failure. The fix is to avoid reusing the register between the context that's stashed for the `try` and the `message`. Otherwise in loops with a finally that exit the loop through the rethrow path, sloppy tracking of loop assignments thinks the context cache is assigned (by the reused message); causing a loop phi to be created.
>
> A possible cleaner solution is to not store the context at runtime at all, and to recompute the context. However, our optimizing compilers also rely on the interpreter stashing the context on the side for `catch`, so it's not trivial to change this.
>
>
> Change-Id: I2a75a248ad252e30540268b575be0fe1380c097f
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5534748
> Reviewed-by: Victor Gomes <victorgomes@chromium.org>
> Commit-Queue: Victor Gomes <victorgomes@chromium.org>
> Commit-Queue: Toon Verwaest <verwaest@chromium.org>
> Auto-Submit: Toon Verwaest <verwaest@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#93866}

Change-Id: I3e8d95cedecc8808d56dac85f05f6fa4a8337484
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5537973
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Owners-Override: Matthias Liedtke <mliedtke@chromium.org>
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93896}
2024-05-14 13:50:50 +00:00
Matthias Liedtke e0c5cf4cc2 [turboshaft] V<>ify Turboshaft
Operations processed:
- WasmAllocateArray
- WasmAllocateStruct
- WasmRefFunc

Bug: 331100916
Change-Id: Ie570af301d8623af896324d56b3ee4aca3bb2b1d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5535195
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Commit-Queue: Darius Mercadier <dmercadier@chromium.org>
Auto-Submit: Matthias Liedtke <mliedtke@chromium.org>
Reviewed-by: Darius Mercadier <dmercadier@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93884}
2024-05-14 11:04:18 +00:00
Matthias Liedtke 4edd625bca Revert "[turboshaft] Maglev-to-ts: support GetIterator"
This reverts commit f50d654590.

Reason for revert: Failures on multiple builds, e.g. Linux Shared:
https://ci.chromium.org/ui/p/v8/builders/ci/V8%20Linux%20-%20shared/59524/overview

Original change's description:
> [turboshaft] Maglev-to-ts: support GetIterator
>
> Bug: 42204525
> Change-Id: I50170c52eae203da1635b1835da6ab21c1573863
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5526491
> Auto-Submit: Darius Mercadier <dmercadier@chromium.org>
> Reviewed-by: Matthias Liedtke <mliedtke@chromium.org>
> Commit-Queue: Darius Mercadier <dmercadier@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#93861}

Bug: 42204525
Change-Id: I3ef409a276632d16860374201f6773bca976cca6
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5535189
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main@{#93863}
2024-05-13 15:13:24 +00:00
Matthias Liedtke cc05792346 [builtins] HasOnlySimpleElements is false for non-JSObjects
Bug: 338908243
Change-Id: I91139167fb186d56db1695a05e0173069c6c195b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5529235
Auto-Submit: Matthias Liedtke <mliedtke@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93820}
2024-05-10 09:27:31 +00:00
Matthias Liedtke b78302925f [deoptimizer][wasm] Add basic tracing of deopt events
Bug: 42204618
Change-Id: I4ae442d0f91d59cfdcaa998efb561a6ffd815c9d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5509451
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Nico Hartmann <nicohartmann@chromium.org>
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93764}
2024-05-07 12:39:58 +00:00
Matthias Liedtke 731d096036 [deopt][wasm] Do not emit deopt node in case of non-inlined targets
Besides an implementation error causing an out-of-bounds array access
if the last known polymorphic / monomorphic call target is not inlined,
having a deopt node on the slow path could cause deopt loops.

Fixed: 339115607
Bug: 42204618
Change-Id: I0da7ef9c8a0403a2f972d740a3ae081e6da4a926
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5518892
Reviewed-by: Daniel Lehmann <dlehmann@chromium.org>
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Auto-Submit: Matthias Liedtke <mliedtke@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93761}
2024-05-07 12:06:29 +00:00
Matthias Liedtke 34736b8b1c [deoptimizer][wasm] Add support for parameter stack slots
This adds support for deopting a function that has parameters passed
via stack slots.

This requires the deoptimizer to include the parameter stack slots
into the FrameDescription which also requires to include the stack
objects between the frame and the parameter slots (2 slots) and then
to "copy" this over to the output FrameDescription.

Bug: 42204618
Change-Id: I74884ca77a4817ccb7b0f7319bd81fdb9014b5a1
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5498887
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93741}
2024-05-06 16:21:28 +00:00
Matthias Liedtke df269d128a [deoptimizer][wasm] FrameState: Use 0 as dummy input
Wasm doesn't have a JS closure, nor does it have a context.
Use a __ SmiConstant(0) as dummy value to keep the overhead as small as
possible.

Bug: 42204618
Change-Id: I1071827d132dc9962958b9b21d95721a0377511a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5518453
Reviewed-by: Eva Herencsárová <evih@chromium.org>
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Auto-Submit: Matthias Liedtke <mliedtke@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93738}
2024-05-06 14:38:35 +00:00
Matthias Liedtke 4da4042743 [turboshaft] V<>ify Turboshaft
Operations processed:
- Simd128ExtractLaneOp
- Simd128ReplaceLaneOp
- Simd128LoadTransformOp

Bug: chromium:331100916
Change-Id: I86ed46fe045cabe430e23379a259c4bbb931a630
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5518452
Commit-Queue: Thibaud Michaud <thibaudm@chromium.org>
Auto-Submit: Matthias Liedtke <mliedtke@chromium.org>
Reviewed-by: Thibaud Michaud <thibaudm@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93736}
2024-05-06 13:27:26 +00:00
Matthias Liedtke 91ad9bec5e [turboshaft] V<>ify Turboshaft
Operations processed:
- Simd128SplatOp
- Simd128TernaryOp
- Simd128TestOp
- Simd128UnaryOp

Bug: 331100916
Change-Id: I1b71dfd8138faea6093d3afdd951a0a0d379c0ce
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5512755
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Reviewed-by: Thibaud Michaud <thibaudm@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93731}
2024-05-06 12:34:39 +00:00
Matthias Liedtke ce57d21651 [turboshaft] V<>ify Turboshaft
Operations processed:
- Simd128BinOp
- Simd128ConstantOp (already done)
- Simd128ShiftOp
- Simd128ShuffleOp

Bug: 331100916
Change-Id: I7c7e840e2a98fcdf671eb76d6086a11345421359
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5516849
Auto-Submit: Matthias Liedtke <mliedtke@chromium.org>
Commit-Queue: Thibaud Michaud <thibaudm@chromium.org>
Reviewed-by: Thibaud Michaud <thibaudm@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93730}
2024-05-06 11:41:23 +00:00
Matthias Liedtke 52beeb38a0 [mjsunit][wasm] Disable deopt tests in multi-isolate mode
Fixed: 338945124
Bug: 42204618
Change-Id: I6eb714289d2fc6d8e119302dda06dc34df730dca
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5516583
Auto-Submit: Matthias Liedtke <mliedtke@chromium.org>
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93728}
2024-05-06 11:30:37 +00:00
Matthias Liedtke b032f063df [deoptimizer] Make FrameDescription::operator new private
Also make the constructor private.
The FrameDescriptor class accesses (both read&write) memory outside of
its object assuming that additional memory was allocated for the
parameters. This implementation detail shouldn't leak outside of the
class itself.

Bug: 42204618
Change-Id: Iad691b6d4d5a9731eaacc9e34f632769b5a14061
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5492422
Reviewed-by: Nico Hartmann <nicohartmann@chromium.org>
Auto-Submit: Matthias Liedtke <mliedtke@chromium.org>
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93724}
2024-05-06 09:53:27 +00:00
Matthias Liedtke 34043efef8 [deoptimizer][wasm] Support literal values
This CL adds support for literals (i.e. values that are constants in
the optimizing compiler) to the wasm deoptimization.

The supported types are i32, i64, f32, f64, i31ref.

Bug: 42204618
Change-Id: Id40ca62d79be805acfcd22f01c91f4645bc8ac98
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5501046
Reviewed-by: Nico Hartmann <nicohartmann@chromium.org>
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93723}
2024-05-06 09:33:43 +00:00
Matthias Liedtke 4a3567fb47 [turboshaft] V<>ify Turboshaft
Operations processed:
- GlobalGetOp
- GlobalSetOp

Bug: 331100916
Change-Id: I10d9d4c5c778de6b634a05d9e1886a19d880ab6c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5514294
Auto-Submit: Matthias Liedtke <mliedtke@chromium.org>
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93722}
2024-05-06 09:27:27 +00:00
Matthias Liedtke 15848468d4 [deoptimizer] Add dmercadier and mliedtke as owners
Change-Id: I404fd4fc29cd38974ddb9db3037cfb82c0713fb5
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5516581
Auto-Submit: Matthias Liedtke <mliedtke@chromium.org>
Commit-Queue: Nico Hartmann <nicohartmann@chromium.org>
Reviewed-by: Nico Hartmann <nicohartmann@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93718}
2024-05-06 08:44:59 +00:00
Matthias Liedtke f8f36d0a34 [deoptimizer][wasm] Support the most simple deopt case
This CL adds a first version of deopt support for WebAssembly
supporting the included test case. Many basic features are still
missing like:
- parameters that are passed on the stack and not as registers
- literals
- floating point registers
- inlined deopt point (requires multiple output frames)
- S128 values (SIMD)

Bug: 42204618
Change-Id: Idac1c3ed17fad9250ca6ed7958f870347e1fbc1d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5467825
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Reviewed-by: Manos Koukoutos <manoskouk@chromium.org>
Reviewed-by: Nico Hartmann <nicohartmann@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93604}
2024-04-26 09:39:57 +00:00
Matthias Liedtke b0ff63bd5b [turboshaft] V<>ify Turboshaft
Operations processed:
- AssertNotNull
- IsNull
- AnyConvertExtern
- ExternConvertAny

Bug: 331100916
Change-Id: I6ff9219d04d3a93a71fdd197e6f8b51b4f6711f4
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5487861
Reviewed-by: Darius Mercadier <dmercadier@chromium.org>
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93569}
2024-04-25 09:11:41 +00:00
Matthias Liedtke 70bcf674be [deoptimizer] Remove unused context member
Bug: 42204618
Change-Id: I3edd22485c4ea5aece2e65ec8555fe97ac8d7cf3
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5481799
Auto-Submit: Matthias Liedtke <mliedtke@chromium.org>
Commit-Queue: Nico Hartmann <nicohartmann@chromium.org>
Reviewed-by: Nico Hartmann <nicohartmann@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93568}
2024-04-25 08:55:47 +00:00
Matthias Liedtke 3fba7f2703 [wasm][liftoff] Move frame constants to frame constants header
This allows access to these constants outside of lifotff, e.g. by the
deoptimizer who also needs to "understand" the liftoff frame layout.

Bug: 42204618
Change-Id: If9ee5fc89d41046e9d97e4f67569a8ff465dfbbb
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5473606
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93540}
2024-04-23 18:17:06 +00:00
Matthias Liedtke e452d9e53c [wasm][turbofan] Fix wrong types for memory.size
By always picking the first memory to decide on the integer type of
memory.size, we might either wrongly explicitly truncate it and
implicitly extend it or wrongly explicitly extend it to then
implicitly truncate it.

In either case, Turbofan does not seem care about these type
differences and the value can never be larger than int32 max, so this
is just an inconsistency.

Bug: 42204191
Change-Id: Ib04a8dccb0f0faa63930211136f0b5acf3ed89a2
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5472109
Auto-Submit: Matthias Liedtke <mliedtke@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93508}
2024-04-22 18:06:09 +00:00
Matthias Liedtke 5b3831e751 [turboshaft] V<>ify Turboshaft
Operations processed:
- RttCanon
- WasmTypeCast
- WasmTypeCheck

Bug: 331100916
Change-Id: Ie9de0ccf9afb69519b268e7d26f32559a5d8de1c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5471968
Reviewed-by: Darius Mercadier <dmercadier@chromium.org>
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Auto-Submit: Matthias Liedtke <mliedtke@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93493}
2024-04-22 12:15:32 +00:00
Matthias Liedtke df3808faa4 [turboshaft][wasm] Fix wrong FrameState input order and count
The wasm stack values were pushed in the "wrong" order (i.e. not
consistent with the order of the VarStates in liftoff.

There was also a mistake on the count of locals.
The correct calculation is:
- values on the value stack `decoder->stack_size()`
- wasm function locals `ssa_env_.size() - param_count`
Unfortunately, the decoder value stack already describes the state
after the call_ref instruction, so we need to adapt the following:
- add the call_ref callee
- add the wasm trusted instance (implicit argument to the call_ref)
- add the call's explicit arguments
- subtract the call's results (as these are pushed after the call)

Drive-by change: Include deopt data size in WasmCode to wasm memory
usage estimation.

Bug: 42204618
Change-Id: Ic460f47b27dcfdaaa2054bcebcb4f7eae72d19bc
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5468102
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Reviewed-by: Manos Koukoutos <manoskouk@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93475}
2024-04-19 16:55:20 +00:00
Matthias Liedtke a34e526767 [liftoff] Collect frame descriptions during compilation
Liftoff has to collect the frame descriptions for the deopt points so
that the deoptimizer can rebuild the full liftoff frame.

Bug: 42204618
Change-Id: Icf8427516b9303f259e4650b89914b1b7f0d79f3
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5467813
Reviewed-by: Manos Koukoutos <manoskouk@chromium.org>
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93472}
2024-04-19 16:11:29 +00:00
Matthias Liedtke 2d778f373d [liftoff] Carve out VarState into own header
This CL moves the VarState out of the liftoff assembler.
VarState describes the location of a wasm variable (like a value on the
wasm value stack, a local or a parameter) and defines its "physical"
location (i.e. a register, a stack slot or a constant).

This information is needed by the deoptimizer to be able to construct a
Liftoff frame as, differently to unoptimized JS frames, the wasm frame
layout depends on internal liftoff details like register allocation.

Bug: 42204618
Change-Id: I5b55459541fd54796bcb4bbab0ef854fefbda27f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5463596
Reviewed-by: Manos Koukoutos <manoskouk@chromium.org>
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93466}
2024-04-19 14:18:25 +00:00
Matthias Liedtke 997a0ef1c9 [compiler][wasm] Generate and serialize deopt data for wasm code
This CL adds the generation of wasm deopt data as part of Turboshaft
code generation and adds the serialized metadata to the WasmCode
object.

The deopt data includes:
- deopt exits (mapping from PC offset to wire bytes offset and
  translation index)
- translations (data about the inputs to the FrameState and their
  locations, e.g. register, stack offset, literal)
- literals (literal values used within the translations)

Bug: v8:14667
Change-Id: I6ac03df929d25bc632af44f56a170179632630ab
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5447118
Reviewed-by: Manos Koukoutos <manoskouk@chromium.org>
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93427}
2024-04-18 08:39:24 +00:00
Matthias Liedtke f8bab48b52 [liftoff] Remove unreachable leftover bailout code for gc
All the gc types are listed in
LiftoffCompiler::kUnconditionallySupported.

Bug: v8:14034
Change-Id: I5fe1508fbffff17a35f8804e494f27fa32bd9c31
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5453414
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Reviewed-by: Manos Koukoutos <manoskouk@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93426}
2024-04-18 08:34:19 +00:00
Matthias Liedtke cb4f794605 [liftoff] Remove bailouts for unsupported SIMD
Liftoff has multiple soft bailouts for trying to generate SIMD
instructions when the hardware does not support SIMD natively.
These cases are not supported by V8 at all and are already rejected by
the decoder, so liftoff can just rely on that.

Change-Id: I3e5ad4892e8579b5b4dd5e13c32a1b3e12fbc9f3
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5454311
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Auto-Submit: Matthias Liedtke <mliedtke@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93387}
2024-04-16 12:43:25 +00:00
Matthias Liedtke fff58a08d2 [deoptimizer] Untangle frame translation iterator from heap
The DeoptimizationFrameTranslation::Iterator requires the byte array to
be allocated on the heap. As wasm is isolate-independent, it cannot
have this data on the heap and it cannot create a "heapified" copy on
demand (as it isn't safe to allocate on the heap during frame
translation).

This CL moves the implementation of the iterator to a class taking a
raw byte vector. For JS, the original class is a trivial wrapper around
this implementation.

Bug: v8:14667
Change-Id: Ic8bcbe3466914c725e5d6b638d91052be82b37d5
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5443269
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93337}
2024-04-12 10:21:34 +00:00
Matthias Liedtke f84434a428 [test][turboshaft][wasm] Add repro for ISEL normalization
Adds repro for commit b86c0d3d41.

Bug: 333754542, v8:14108
Change-Id: I756ec27e5e8124a33689b9f10fbc18e185334c0d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5447007
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Commit-Queue: Darius Mercadier <dmercadier@chromium.org>
Auto-Submit: Matthias Liedtke <mliedtke@chromium.org>
Reviewed-by: Darius Mercadier <dmercadier@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93315}
2024-04-11 10:40:12 +00:00
Matthias Liedtke 50cb762531 [wasm][turboshaft] Add liftoff frame size to deopt FrameState
Bug: v8:14667
Change-Id: I319a00074be99bd18570bb1e15bbee448ae2e9be
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5433058
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93300}
2024-04-10 17:22:39 +00:00
Matthias Liedtke 86684e9647 [wasm][deoptimizer] Add FrameStateType for liftoff frames
This CL adds a new FramestateType::kkWasmLiftoffFunction and the
corresponding TranslatedFrame::kWasmLiftoffFunction and
TranslationOpcode::WASM_LIFTOFF_FRAME.

Bug: v8:14667
Change-Id: I767bc06adccfe9b9f233a083f1e0dcdf11aa8ca3
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5433057
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Reviewed-by: Nico Hartmann <nicohartmann@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93287}
2024-04-10 11:11:46 +00:00
Matthias Liedtke cf163dba9b Reland "[turboshaft][wasm][memory64] Fix bounds check for memory64 guard region"
This is a reland of commit ad5d69b8b0

Change to original land:
Skip the added test case on arm64 runs without pointer compression.

Original change's description:
> [turboshaft][wasm][memory64] Fix bounds check for memory64 guard region
>
> Fixed: 332939161
> Change-Id: I52d8f2f35116acbd580a1aec0291aae2f6faec00
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5435047
> Auto-Submit: Matthias Liedtke <mliedtke@chromium.org>
> Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
> Reviewed-by: Clemens Backes <clemensb@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#93270}

Bug: v8:14716
Fixed: 332939161
Change-Id: Idd28342963a2a7ee21b6422838120e3d1fa23d34
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5442852
Auto-Submit: Matthias Liedtke <mliedtke@chromium.org>
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93286}
2024-04-10 10:51:55 +00:00
Matthias Liedtke ad5d69b8b0 [turboshaft][wasm][memory64] Fix bounds check for memory64 guard region
Fixed: 332939161
Change-Id: I52d8f2f35116acbd580a1aec0291aae2f6faec00
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5435047
Auto-Submit: Matthias Liedtke <mliedtke@chromium.org>
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93270}
2024-04-09 16:51:27 +00:00
Matthias Liedtke 89f08ea561 [turboshaft] V<>ify Turboshaft WasmTypeAnnotationOp
This CL also adapts some builtin call interfaces both in Turboshaft as
well as in Torque.

Bug: 331100916
Change-Id: Id03dd150f099f00fa32c1a3d003a7014c11e5d4f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5435319
Auto-Submit: Matthias Liedtke <mliedtke@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93265}
2024-04-09 14:14:42 +00:00
Matthias Liedtke 4aafbffa94 Revert "[tracing] Use base::TimeTicks for trace macro timestamps"
This reverts commit 33774bd08e.

Reason for revert: Failing the chromium roll:
https://ci.chromium.org/ui/p/chromium/builders/try/linux_chromium_compile_dbg_ng/1965774/overview

Original change's description:
> [tracing] Use base::TimeTicks for trace macro timestamps
>
> This fixes an issue where performance.measure slices had incorrect
> timestamps when running with perfetto (the legacy tracing used
> microseconds, while perfetto uses nanoseconds, and we were passing in an
> int64_t without units).
>
> Change-Id: I42bec62fb350bd2090ed12b3b0db111625ff03f5
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5435116
> Reviewed-by: Camillo Bruni <cbruni@chromium.org>
> Auto-Submit: Leszek Swirski <leszeks@chromium.org>
> Commit-Queue: Camillo Bruni <cbruni@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#93259}

Change-Id: I424b7bc0b917bb95ece808e6dd155cfee39544d5
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5439413
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Owners-Override: Matthias Liedtke <mliedtke@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main@{#93262}
2024-04-09 12:52:33 +00:00
Matthias Liedtke 825ab7cde2 Revert "[sandbox] Turn ArrayBufferExtension into a EPT::ManagedResource"
This reverts commit f50c1f41e6.

Reason for revert: Failures on Mac arm64:
https://ci.chromium.org/ui/p/v8/builders/ci/V8%20Mac%20-%20arm64%20-%20debug/16991/test-results?sortby=&groupby=

Original change's description:
> [sandbox] Turn ArrayBufferExtension into a EPT::ManagedResource
>
> The lifetime of an (out-of-heap) ArrayBufferExtension is tied to the
> lifetime of an (in-heap) ArrayBuffer. As it is referenced through the
> external pointer table, it should therefore become a ManagedResource to
> explicitly tie the lifetime of the extension object to the EPT entry for
> it and thereby avoid potentially dangling EPT entries.
>
> Bug: chromium:327550517
> Change-Id: I217fcc1d719dcdcc2d9893c72fba616c78eb5b83
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5434873
> Commit-Queue: Samuel Groß <saelo@chromium.org>
> Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#93254}

Bug: chromium:327550517
Change-Id: Ib3728e97d5697359a232865d1154d8499bf82721
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5438118
Owners-Override: Matthias Liedtke <mliedtke@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93258}
2024-04-09 09:59:54 +00:00
Matthias Liedtke f16b8f7ebe Revert "[sandbox] sandboxify the Metadata pointer"
This reverts commit ad628eec26.

Reason for revert: failure on TSAN mksnapshot:
https://ci.chromium.org/ui/p/v8/builders/ci/V8%20Linux64%20TSAN%20-%20debug%20builder/7811/overview

Original change's description:
> [sandbox] sandboxify the Metadata pointer
>
> If the sandbox is enabled, keep a global array of metadata pointers for
> all MemoryChunks. This fixes chromium:40849120.
>
> Change-Id: Ia19c49d41b2f69c0cfa79571749dbd5515d33ed6
> Bug: chromium:40849120
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5385872
> Reviewed-by: Dominik Inführ <dinfuehr@chromium.org>
> Commit-Queue: Stephen Röttger <sroettger@google.com>
> Cr-Commit-Position: refs/heads/main@{#93224}

Bug: chromium:40849120
Change-Id: I0e980a14756695c83404cc6e56972ea1d665843f
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5434614
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Owners-Override: Matthias Liedtke <mliedtke@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93226}
2024-04-08 11:53:31 +00:00
Matthias Liedtke 975627b0fd [turboshaft] V<>ify Turboshaft
Mark wasm arrays as nullable for:
- ArrayGet
- ArraySet
- ArrayLength

This is a follow-up to commit c05df3ed5f.

Bug: 331100916
Change-Id: I0a8b8bfc81d8d80cb0240c420e148def59dab31b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5419795
Auto-Submit: Matthias Liedtke <mliedtke@chromium.org>
Reviewed-by: Nico Hartmann <nicohartmann@chromium.org>
Commit-Queue: Nico Hartmann <nicohartmann@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93221}
2024-04-08 10:24:50 +00:00
Matthias Liedtke 540fde5021 [x64][wasm] Disable --deopt-every-n-times on wasm
Wasm doesn't yet have deopt support, so this mode would only uncover
the deoptimizer crashing.
To support this flag, once wasm supports deopts, it will need to work
in an isolate-independent way in wasm.

Fixed: v8:14706
Change-Id: Id4a4a0fb0e879e0f3a747fd11f2a0202e7a832ab
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5434036
Auto-Submit: Matthias Liedtke <mliedtke@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93220}
2024-04-08 09:49:17 +00:00
Matthias Liedtke a70c938b11 [wasm][turboshaft] Add graph building for a deopt on call_ref
This CL adds a new feature flag --wasm-deopt, an experimental feature
to allow the optimizing compiler to emit deopts in the wasm pipeline
and for the runtime to support deopting wasm functions to their
baseline (liftoff) variant.

In a first version this will be built to deopt if the call target of a
call_ref instruction is mispredicted.
This first CL adds the code to emit a DeoptIf node and the FrameState
required to be able to build the corresponding unoptimized stack frame.

Bug: v8:14667
Change-Id: I2f61fa45725934b55779de4c991420c4307b60a8
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5421109
Auto-Submit: Matthias Liedtke <mliedtke@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93194}
2024-04-05 14:33:25 +00:00
Matthias Liedtke c05df3ed5f [turboshaft] V<>ify Turboshaft
Operations processed:
- ArrayGet
- ArraySet
- ArrayLength

Bug: 331100916
Change-Id: I7349b83cfb9300a5b0035637eb815f18bb3caa85
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5420109
Reviewed-by: Nico Hartmann <nicohartmann@chromium.org>
Auto-Submit: Matthias Liedtke <mliedtke@chromium.org>
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93148}
2024-04-03 18:33:07 +00:00
Matthias Liedtke 23539f9852 [d8][wasm] Add %WasmNull() intrinsic for testing
Change-Id: Ibb577916a7f15f78ef3e6a8621ed120512c64704
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5401772
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Reviewed-by: Manos Koukoutos <manoskouk@chromium.org>
Auto-Submit: Matthias Liedtke <mliedtke@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93113}
2024-04-02 12:29:59 +00:00
Matthias Liedtke 8cf3c93290 [turboshaft] AtomicRMWOp: Fix confusing namings
Calling the memory representation input_rep is somewhat misleading
given that the input into the rmw isn't the memory but the register
representation.
The input register representation (i.e. the value to be written) is
the same representation as the result representation, so it is renamed
to in_out_rep.

Change-Id: I49764f093d6366e5e45a75fbd975e3136e6a3d7c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5385340
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Auto-Submit: Matthias Liedtke <mliedtke@chromium.org>
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93067}
2024-03-27 13:56:01 +00:00
Matthias Liedtke f79be5c69e Revert "[heap] Use discard/recommit to manage RWX memory"
This reverts commit 9da8b31f3b.

Reason for revert: Failing on Mac arm64 (with and without ptr compression):
https://ci.chromium.org/ui/p/v8/builders/ci/V8%20Mac%20-%20arm64%20-%20debug%20builder/17816/overview

Original change's description:
> [heap] Use discard/recommit to manage RWX memory
>
> Instead of allocating pages on demand, set the permissions on the whole
> code cage at cage creation time and discard the region.
>
> Change-Id: Idb9dfecb0d9df12f094722b5bcb1243b561a9420
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5372649
> Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
> Commit-Queue: Stephen Röttger <sroettger@google.com>
> Cr-Commit-Position: refs/heads/main@{#93024}

Change-Id: I9a4a6a08e50549ce6154e86265093bc788e98606
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5392805
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Owners-Override: Matthias Liedtke <mliedtke@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93026}
2024-03-26 09:27:31 +00:00
Matthias Liedtke e9fc67a9b8 [compiler] Allow implicit truncation for graphs created from turbofan
It would be nice to not have implicit truncations from Word64 to
Word32 in Turboshaft as they are inconsistently sometimes explicit and
sometimes implicit.

However, as the same was true for Turbofan it is difficult to enforce
it on Turboshaft graphs created from Turbofan.

To have this asserted in Turboshaft-only cases (wasm, unittests,
Maglev->Turboshaft), pass this information downwards and relax the
assertion again in ValidOpInputRep.

Note: The implicit truncation was disallowed in
https://crrev.com/c/5380531 .

Fixed: 330638812
Change-Id: Id67d5781dfac88fd37131c0f49eb3fafa6cdcf0f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5385337
Auto-Submit: Matthias Liedtke <mliedtke@chromium.org>
Commit-Queue: Darius Mercadier <dmercadier@chromium.org>
Reviewed-by: Darius Mercadier <dmercadier@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93022}
2024-03-26 06:27:39 +00:00
Matthias Liedtke c949b7324b [wami] Fix heap type immedates in mjsunit mode
kWasmAnyRef is a negative integer and the module builder expects
positive integers in the function body, therefore kAnyRefCode should
be used instead.

Change-Id: I0319b41a5b981d5e4fa26bff01f5f75ef014f965
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5387890
Reviewed-by: Eva Herencsárová <evih@chromium.org>
Auto-Submit: Matthias Liedtke <mliedtke@chromium.org>
Commit-Queue: Eva Herencsárová <evih@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93006}
2024-03-25 15:07:31 +00:00
Matthias Liedtke cab020abbb [compiler][wasm] Fix ChangeInt32ToInt64 in TS + TF ISel
Fixed: 330767273
Change-Id: I02f60c5cb1c3f09adf84c53ddd5966404f2edffd
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5388386
Reviewed-by: Darius Mercadier <dmercadier@chromium.org>
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Commit-Queue: Darius Mercadier <dmercadier@chromium.org>
Auto-Submit: Matthias Liedtke <mliedtke@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93004}
2024-03-25 14:53:14 +00:00
Matthias Liedtke 68e6430d15 [turboshaft] Fix missing explicit truncation in smi tagging
Fixed: 330765777
Change-Id: If228cdb2566f935b587c695ea6ea04b6dcfc22b2
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5387741
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Reviewed-by: Darius Mercadier <dmercadier@chromium.org>
Commit-Queue: Darius Mercadier <dmercadier@chromium.org>
Auto-Submit: Matthias Liedtke <mliedtke@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92966}
2024-03-22 10:56:44 +00:00
Matthias Liedtke 7219d3597b [turboshaft] Disallow implicit truncation from word64 to word32
Bug: v8:12783
Change-Id: I432c378d4fe0e60d106a7530883b64f115a72bdc
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5380531
Auto-Submit: Matthias Liedtke <mliedtke@chromium.org>
Reviewed-by: Darius Mercadier <dmercadier@chromium.org>
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92945}
2024-03-21 13:30:28 +00:00
Matthias Liedtke 65278e5b04 [wasm][liftoff] Use subtype check in LoadNullValueForCompare
This is a follow-up to https://crrev.com/c/5371985.

Bug: v8:14034
Change-Id: I57abfaf9342863f54952b17b6575b7547d0069e1
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5372471
Auto-Submit: Matthias Liedtke <mliedtke@chromium.org>
Commit-Queue: Manos Koukoutos <manoskouk@chromium.org>
Reviewed-by: Manos Koukoutos <manoskouk@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92937}
2024-03-21 11:14:44 +00:00
Matthias Liedtke 7f11ec26aa [turboshaft] DeoptimizeIfOp: pretty print options
DeoptimizeIfOp printed a raw pointer.
This CL also changes cases where we used operator<<(const char*) to
print a single character.

Bug: v8:12783
Change-Id: I52ee8bf0c34013827e851be8045bafaffef0100e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5377873
Reviewed-by: Darius Mercadier <dmercadier@chromium.org>
Auto-Submit: Matthias Liedtke <mliedtke@chromium.org>
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92891}
2024-03-19 11:48:34 +00:00
Matthias Liedtke 5f1342c20b [wasm][exnref] Fix broken abstract casts
ref.test, ref.cast, br_on_cast, br_on_cast_fail allow arbitrary heap
types, so they also allow exnref and noexnref.

This CL also fixes the missing type checks in the js to wasm wrapper.

Bug: v8:14398
Change-Id: Ieefb9a8e99d3d7a4b175db60f55b7fa9a96c5203
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5372489
Reviewed-by: Thibaud Michaud <thibaudm@chromium.org>
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92867}
2024-03-18 10:21:25 +00:00
Matthias Liedtke 7c7a2030c6 [wasm][liftoff] Fix missing register on memory64 64 bit atomics
Fixed: 329706236
Change-Id: Idc620ce62cb44adb9cf9a12ad519578682a0f666
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5372052
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92857}
2024-03-15 16:32:04 +00:00
Matthias Liedtke 93cb22c99c [wasm] WasmNull: Use static roots
Bug: v8:14034
Change-Id: I0312fe1fabff732eb1253b4636f2713ea9308636
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5371985
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92852}
2024-03-15 14:28:56 +00:00
Matthias Liedtke e27eb15d64 [cleanup][wasm] Decoder: Share br_on_cast* validation
Bug: v8:14034
Change-Id: Ic260ffe24570dd9d1eb52f5d191af3c9f7dfa862
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5371764
Auto-Submit: Matthias Liedtke <mliedtke@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92844}
2024-03-15 10:56:53 +00:00
Matthias Liedtke 9a0d2ae30d [cleanup][wasm][liftoff] Remove BrOn*, RefAs*, RefIs* functions
These functions used to be exposed to the decoder but aren't any more.

Bug: v8:14034
Change-Id: I2582c1ab6a7a8bc490c6936a1d922e3e75dd8ba4
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5372448
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Auto-Submit: Matthias Liedtke <mliedtke@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92843}
2024-03-15 10:35:47 +00:00
Matthias Liedtke 50e10b1586 [wami] mjsunit mode: Add missing comma for kExprI64Const
Change-Id: Ibe03b89da1eff050ebbbc81822817239f67cc6b0
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5372648
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Auto-Submit: Matthias Liedtke <mliedtke@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92842}
2024-03-15 10:28:53 +00:00
Matthias Liedtke c4739f3974 [cleanup][wasm] Drop 'generic' suffix from br_on_cast
Bug: v8:14034
Change-Id: I41880b7d1d8b5100ce0829f249b1c7a346876b85
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5366894
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92833}
2024-03-14 18:44:33 +00:00
Matthias Liedtke 728bb4a20d [deoptimizer] Minor cleanups
Bug: v8:14667
Change-Id: I07078d9ef887154ba9542930ea132264a5f36788
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5372184
Reviewed-by: Nico Hartmann <nicohartmann@chromium.org>
Commit-Queue: Nico Hartmann <nicohartmann@chromium.org>
Auto-Submit: Matthias Liedtke <mliedtke@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92830}
2024-03-14 13:44:52 +00:00
Matthias Liedtke ab43aee368 Replace all uses of V8_FALLTHROUGH
Change-Id: Ic2157d51e942e31cf80e6a9ff981d49fd8e23f40
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5362053
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92812}
2024-03-13 14:32:20 +00:00
Matthias Liedtke fb2ceded1e [cleanup][wasm] Add inlining positions to NativeModule::AddCode
AddCode() is only called for wrappers, so the inlining_positions
is always empty. Still, as all use the WasmCompilationResult, it's just
as easy to pass through the vector from the compilation result as to
create a dummy vector.

Change-Id: I3288c4239d3d9788664434b92186349520845b07
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5367023
Auto-Submit: Matthias Liedtke <mliedtke@chromium.org>
Reviewed-by: Eva Herencsárová <evih@chromium.org>
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92799}
2024-03-13 09:04:47 +00:00
Matthias Liedtke d349a74d48 [compiler][wasm] ISel: Fix missing effect for StoreLane instruction
This CL also adds the StorePair and StoreIndirectPointer instruction to
the increment_effect_level_for_node routine.

Fixed: 329032153
Change-Id: If386548f7cd8b5e2be4d5b8c6f4574e11b6e717e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5367502
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Auto-Submit: Matthias Liedtke <mliedtke@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92794}
2024-03-12 19:26:57 +00:00
Matthias Liedtke 4a3890db6c [turboshaft][wasm] Add byte reversing for big endian platforms
The implementation is based on the existing Turbofan implementation in
wasm-compiler.cc.

Fixed: v8:14658
Change-Id: Ib6d6ea710c218585763057f6e428ce3ee9034b26
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5361036
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Reviewed-by: Manos Koukoutos <manoskouk@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92782}
2024-03-12 11:53:02 +00:00
Matthias Liedtke a42dfc6972 [cleanup] Fix TODO warning during presubmit
The space results in the following warning on `git cl upload`:
v8/src/maglev/maglev-graph-builder.cc:9288:
(cpplint) Missing username in TODO; it should look like
"// TODO(my_username): Stuff."  [readability/todo] [2]

Change-Id: I30467c6fcda8650487a7e44a555b04355bef14e1
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5361877
Auto-Submit: Matthias Liedtke <mliedtke@chromium.org>
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Reviewed-by: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92774}
2024-03-12 10:40:26 +00:00
Matthias Liedtke 99b8f489fc [base] Move V8_FALLTHROUGH to c++17
I just ran into a file complaining about not knowing what
V8_FALLTHROUGH is. I don't think there is any benefit for this macro
any more and we should move to using `[[fallthrough]]` instead.
As a first step, just changing what the macro does so that the change
and the renaming can be done in two steps to avoid reverts in case of
unforeseen issues.

Change-Id: I29186124fba3e7f6fb581c3c70fd39abb08e1291
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5361456
Auto-Submit: Matthias Liedtke <mliedtke@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92754}
2024-03-11 16:27:27 +00:00
Matthias Liedtke 5c16484da3 [wasm] Initializer expressions: Fix ref.i31 on 32 bit
ref.i31 in the constant expression evaluator:
static_cast<intptr_t>(i32_val << 2) >> 1

As intptr_t is 32 bits as well, this loses a bit of information.

Fixed: 328499555
Change-Id: Ic60bae8b8a3c06633906905bdbd6d892c94ffd11
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5351806
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Reviewed-by: Manos Koukoutos <manoskouk@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92719}
2024-03-07 19:33:01 +00:00
Matthias Liedtke 5c277284b0 [fuzzer][wasm] Fix UB in fuzzer implementation
Fixed: 328144636
Change-Id: Idc56894530a41b7054a4d95b15ab8ee6abd9f922
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5340714
Reviewed-by: Eva Herencsárová <evih@chromium.org>
Auto-Submit: Matthias Liedtke <mliedtke@chromium.org>
Commit-Queue: Eva Herencsárová <evih@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92661}
2024-03-05 12:16:23 +00:00
Matthias Liedtke dc8157b603 [wasm][decoder] Rewrite stack types on most branch instructions
This fixes the behavior to be aligned with the spec.
Detailed discussion on this:
https://github.com/WebAssembly/gc/issues/516

Fixed: v8:14643
Change-Id: Icaebf96ef3710bb5aeba19192e8245287f5fcb49
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5339891
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Reviewed-by: Manos Koukoutos <manoskouk@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92658}
2024-03-05 11:12:24 +00:00