Commit Graph

1383 Commits

Author SHA1 Message Date
Clemens Backes
38948b8e92 [wasm][interpreter] Remove activations
Since the interpreter cannot call out to JS any more, there cannot be
more than one activation at a time. Hence remove the concept of
activations.

R=ahaas@chromium.org

Bug: v8:10389
Change-Id: Ifda5624e192464a1aed2943787bc6860d1917719
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2219942
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#68118}
2020-06-02 20:20:05 +00:00
Thibaud Michaud
67805eab46 [wasm][interpreter] Fix multi-value stack height issue
Unreachable code may consume values from an empty stack as needed, known
as stack polymorphism. After consuming the values, the stack height
should still be 0, which was incorrectly handled by multi-value blocks.

R=ahaas@chromium.org

Bug: chromium:1085507
Change-Id: Ibf5f2d05bec0fbe029cfa66ee2d07540a370934a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2218033
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Commit-Queue: Thibaud Michaud <thibaudm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#68070}
2020-05-29 10:35:04 +00:00
Ng Zhi An
3e828fd291 Reland "[wasm-simd] Fix extract lane unsigned extend"
This is a reland of dfdef88547

Original change's description:
> [wasm-simd] Fix extract lane unsigned extend
> 
> The interpreter is missing a static cast when extracting lanes smaller
> than int32_t and doing an unsigned extend. The array in Simd128 is
> signed, so a direct cast to uint32_t will be a signed extension. The fix
> is to, in the unsigned case, cast to unsigned (of the appropriate size)
> first, then cast to uint32_t.
> 
> Change-Id: Ifabb5b9690f08ad505ac94b84908db0970581818
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2216721
> Reviewed-by: Deepti Gandluri <gdeepti@chromium.org>
> Commit-Queue: Zhi An Ng <zhin@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#68029}

Change-Id: Ica7974a2f1f2a4f07b54cc68f9abcf5e121a9262
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2219414
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Reviewed-by: Deepti Gandluri <gdeepti@chromium.org>
Cr-Commit-Position: refs/heads/master@{#68063}
2020-05-28 23:24:50 +00:00
Ng Zhi An
b7d1479066 [wasm-simd] Prototype f32x4 rounding instructions
Implements f32x4 ceil, floor, trunc, nearestint, for interpreter and
x64.

Bug: v8:10553
Change-Id: Iab747cbd2a872aa6cd4ad23c5b8334d5c8e4da61
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2212435
Reviewed-by: Deepti Gandluri <gdeepti@chromium.org>
Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#68054}
2020-05-28 17:54:37 +00:00
Manos Koukoutos
0dc1a2d81e [wasm-gc] Add tests for array/struct index checks.
This was postponed until the changes to struct and array types
were implemented
(https://chromium-review.googlesource.com/c/v8/v8/+/2215049).

Bug: v8:7748
Change-Id: I2c7a7d6bcbc1b93f82240f5e245ac1a066d74511
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2214832
Commit-Queue: Manos Koukoutos <manoskouk@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#68036}
2020-05-28 10:56:46 +00:00
Zhi An Ng
061fbbd118 Revert "[wasm-simd] Fix extract lane unsigned extend"
This reverts commit dfdef88547.

Reason for revert: https://ci.chromium.org/p/v8/builders/ci/V8%20Blink%20Mac/2718?

Original change's description:
> [wasm-simd] Fix extract lane unsigned extend
> 
> The interpreter is missing a static cast when extracting lanes smaller
> than int32_t and doing an unsigned extend. The array in Simd128 is
> signed, so a direct cast to uint32_t will be a signed extension. The fix
> is to, in the unsigned case, cast to unsigned (of the appropriate size)
> first, then cast to uint32_t.
> 
> Change-Id: Ifabb5b9690f08ad505ac94b84908db0970581818
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2216721
> Reviewed-by: Deepti Gandluri <gdeepti@chromium.org>
> Commit-Queue: Zhi An Ng <zhin@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#68029}

TBR=gdeepti@chromium.org,zhin@chromium.org

Change-Id: Icdd0e705f4c7252aef2cadaa39ec52204b5c6093
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2219412
Reviewed-by: Zhi An Ng <zhin@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#68030}
2020-05-28 00:55:03 +00:00
Ng Zhi An
dfdef88547 [wasm-simd] Fix extract lane unsigned extend
The interpreter is missing a static cast when extracting lanes smaller
than int32_t and doing an unsigned extend. The array in Simd128 is
signed, so a direct cast to uint32_t will be a signed extension. The fix
is to, in the unsigned case, cast to unsigned (of the appropriate size)
first, then cast to uint32_t.

Change-Id: Ifabb5b9690f08ad505ac94b84908db0970581818
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2216721
Reviewed-by: Deepti Gandluri <gdeepti@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#68029}
2020-05-27 23:23:18 +00:00
Manos Koukoutos
1646c9be8c [wasm-gc] Add mutability and packed types to arrays/structs
Bug: v8:7748
Change-Id: I4ae500548e7ab09f5bd037563af5c057751197bb
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2215049
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Commit-Queue: Manos Koukoutos <manoskouk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67996}
2020-05-27 07:46:02 +00:00
Ng Zhi An
dfbbb4a531 [wasm-simd] Add bitmask to SIMD MVP
This removes the post-mvp flag for bitmask, since it was accepted into
the proposal, see https://github.com/WebAssembly/simd/pull/201.

Bug: v8:10308
Change-Id: I4ced43a6484660125d773bc9de46bdea9f72b13b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2216532
Reviewed-by: Deepti Gandluri <gdeepti@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67993}
2020-05-26 22:24:10 +00:00
Clemens Backes
a7a201b260 [wasm][debug][cleanup] Remove redundant Isolate parameter
The Isolate is only used to access the wasm engine, and the accounting
allocating. The latter is also linked directly from the wasm engine, and
the engine is linked from the native module, to which the DebugInfoImpl
already has access.
Hence, this CL removes the redundant Isolate pointers, and just accesses
the engine and the allocator via the NativeModule.

R=thibaudm@chromium.org

Change-Id: Ib51cee2d166443a34e22fa02e8ad1549328aaa7f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2214827
Reviewed-by: Thibaud Michaud <thibaudm@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67966}
2020-05-26 12:55:40 +00:00
Clemens Backes
843a1f45a1 [wasm][interpreter] Remove breakpoint support
The interpreter is not used for debugging any more. Hence any breakpoint
support and related functionality is dead code.

This CL removes
- the {SetBreakpoint} and {GetBreakpoint} methods,
- the {break_pc_} field which holds the current pause position,
- the {break_flags_} field which is used to break at function entry and
  after calls,
- functions to modify {break_flags_},
- the dead {kInternalBreakpoint} and {kInvalidPc} constants (plus
  respective macros and enums),
- the {orig_start} and {orig_end} fields (code is not being modified any
  more, so we just use {start} and {end} now),
- the {PrepareStepIn} method,
- the unimplemented {SetTracing} method, and
- two tests that test breakpoints in the interpreter.

R=thibaudm@chromium.org

Bug: v8:10389
Change-Id: I52103c37516446e40d3dfa365d6b480a7c623577
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2215163
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Thibaud Michaud <thibaudm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67958}
2020-05-25 16:27:05 +00:00
Andreas Haas
d4bb820827 [wasm] Introduce the SyncStreamingDecoder
This CL introduces the SyncStreamingDecoder to support
streaming compilation when --single-threaded is set. The
SyncStreamingDecoder buffers all bytes it receives over
{OnBytesReceived}, and compiles them synchronously upon {Finish}.

In addition to introducing SyncStreamingDecoder, this CL does
the following changes:
* Redirect streaming compilation to the new streaming decoder if
  --no-wasm-async-compilation is set. This flag is set if
  --single-threaded is set.
* Extend the test-streaming-compilation.cc tests to test also the new
  streaming decoder.

R=thibaudm@chromium.org

Bug: v8:10548
Change-Id: I807e291a6060067c9835de4adf82bcb00321d995
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2209053
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Reviewed-by: Thibaud Michaud <thibaudm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67955}
2020-05-25 11:02:42 +00:00
Ng Zhi An
4c2f84b56b [wasm-simd] Rename anytrue and alltrue to follow proposal
The proposal uses the lane shape, e.g. i64x2.anytrue, and we were using
s1x2.anytrue in our opcodes. This was a legacy naming, because we were
trying to bitpack the booleans. Now that we aren't doing that, rename
these to be more consistent with the proposal.

This was done with a straightforward sed script, changing both cpp code
and also some comments in mjsunit test files.

Bug: v8:10506
Change-Id: If077ed805de23520d8580d6b3b1906c80f67b94f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2207915
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Reviewed-by: Deepti Gandluri <gdeepti@chromium.org>
Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67945}
2020-05-21 19:03:52 +00:00
Manos Koukoutos
491a94b0ff [wasm-gc] Implement 'let' opcode.
Changes:
- Implement the 'let' opcode, as per
https://github.com/WebAssembly/function-references/blob/master/proposals/function-references/Overview.md#local-bindings
- Use a WasmDecoder in place of a plain decoder in OpcodeLength and
AnalyzeLoopAssignment.
- Change ControlBase to accept an additional 'locals_count' parameter.
- Implement required test infrastructure and write some simple tests.

Bug: v8:7748
Change-Id: I39d60d1f0c26016c8f89c009dc5f4119b0c73c87
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2204107
Commit-Queue: Manos Koukoutos <manoskouk@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67937}
2020-05-20 23:37:14 +00:00
Ng Zhi An
507f85c064 [wasm-simd][arm] Implement f32x4 f64x2 pmin pmax
Bug: v8:10501
Change-Id: Ib61f7957e1fd7cfa498bce28171b5f9e4b2f93c3
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2191393
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Reviewed-by: Deepti Gandluri <gdeepti@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67913}
2020-05-19 20:55:21 +00:00
Ng Zhi An
671c2fda2f [wasm-simd] Test for offsets in load extend tests
Bug: v8:9886
Change-Id: I22af3c19ef6371d31f0f95c58730ceb3e7effafa
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2207653
Reviewed-by: Deepti Gandluri <gdeepti@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67877}
2020-05-18 23:46:25 +00:00
Ng Zhi An
9d1dda7e97 [wasm-simd][arm] Improve codegen for any_true
The codegen uses a bunch of vpmax to try and keep set bits around. The
datatype for vpmax does not need to change for each instruction, since
vpmax U32 will persist set bits just as well. This simplifies the
instruction sequences for S1x8 and S1x16 anytrue.

I added a test to check a special case when a f64x2 contains -0.0 (top
bit set). A previous attempt to optimize codegen used floating point
compare, which does not distinguish between 0.0 and -0.0. So -0.0 will
compare equals to 0.0, and incorrect return 0 for anytrue.

Change-Id: I66013796af08a666009e6b2d774ea7ee7bdfe1ad
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2203113
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Reviewed-by: Bill Budge <bbudge@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67875}
2020-05-18 18:08:15 +00:00
Manos Koukoutos
a4d295ad76 [wasm] Refactor/cleanup DecodeLocals, read_value_type
Changes:
Cleanup:
- Make sure read_value_type has the same interface as other
  read_* functions, i.e., returns the decoded value and writes
  the consumed length into a pointer.
- DecodeLocals is now an instance method.
- DecodeLocals should fail when given a wrong number of locals.
  Add tests to catch that.
- Fix a buggy test.

Refactoring in preparation of introducing the 'let'
instruction as per [wasm-gc]:
- DecodeLocals does not consume any input and can start from any pc.
- DecodeLocals gives the option of not appending the decoded
  locals to local_types_.
- Separate locals initialization from signature.

Bug: v8:7748
Change-Id: Iaaff87fdb9abe0ddd716484ea3fa87779d2d1a2f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2202992
Commit-Queue: Manos Koukoutos <manoskouk@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67845}
2020-05-18 06:41:09 +00:00
Ng Zhi An
c7928e55ca [wasm-simd] Fix max alignment for load extends
Load extends always load 64-bits. Previously, we were setting the max
alignment to be the size_log_2 of the load_type. For LoadExtends the
load_type indicates what the lane size to be extended is, *NOT* the size
to be loaded.

Bug: chromium:1082848
Change-Id: I0c4115ea6ec916211b03afdb83376ccc05c0c244
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2202721
Reviewed-by: Bill Budge <bbudge@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67815}
2020-05-14 23:16:09 +00:00
Ng Zhi An
795246c444 [wasm-simd][arm64] Implement f32x4 f64x2 pmin pmax
Bug: v8:10501
Change-Id: I6dad0f4da4d7c50d0793d39a5a119defb6b53844
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2191392
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Reviewed-by: Deepti Gandluri <gdeepti@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67787}
2020-05-13 23:40:23 +00:00
Andreas Haas
b4eb441837 [wasm][liftoff] Push stack parameters of builtins in reversed order
This CL fixes a bug in Liftoff where stack parameters for builtins were
pushed in the reversed order.

CC=bbudge@chromium.org
R=clemensb@chromium.org

Bug: v8:10281
Change-Id: I51ab4f19b0dc3835140ca3c05c98cc82dfe9cac4
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2196341
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67779}
2020-05-13 13:47:30 +00:00
Clemens Backes
e62a7f7697 Reland "[wasm][debug] Fix tier down for multiple isolates"
This is a reland of 902f48bdda, fixed
to avoid lock inversion problems detected by TSan.

Original change's description:
> [wasm][debug] Fix tier down for multiple isolates
>
> If multiple isolates are using the same module, we need to keep it
> tiered down as long as any isolate still has a debugger open.
> Also, we cannot short-cut the {NativeModule::TierDown} method, since the
> previously triggered tier down might not have finished yet.
> For now, each isolate starts an independent tier down (i.e. a full
> recompilation). We could optimize this later by skipping functions that
> are already tiered down, or are already scheduled for tier down, but we
> still need to wait for tier-down to finish on each isolate.
>
> R=thibaudm@chromium.org
>
> Bug: v8:10359
> Change-Id: I7ea6a6f5d3977e48718ac5bc94f9831541f6173f
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2190758
> Commit-Queue: Clemens Backes <clemensb@chromium.org>
> Reviewed-by: Thibaud Michaud <thibaudm@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#67716}

Bug: v8:10359
Cq-Include-Trybots: luci.v8.try:v8_linux64_tsan_rel
Cq-Include-Trybots: luci.v8.try:v8_linux64_tsan_isolates_rel_ng
Change-Id: Ie98cf073fc79e5c6991df6d4466de7b560274070
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2194451
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Thibaud Michaud <thibaudm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67754}
2020-05-12 15:41:55 +00:00
Manos Koukoutos
eb23cef034 [wasm-gc] Implement ref.eq
Changes:
- Implement subtyping for eqref.
- (Driveby) Declare more functions as constexpr in ValueType.
- Make minor changes needed to handle ref.eq.
- Write an elementary test.

Bug: v8:7748
Change-Id: I11d54227798ce56de70f3a6f83305b2f80b2f57f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2193715
Commit-Queue: Manos Koukoutos <manoskouk@chromium.org>
Reviewed-by: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67752}
2020-05-12 15:35:25 +00:00
Jakob Kummerow
ee159a4bac [wasm-gc] Implement array.len
Bug: v8:7748
Change-Id: I736aaebb08be1d43662058f0ffde8b877b025017
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2193852
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67745}
2020-05-12 12:12:17 +00:00
Ng Zhi An
5d1392b66b [wasm-simd][ia32] Implement f32x4 f64x2 pmin pmax
Same implementation as the one for x64 in https://crrev.com/c/2186630.

Bug: v8:10501
Change-Id: If2b6c0fdc649afba3449d9579452cf7047a55a54
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2188556
Reviewed-by: Deepti Gandluri <gdeepti@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67721}
2020-05-11 18:16:39 +00:00
Jakob Kummerow
ccb7b42697 [wasm-gc] Implement array.get/array.set
With bounds checks, null checks, and a test case.

Bug: v8:7748
Change-Id: I9e7d68ecd883bd0279f22d11c1dc73cc8716a4cb
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2192659
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67714}
2020-05-11 15:57:43 +00:00
Manos Koukoutos
6a6c151dda [wasm-gc] Implement br_on_null
Add br_on_null opcode, encoding, decoding, and elementary tests.

Bug: v8:7748
Change-Id: Id771ea7f57694e1c1bffc83c4232132bf9ad9dbd
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2190424
Commit-Queue: Manos Koukoutos <manoskouk@chromium.org>
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67712}
2020-05-11 15:49:23 +00:00
Clemens Backes
149843723d [wasm][debug] Make recompilation isolate-independent
Passing an isolate to {RecompileNativeModule} feels wrong, since
compilation and the generated code are totally isolate-independent. In
fact, the isolate is only used for updating counters.
Instead of passing the counters instead, this CL just refactors the code
to support a nullptr for the counters everywhere (some code paths
already supported that). The few recompilation would not make a
significant difference in the histograms anyway, and even have the risk
of skewing the data.

Drive-by 1: Rename {TierUp} to {StartTierUp} and update comments.
Drive-by 2: Remove non-actionable TODO.

R=thibaudm@chromium.org

Bug: v8:10359
Change-Id: Ic027f939bbc55398b90784922130fe1fe5573b0c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2187638
Reviewed-by: Thibaud Michaud <thibaudm@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67708}
2020-05-11 12:12:11 +00:00
Manos Koukoutos
0a69768a4e [wasm-gc] Implement ref.as_non_null, optimize struct instructions.
Implement the instruction ref.as_non_null, as per the wasm gc extension.

Changes:
- Add the respective wasm opcode, move some asmjs opcodes around.
- Add a new type of wasm trap, IllegalCast.
- Modify wasm decoding and compilation pipeline.
- Add a minimal test.
- In wasm-compiler, generalize Unreachable to Trap.
- Optimize struct.get and struct.set for non-null types.

Bug: v8:7748
Change-Id: If2f794306c7cbfabc06e4f64988132346085d6dd
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2187616
Commit-Queue: Manos Koukoutos <manoskouk@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67705}
2020-05-11 11:09:47 +00:00
Clemens Backes
383d145351 [wasm][debug] Rename WasmCompiledFrame to WasmFrame
Also, rename the WASM_COMPILED frame type to just WASM.

R=jkummerow@chromium.org

Bug: v8:10389
Change-Id: I71f16f41a69f8b0295ba34bd7d7fad71729546f2
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2187613
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67698}
2020-05-11 09:15:53 +00:00
Clemens Backes
d6c4901a03 [wasm][debug] Remove WasmCompiledFrameSummary
All wasm code is compiled now. Hence merge the
{WasmCompiledFrameSummary} into {WasmFrameSummary} and remove the
dispatch. Also, rename {IsWasmCompiled} to {IsWasm} and {AsWasmCompiled}
to {AsWasm}.

R=jkummerow@chromium.org

Bug: v8:10389
Change-Id: I33e413c7d0fa622249563091925b29631472b40c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2187170
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67689}
2020-05-08 18:26:01 +00:00
Ng Zhi An
9a68fa13fe [wasm-simd] Prototype f32x4 and f64x2 pmin and pmax
This patch implements f32x4.pmin, f32x4.pmax, f64x2.pmin, and f64x2.pmax
for x64 and interpreter.

Pseudo-min and Pseudo-max instructions were proposed in
https://github.com/WebAssembly/simd/pull/122. These instructions
exactly match std::min and std::max in C++ STL, and thus have different
semantics from the existing min and max.

The instruction-selector for x64 switches the operands around, because
it allows for defining the dst to be same as first (really the second
input node), allowing better codegen.

For example, b = f32x4.pmin(a, b) directly maps to vminps(b, b, a) or
minps(b, a), as long as we can define dst == b, and switching the
instruction operands around allows us to do that.

Bug: v8:10501
Change-Id: I06f983fc1764caf673e600ac91d9c0ac5166e17e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2186630
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
Reviewed-by: Deepti Gandluri <gdeepti@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67688}
2020-05-08 17:24:00 +00:00
Manos Koukoutos
1b297d6ed1 [wasm][gc] Add tests for ref types in blocks and globals.
Changes:
- Extend wasm/wasm-module-builder.cc to handle reference types.
- Add testing infrastructure to wasm-macro-gen.h for reference types.
- Add cc tests for ref types in blocks and globals.

Bug: v8:7748
Change-Id: I527252a768469e1493ecee9ecf4b4afaf8a8013b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2182377
Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Manos Koukoutos <manoskouk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67679}
2020-05-08 12:43:39 +00:00
Jakob Kummerow
a7f8ffe707 [wasm-gc] Implement array.new
along with WASM_ARRAY_TYPE, a WasmArray class, and a very basic
test.

Bug: v8:7748
Change-Id: I1ad4ff78e428972be52130cc179a91c76fcdbdc6
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2185136
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67671}
2020-05-08 08:48:08 +00:00
Ng Zhi An
6a3e92e9a9 [wasm-simd] Scalar lowering to convert i8x16 to f32x4
Implement conversion of an i8x16 node to a f32x4 node.

Bug: v8:10507
Change-Id: Ifefffb779dbf25b57eae278afe41c11b41c949ac
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2185472
Reviewed-by: Deepti Gandluri <gdeepti@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67659}
2020-05-07 17:09:53 +00:00
Ng Zhi An
5d8f90392d [wasm-simd] Consolidate SIMD operation macros
Move them all into wasm-macro-gen.h, other opcodes have their macros
there as well. This will make reusing these macros easier when we have
other test files for SIMD. (An upcoming one is for scalar lowering
tests.)

Change-Id: I6c21100ce490abbc26f80a0d204815687fd62f00
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2185471
Reviewed-by: Deepti Gandluri <gdeepti@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67658}
2020-05-07 17:03:03 +00:00
Clemens Backes
29e1b2810c [wasm] Fix compile time regressions in SIMD tests
Avoid templates, just encode all wasm opcodes as 2-byte LEB instead.

R=zhin@chromium.org

Bug: v8:10258
Change-Id: I3bfd5235b235a5d9366e0007e915a2c02a09b0d4
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2182638
Reviewed-by: Zhi An Ng <zhin@chromium.org>
Reviewed-by: Deepti Gandluri <gdeepti@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67625}
2020-05-06 17:22:47 +00:00
Andreas Haas
90fa771dc3 [wasm][liftoff][arm] Implement CompareExchange
This CL implements all variants of CompareExchange on arm.

Implementing 64-bit CompareExchange on arm requires a lot of registers,
with the additional constraint that the low-word register of new_value
and result have to have an even register code, and that the corresponding
high-word registers have a register code that is by one higher than the
register code of the low-word register.

This register allocation is achieved by assigning fixed registers to
all values.

R=clemensb@chromium.org, v8-arm-ports@googlegroups.com

Bug: v8:10108
Change-Id: I2edfde15e80db0d45621a461793018d88e997431
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2172791
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67592}
2020-05-06 10:11:49 +00:00
Manos Koukoutos
1ba5766f5e [wasm][gc] Implement struct.set and switch struct.get to optref
Work towards adding heap-allocated object support for wasm, according to
the gc proposal.

Changes:
- Implement subtyping for reference types (ref s) and (optref s),
  where 's' is a struct type.
  This CL does *not* implement subtyping between struct and function
  types. Also, it does not handle i31refs and eqrefs.
- Implement struct.set.
- Change struct.get to accept an optref as argument, as required by the
  standard.
- Allow locals to store objects of ref and optref types.
- Add a test for struct.set and optref locals. Modify the test for
  struct.get accordingly.

Reference: https://github.com/WebAssembly/gc

R=jkummerow@chromium.org
R=clemensb@chromium.org

Bug: v8:7748
Change-Id: I708626fa5f90a6e24e667d66eed1c7697f458a23
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2172089
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Manos Koukoutos <manoskouk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67562}
2020-05-05 12:57:42 +00:00
Clemens Backes
61c2a0f4ba [wasm] Remove interpreter entry code
This removes the interpreter entry stubs, which are used to redirect
specific wasm functions to the interpreter. It is only needed when
mixing JS code with interpreted Wasm code, otherwise the test functions
just call the interpreter directly.
Thus a lot of tests that contain such interaction between JS and Wasm
need to be restricted to execute in Liftoff and TurboFan only.

After this CL, the WASM_INTERPRETER_ENTRY frame type and the
corresponding WasmInterpreterEntryFrame are dead, and will be removed in
a follow-up CL.

R=thibaudm@chromium.org

Bug: v8:10389
Change-Id: I8e50d350dbc2afcc1cddaeb98baf23711117af2d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2172962
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Thibaud Michaud <thibaudm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67559}
2020-05-05 11:18:05 +00:00
Andreas Haas
849b2239e8 [wasm][arm] Correctly handle AtomicExchange without used outputs
The existing implementation needed uses of the outputs of an
AtomicExchange to allocate registers for the result value. However,
these uses are not guaranteed to exist. With this CL temp registers
get allocated if the uses don't exist.

R=gdeepti@chromium.org

Bug: chromium:1077130
Change-Id: I058ee53b87c6e995c9f490f3aebbfdba69934f3c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2179503
Reviewed-by: Deepti Gandluri <gdeepti@chromium.org>
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67556}
2020-05-05 06:50:57 +00:00
Deepti Gandluri
12263212c1 Revert "[wasm-simd] Remove interpreter tier of SIMD tests"
This reverts commit 3c40082543.

Reason for revert: Re-enable interpreter tests

Original change's description:
> [wasm-simd] Remove interpreter tier of SIMD tests
> 
> As per the all-hands a couple of weeks ago, the interpreter will
> be removed soon. Remove running tests on this tier, so we no longer
> put effort into maintaining tests for this tier.
> 
> Change-Id: I9fce0f3a7cd869d6ccecf1c1f820b794e89858e1
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2175021
> Reviewed-by: Zhi An Ng <zhin@chromium.org>
> Commit-Queue: Deepti Gandluri <gdeepti@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#67520}

TBR=gdeepti@chromium.org,zhin@chromium.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: Iac0f21311769157c5ae303e8078c25d96fbc7c93
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2180343
Reviewed-by: Deepti Gandluri <gdeepti@chromium.org>
Reviewed-by: Zhi An Ng <zhin@chromium.org>
Commit-Queue: Deepti Gandluri <gdeepti@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67546}
2020-05-04 17:09:51 +00:00
Thibaud Michaud
7b582b615e [wasm] Store the source URL in CompiledWasmModule
This allows us to preserve the script URL when importing a module in a
worker.

R=ahaas@chromium.org,clemensb@chromium.org
CC=kimanh@chromium.org

Bug: chromium:1064548
Change-Id: Id5e48c840e2dba8eadb5c854fcb389787ce11215
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2167866
Commit-Queue: Thibaud Michaud <thibaudm@chromium.org>
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67543}
2020-05-04 15:07:21 +00:00
Deepti Gandluri
3c40082543 [wasm-simd] Remove interpreter tier of SIMD tests
As per the all-hands a couple of weeks ago, the interpreter will
be removed soon. Remove running tests on this tier, so we no longer
put effort into maintaining tests for this tier.

Change-Id: I9fce0f3a7cd869d6ccecf1c1f820b794e89858e1
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2175021
Reviewed-by: Zhi An Ng <zhin@chromium.org>
Commit-Queue: Deepti Gandluri <gdeepti@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67520}
2020-05-01 18:25:36 +00:00
Deepti Gandluri
41fbbd12a3 [wasm-simd] Update SIMD opcode numbers as per the Spec change
- Update opcode numbers, tests
 - As the wasm-module-builder currently assumes opcode bytes, skip
   the test that needs a multi-byte leb128 opcode
 - Renumber post-MVP opcodes

Change-Id: I6531e954e63986dc6f7a3144ec054d16e6dc1b05
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2173952
Reviewed-by: Zhi An Ng <zhin@chromium.org>
Commit-Queue: Deepti Gandluri <gdeepti@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67517}
2020-05-01 18:05:46 +00:00
Clemens Backes
1fb1db1792 [wasm][debug] Remove redirection to interpreter
This removes the {RedirectToWasmInterpreter} runtime function and the
respective method from {WasmDebugInfo}.
Some tests test specifically the interaction between compiled code and
the interpreter. They are irrelevant now and are deleted.

R=thibaudm@chromium.org

Bug: v8:10389
Change-Id: I38330fcb523f7c65968fdf03abc60af3392bdcc8
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2164793
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Thibaud Michaud <thibaudm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67427}
2020-04-28 10:50:21 +00:00
Zhao Jiazhong
f74d2a9053 [mips64][wasm-simd] Fix bugs of some wasm-simd operations.
Due to lack of testing environment before, there are some bugs in the
implementations of wasm-simd on mips64 platform, this CL fix them
according to the test on Loongson 3A4000.

Change-Id: I59ab6315987fc94a06cf0bf23754f5c593879532
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2162416
Commit-Queue: Zhao Jiazhong <zhaojiazhong-hf@loongson.cn>
Reviewed-by: Zhi An Ng <zhin@chromium.org>
Reviewed-by: Deepti Gandluri <gdeepti@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67413}
2020-04-28 02:13:52 +00:00
Clemens Backes
30350b6575 [wasm][debug] Move debug-evaluate cctest to Liftoff
This is the last cctest that uses the interpreter for debugging.
This CL moves it over to Liftoff.

R=jkummerow@chromium.org

Bug: v8:10389
Change-Id: I1791f0c762c9aab38eee5f5fb96772f4d01c212f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2164790
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67367}
2020-04-24 15:18:11 +00:00
Clemens Backes
780746d64c [wasm][debug] Move breakpoint cctests to Liftoff
The cctests for breakpoints were still executing in the interpreter.
This CL moves them over to Liftoff.

Note that the additional methods on {DebugInfo} will be reused for other
purposes, see https://crrev.com/c/1941139.

R=jkummerow@chromium.org

Bug: v8:10389
Change-Id: Ia88150612377d6e7db0514af1efe091124b3ddce
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2162852
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67360}
2020-04-24 11:30:42 +00:00
Ng Zhi An
117f6ef47a [wasm-simd] Fix decoding of load splats
Load splat opcodes are currently multi-byte, but were not passing the
right lengths for decoding of immediates.

Bug: v8:10258
Change-Id: I2c93c3f915eaa43a74722cf0285f161d16ef0ff6
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2154769
Reviewed-by: Deepti Gandluri <gdeepti@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67326}
2020-04-22 23:58:38 +00:00