Commit Graph

3997 Commits

Author SHA1 Message Date
Clemens Backes
447d7d6784 [wasm][debug] Avoid repeated recompilation
If multiple isolates share the same module, and the debugger gets
enabled, then we trigger tier down in each isolate separately. To avoid
generating too much code, we only recompile functions that are not
already in the right tier.

This CL is only the first step towards an actual fix. Since we only
check already installed code (and ignore compilations that are already
scheduled), we might still compile the same functions multiple times. A
second CL will make sure that only one recompilation is running at the
same time.

R=thibaudm@chromium.org

Bug: chromium:1084369, v8:10359
Change-Id: Ic4f9afac1add0fe8ad9e5d68f22d3d41ba2e52be
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2213438
Reviewed-by: Thibaud Michaud <thibaudm@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67957}
2020-05-25 13:42:32 +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
Manos Koukoutos
be6c7f4aa3 [wasm][bug] Check that type indexes are within limits in read_value_type
Failing to do so results in an error when generating the respective
ValueType, since the index has to be encoded in 24 bits.

Bug: v8:7748, chromium:1080444
Change-Id: Ifd1ce9744388b65f91dbd9eaeb497726c6cd207e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2214823
Commit-Queue: Manos Koukoutos <manoskouk@chromium.org>
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67952}
2020-05-25 10:30:02 +00:00
Ng Zhi An
b409a4413f [wasm-simd] Fix pmin pmax opcodes
These were changed in the renumbering
https://github.com/WebAssembly/simd/blob/master/proposals/simd/NewOpcodes.md

Bug: v8:10501
Change-Id: I4e98b0a482e18208b63f11a1675a90c9367a6d93
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2212682
Reviewed-by: Deepti Gandluri <gdeepti@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67946}
2020-05-21 22:09:21 +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
Manos Koukoutos
cf7731e261 [wasm][refactor] Change signature of DecodeLocals.
We would like DecodeLocals to allow inserting new locals
in any position. This is useful for the upcoming 'let' instruction.

Bug: v8:7748
Change-Id: Ic7f2a7fba0f69ee76b0ace46bb0cecee9d047306
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2208859
Commit-Queue: Manos Koukoutos <manoskouk@chromium.org>
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67936}
2020-05-20 22:08:26 +00:00
Milad Farazmand
5885c9e527 [wasm-simd] Fix load_extend on Big Endian architectures
load_extend is now implanted on BE machines by loading
bytes and using replace_lane to add it to the desired lane.

Interpret is also fixed to write lanes in reverse.

Change-Id: I984ae6b4bd41544fbf65c702a4b5b50ba03cb261
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2210147
Commit-Queue: Milad Farazmand <miladfar@ca.ibm.com>
Reviewed-by: Zhi An Ng <zhin@chromium.org>
Reviewed-by: Deepti Gandluri <gdeepti@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67935}
2020-05-20 19:39:15 +00:00
Ng Zhi An
a0d493e27e [wasm-simd][liftoff][arm][arm64] Implement load extends
Bug: v8:9909
Change-Id: Iac2146621689e0939cc7be656d5098ff1c8159a2
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2207652
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67934}
2020-05-20 19:02:24 +00:00
Milad Farazmand
47513717b5 PPC/s390: Reland "[wasm-simd][liftoff][x64][ia32] Implement load extend"
Port 6b228044a9

Original Commit Message:

    This is a reland of dd19a40083

    Original change's description:
    > [wasm-simd][liftoff][x64][ia32] Implement load extend
    >
    > The operations are implemented:
    >
    > - i16x8.load8x8_s
    > - i16x8.load8x8_u
    > - i32x4.load16x4_s
    > - i32x4.load16x4_u
    > - i64x2.load32x2_s
    > - i64x2.load32x2_u
    >
    > on x64 and i32. The rest of the arch currently bail out, and will be
    > implemented in subsequent patches.
    >
    > The liftoff-compiler.cc code looks very similar to the one for LoadMem,
    > the only difference is special handling of kSplat v.s. kExtend. kExtend
    > always loads 8 bytes, so the bounds check and tracing is different.
    > Compared to LoadMem there is less need for pinning, since the result is
    > always going to be in a SIMD/FP register, which is different from the
    > index/addr register.
    >
    > The enum LoadTransformationKind was moved from
    > function-body-decoder-impl.h to function-body-decoder.h so that no
    > unncessary header file inclusions were needed to liftoff, and also it's
    > a better place for it to live.
    >
    > Bug: v8:9909
    > Change-Id: I926bcc01c0c3c860223e8c08f91bc4ab3b75c399
    > Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2203730
    > Commit-Queue: Zhi An Ng <zhin@chromium.org>
    > Reviewed-by: Clemens Backes <clemensb@chromium.org>
    > Cr-Commit-Position: refs/heads/master@{#67914}

R=zhin@chromium.org, joransiu@ca.ibm.com, jyan@ca.ibm.com, michael_dawson@ca.ibm.com
BUG=
LOG=N

Change-Id: I2745871868afc1e6120197ad3ad138c89d47521e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2210764
Reviewed-by: Junliang Yan <jyan@ca.ibm.com>
Reviewed-by: Zhi An Ng <zhin@chromium.org>
Commit-Queue: Milad Farazmand <miladfar@ca.ibm.com>
Cr-Commit-Position: refs/heads/master@{#67933}
2020-05-20 18:53:14 +00:00
Andreas Haas
6921a490dc [wasm] Make StreamingDecoder abstract, introduce AsyncStreamingDecoder
The implementation of the StreamingDecoder depends on async compilation.
However, when the --single-threaded flag is set, async compilation is
not available. Therefore V8 does not support streaming compilation at
the moment if the --single-threaded flag is set.

This CL is the first step to support streaming compilation in
--single-threaded mode. This CL makes the StreamingDecoder an abstract
class, and the current implementation a sub-class called
AsyncStreamingDecoder. A follow-up CL will provided a second sub-class
implementation for streaming compilation in --single-threaded mode.

Bug: v8:10548
Change-Id: Ice5c01340d3df18f836a4a05d30571207ca8ccf6
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2208869
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Reviewed-by: Thibaud Michaud <thibaudm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67931}
2020-05-20 17:24:32 +00:00
Ng Zhi An
6b228044a9 Reland "[wasm-simd][liftoff][x64][ia32] Implement load extend"
This is a reland of dd19a40083

Original change's description:
> [wasm-simd][liftoff][x64][ia32] Implement load extend
> 
> The operations are implemented:
> 
> - i16x8.load8x8_s
> - i16x8.load8x8_u
> - i32x4.load16x4_s
> - i32x4.load16x4_u
> - i64x2.load32x2_s
> - i64x2.load32x2_u
> 
> on x64 and i32. The rest of the arch currently bail out, and will be
> implemented in subsequent patches.
> 
> The liftoff-compiler.cc code looks very similar to the one for LoadMem,
> the only difference is special handling of kSplat v.s. kExtend. kExtend
> always loads 8 bytes, so the bounds check and tracing is different.
> Compared to LoadMem there is less need for pinning, since the result is
> always going to be in a SIMD/FP register, which is different from the
> index/addr register.
> 
> The enum LoadTransformationKind was moved from
> function-body-decoder-impl.h to function-body-decoder.h so that no
> unncessary header file inclusions were needed to liftoff, and also it's
> a better place for it to live.
> 
> Bug: v8:9909
> Change-Id: I926bcc01c0c3c860223e8c08f91bc4ab3b75c399
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2203730
> Commit-Queue: Zhi An Ng <zhin@chromium.org>
> Reviewed-by: Clemens Backes <clemensb@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#67914}

Bug: v8:9909
Change-Id: Ic1d8dcc00d9c5af0d51100a947161eaa315b7659
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2209268
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67930}
2020-05-20 17:08:42 +00:00
Bill Budge
bc9deb83bb Reland "[torque] Port builtins-number-gen to Torque"
This is a reland of 4482f98806
It's identical to the original CL so ..

TBR=jgruber@chromium.org,tebbi@chromium.org

Original change's description:
> [torque] Port builtins-number-gen to Torque
>
> - Ports everything except Add.
>
> Builtins generated from this CL are slightly larger, e.g. Subtract
> is 424 bytes on x64, as opposed to 400 bytes for the CSA version.
> See https://crbug.com/v8/10521
>
> Bug: v8:9891
>
> Change-Id: Id85779eb26d8e51643d8a04f0a75090bc50ef5b2
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2191644
> Commit-Queue: Bill Budge <bbudge@chromium.org>
> Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
> Reviewed-by: Jakob Gruber <jgruber@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#67910}

Bug: v8:9891
Change-Id: I910c95db7bc044b2457364f4bfbbca46f0745bb9
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2209265
Commit-Queue: Bill Budge <bbudge@chromium.org>
Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
Reviewed-by: Jakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67926}
2020-05-20 14:25:43 +00:00
Jakob Kummerow
c24739fa03 [wasm] Fix "unreachable" code for invalid modules
Better return a validation error than assume that invalid modules
can't reach invalid code paths. ClusterFuzz prefers errors over
crashes.

Bug: chromium:1084389
Change-Id: I67f0c2f48022cff8a7821901ddfdd42fa2c4a5c6
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2209059
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67920}
2020-05-20 09:17:37 +00:00
Zhi An Ng
7bd682c90a Revert "[wasm-simd][liftoff][x64][ia32] Implement load extend"
This reverts commit dd19a40083.

Reason for revert: https://ci.chromium.org/p/v8/builders/ci/V8%20Linux%20-%20debug/30448?

Original change's description:
> [wasm-simd][liftoff][x64][ia32] Implement load extend
> 
> The operations are implemented:
> 
> - i16x8.load8x8_s
> - i16x8.load8x8_u
> - i32x4.load16x4_s
> - i32x4.load16x4_u
> - i64x2.load32x2_s
> - i64x2.load32x2_u
> 
> on x64 and i32. The rest of the arch currently bail out, and will be
> implemented in subsequent patches.
> 
> The liftoff-compiler.cc code looks very similar to the one for LoadMem,
> the only difference is special handling of kSplat v.s. kExtend. kExtend
> always loads 8 bytes, so the bounds check and tracing is different.
> Compared to LoadMem there is less need for pinning, since the result is
> always going to be in a SIMD/FP register, which is different from the
> index/addr register.
> 
> The enum LoadTransformationKind was moved from
> function-body-decoder-impl.h to function-body-decoder.h so that no
> unncessary header file inclusions were needed to liftoff, and also it's
> a better place for it to live.
> 
> Bug: v8:9909
> Change-Id: I926bcc01c0c3c860223e8c08f91bc4ab3b75c399
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2203730
> Commit-Queue: Zhi An Ng <zhin@chromium.org>
> Reviewed-by: Clemens Backes <clemensb@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#67914}

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

Change-Id: I2af6dfe6cd163d0dbc9f3a5ad4bfc5e622e76b63
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: v8:9909
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2207665
Reviewed-by: Zhi An Ng <zhin@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67915}
2020-05-19 22:07:24 +00:00
Ng Zhi An
dd19a40083 [wasm-simd][liftoff][x64][ia32] Implement load extend
The operations are implemented:

- i16x8.load8x8_s
- i16x8.load8x8_u
- i32x4.load16x4_s
- i32x4.load16x4_u
- i64x2.load32x2_s
- i64x2.load32x2_u

on x64 and i32. The rest of the arch currently bail out, and will be
implemented in subsequent patches.

The liftoff-compiler.cc code looks very similar to the one for LoadMem,
the only difference is special handling of kSplat v.s. kExtend. kExtend
always loads 8 bytes, so the bounds check and tracing is different.
Compared to LoadMem there is less need for pinning, since the result is
always going to be in a SIMD/FP register, which is different from the
index/addr register.

The enum LoadTransformationKind was moved from
function-body-decoder-impl.h to function-body-decoder.h so that no
unncessary header file inclusions were needed to liftoff, and also it's
a better place for it to live.

Bug: v8:9909
Change-Id: I926bcc01c0c3c860223e8c08f91bc4ab3b75c399
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2203730
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67914}
2020-05-19 21:05:51 +00:00
Bill Budge
f920ad116d Revert "[torque] Port builtins-number-gen to Torque"
This reverts commit 4482f98806.

Reason for revert: Causes Torque to break UBSAN

https://ci.chromium.org/p/v8/builders/ci/V8%20Linux64%20UBSan/11235?

[764/2199] ACTION //:run_torque(//build/toolchain/linux:clang_x64)
FAILED: gen/torque-generated/bit-fields-tq.h gen/torque-generated/builtin-definitions-tq.h gen/torqu...(too long)
python ../../tools/run.py ./torque -o gen/torque-generated -v8-root ../.. src/builtins/array-copywit...(too long)
../../src/torque/implementation-visitor.cc:778:36: runtime error: 2.14748e+09 is outside the range of representable values of type 'int'

Original change's description:
> [torque] Port builtins-number-gen to Torque
> 
> - Ports everything except Add.
> 
> Builtins generated from this CL are slightly larger, e.g. Subtract
> is 424 bytes on x64, as opposed to 400 bytes for the CSA version.
> See https://crbug.com/v8/10521
> 
> Bug: v8:9891
> 
> Change-Id: Id85779eb26d8e51643d8a04f0a75090bc50ef5b2
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2191644
> Commit-Queue: Bill Budge <bbudge@chromium.org>
> Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
> Reviewed-by: Jakob Gruber <jgruber@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#67910}

TBR=bbudge@chromium.org,jgruber@chromium.org,tebbi@chromium.org

Change-Id: Ib124c893753973243563e32c25bc727a5df2ca53
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: v8:9891
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2209264
Reviewed-by: Bill Budge <bbudge@chromium.org>
Commit-Queue: Bill Budge <bbudge@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67911}
2020-05-19 20:08:24 +00:00
Bill Budge
4482f98806 [torque] Port builtins-number-gen to Torque
- Ports everything except Add.

Builtins generated from this CL are slightly larger, e.g. Subtract
is 424 bytes on x64, as opposed to 400 bytes for the CSA version.
See https://crbug.com/v8/10521

Bug: v8:9891

Change-Id: Id85779eb26d8e51643d8a04f0a75090bc50ef5b2
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2191644
Commit-Queue: Bill Budge <bbudge@chromium.org>
Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
Reviewed-by: Jakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67910}
2020-05-19 19:49:20 +00:00
Ng Zhi An
f41941a05b Use WasmValue in inspector
Convert wasm-value into internal::WasmValue, then to debug::WasmValue.
This is then copied into a CDP protocol object via a new class,
WasmValueMirror.

Bug: v8:10347
Change-Id: I5778d2cc5701caf82e4a97ac329303e510695b74
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2151130
Reviewed-by: Yang Guo <yangguo@chromium.org>
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Kim-Anh Tran <kimanh@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67908}
2020-05-19 17:47:40 +00:00
Thibaud Michaud
9d06369496 [liftoff][mv] Fix merge issue in multi-value loops
Registers cannot be used as a merge destination if they have more than
one use, otherwise the merge will unexpectedly affect other uses of that
register.

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

Bug: chromium:1084151
Change-Id: I0d6ad97c585920357a37d95361e0320d32c71f4b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2208851
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Commit-Queue: Thibaud Michaud <thibaudm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67904}
2020-05-19 15:43:50 +00:00
Emanuel Ziegler
4372a9b58a [wasm] Implement optional init parameter for Table.grow
The typed function references proposal allows an optional second
parameter to Table.grow containing the initialization value for the
newly added entries for tables that do not support null defaults.

This CL adds this functionality but hides it behind a newly added
experimental flag --experimental-wasm-typed-funcref.

R=ahaas@chromium.org
CC=jkummerow@chromium.org
CC=manoskouk@chromium.org

Bug: v8:9495
Change-Id: Ia156aeacf95bc36a9fc182990f315c42075cbb7b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2207184
Commit-Queue: Emanuel Ziegler <ecmziegler@chromium.org>
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67900}
2020-05-19 14:09:30 +00:00
Richard Stotz
c8d51a8159 [wasm][liftoff][arm64] Add saturated conversion float->int
Bug: v8:10520
Change-Id: I765201107b6cee20ad8591db57ac88fef5b3dbbe
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2207534
Commit-Queue: Richard Stotz <rstz@chromium.org>
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67899}
2020-05-19 12:51:35 +00:00
Richard Stotz
80796956dc [wasm][liftoff][arm] Add saturated conversion float->int64
Bug: v8:10520
Change-Id: I40b94705e638fa6491cef7ca7f8c6287657af06f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2202909
Commit-Queue: Richard Stotz <rstz@chromium.org>
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67897}
2020-05-19 12:46:01 +00:00
Clemens Backes
18ac08d03c Reland "[wasm][debug] Fix tier down during streaming compilation"
This is a reland of 3cc981cb7a with a
fix for data race detected by TSan.

Original change's description:
> [wasm][debug] Fix tier down during streaming compilation
>
> If the debugger is enabled while streaming compilation is happening, we
> won't correctly tier down to Liftoff. This is because during streaming
> compilation, we always compile for no debugging. Fixing that is a bit
> tricky, since when the debugger is enabled, functions can either already
> have finished compiling, or they are currently being compiled, or their
> wire bytes are not received yet.
> Instead of handling this correctly while streaming compilation is
> running, we just recompile the whole module with Liftoff after streaming
> compilation finished.
>
> For testing this, we use the existing tests for async compilation, and
> enable --wasm-test-streaming, which compiles via the streaming decoder
> even in the async compilation case.
>
> R=thibaudm@chromium.org
>
> Bug: v8:10531
> Change-Id: I0177248a9ad2e90f83faee965d6746de05423f1f
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2207133
> Reviewed-by: Thibaud Michaud <thibaudm@chromium.org>
> Commit-Queue: Clemens Backes <clemensb@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#67882}

Bug: v8:10531, v8:10544
Change-Id: I884922b6ac55543e6ff9b1046438f6b3abab6f64
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2207187
Reviewed-by: Thibaud Michaud <thibaudm@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67896}
2020-05-19 12:37:00 +00:00
Clemens Backes
4126662b52 [wasm] Disable Liftoff in single-threaded mode
For single-threaded, we can not tier up in the background. Hence we can
either tier up in foreground (which is pointless), or not tier up.
This CL disables Liftoff, so will compile TurboFan code right away.

R=ahaas@chromium.org

Bug: v8:10530
Change-Id: Icfdc26643ab219d617f844c2ea8e149870168dbc
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2208853
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67894}
2020-05-19 12:09:06 +00:00
Richard Stotz
3c6b5acc06 [wasm][liftoff][arm] Add saturated conversion float->int32
Bug: v8:10520
Change-Id: Ifc99782682c7b1597357211d72a11c44703965b2
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2202907
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Commit-Queue: Richard Stotz <rstz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67893}
2020-05-19 12:00:00 +00:00
Clemens Backes
8d3cca9792 Revert "[wasm][debug] Fix tier down during streaming compilation"
This reverts commit 3cc981cb7a.

Reason for revert: TSan failures: https://ci.chromium.org/p/v8/builders/ci/V8%20Linux64%20TSAN/31572

Original change's description:
> [wasm][debug] Fix tier down during streaming compilation
> 
> If the debugger is enabled while streaming compilation is happening, we
> won't correctly tier down to Liftoff. This is because during streaming
> compilation, we always compile for no debugging. Fixing that is a bit
> tricky, since when the debugger is enabled, functions can either already
> have finished compiling, or they are currently being compiled, or their
> wire bytes are not received yet.
> Instead of handling this correctly while streaming compilation is
> running, we just recompile the whole module with Liftoff after streaming
> compilation finished.
> 
> For testing this, we use the existing tests for async compilation, and
> enable --wasm-test-streaming, which compiles via the streaming decoder
> even in the async compilation case.
> 
> R=​thibaudm@chromium.org
> 
> Bug: v8:10531
> Change-Id: I0177248a9ad2e90f83faee965d6746de05423f1f
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2207133
> Reviewed-by: Thibaud Michaud <thibaudm@chromium.org>
> Commit-Queue: Clemens Backes <clemensb@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#67882}

TBR=clemensb@chromium.org,thibaudm@chromium.org

Change-Id: I26e750c6c6d0783b5e4a0f19a5462a5fbe99a742
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: v8:10531
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2207186
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67885}
2020-05-19 08:38:51 +00:00
Richard Stotz
73bf6079a0 [wasm][liftoff][ia32] Add saturated conversion float->int64
We implement the conversions via C functions (external references)
because 64-bit conversions are difficult to implement on ia32 and
would not be significantly faster.

Bug: v8:10520
Change-Id: I3573d30bf6b3d558f708c7e0273f027c30a1a771
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2202988
Commit-Queue: Richard Stotz <rstz@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67883}
2020-05-19 07:53:10 +00:00
Clemens Backes
3cc981cb7a [wasm][debug] Fix tier down during streaming compilation
If the debugger is enabled while streaming compilation is happening, we
won't correctly tier down to Liftoff. This is because during streaming
compilation, we always compile for no debugging. Fixing that is a bit
tricky, since when the debugger is enabled, functions can either already
have finished compiling, or they are currently being compiled, or their
wire bytes are not received yet.
Instead of handling this correctly while streaming compilation is
running, we just recompile the whole module with Liftoff after streaming
compilation finished.

For testing this, we use the existing tests for async compilation, and
enable --wasm-test-streaming, which compiles via the streaming decoder
even in the async compilation case.

R=thibaudm@chromium.org

Bug: v8:10531
Change-Id: I0177248a9ad2e90f83faee965d6746de05423f1f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2207133
Reviewed-by: Thibaud Michaud <thibaudm@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67882}
2020-05-19 07:44:05 +00:00
Milad Farazmand
a43287f123 PPC/s390: [wasm-simd][liftoff][arm][arm64] Implement i8x16 shr
Port 99e4ef48e1

Original Commit Message:

    Only for arm and arm64 now. The ia32 and x64 ones are more complicated
    and will be included in subsequent changes.

R=zhin@chromium.org, joransiu@ca.ibm.com, jyan@ca.ibm.com, michael_dawson@ca.ibm.com
BUG=
LOG=N

Change-Id: I3bcdae0d47d2e024cfb6e80ba460306ec5e2d434
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2205884
Reviewed-by: Zhi An Ng <zhin@chromium.org>
Commit-Queue: Milad Farazmand <miladfar@ca.ibm.com>
Cr-Commit-Position: refs/heads/master@{#67874}
2020-05-18 17:57:44 +00:00
Ng Zhi An
f5336b3d85 Reland "[wasm-simd][liftoff][ia32][x64] Implement i8x16 shr"
This is a reland of edf90ee828

The fix here is to call GetUnusedRegister with {}, in
liftoff-assembler-ia32.h emit_i8x16_shri_u.

Original change's description:
> [wasm-simd][liftoff][ia32][x64] Implement i8x16 shr
>
> The code sequence is the same as TurboFan, only wrapped in a template to
> share the implementation.
>
> Bug: v8:9909
> Change-Id: I9c1b37bbfafe91d1bd8edd7f9dafd86ff1c07623
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2202723
> Commit-Queue: Zhi An Ng <zhin@chromium.org>
> Reviewed-by: Clemens Backes <clemensb@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#67842}

Bug: v8:9909
Change-Id: Id56a612cd6580c68a5129e71d7a0e7b29d64b368
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2204080
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67873}
2020-05-18 17:21:24 +00:00
Manos Koukoutos
4f3b9ddd8c [wasm][refactor] Improve SsaEnv implementation
- Add a default, move, and copy constructor for SsaEnv and use them
  when possible.
- Bring the Split method signature in line with Steal and
  Unimplemented.

Changes: 
Change-Id: I626142fbd1c1ed15c1852b9bfc8b39a0e936b839
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2204278
Commit-Queue: Manos Koukoutos <manoskouk@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67871}
2020-05-18 16:49:44 +00:00
Richard Stotz
72ae7f48cc [wasm][liftoff][ia32] Add saturated conversion float->int32
Bug: v8:10520
Change-Id: If24a2d74b6e1837b4c29383e4c537e872404e0a4
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2201764
Commit-Queue: Richard Stotz <rstz@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67868}
2020-05-18 14:51:21 +00:00
Richard Stotz
003b2622d9 [wasm][liftoff][x64] Add saturated conversion float->int64
Bug: v8:10520
Change-Id: Iad8d35e58b766a9e4d3013f90fd4d7fb68708fa7
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2201577
Commit-Queue: Richard Stotz <rstz@chromium.org>
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67866}
2020-05-18 14:02:50 +00:00
Richard Stotz
19e3eb8fd9 [wasm][liftoff][mips64] changed default position in switch-case
Bug: v8:10520
Change-Id: Id06c35f8004519cd778af12ad67aaee2d506609a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2207135
Commit-Queue: Richard Stotz <rstz@chromium.org>
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67863}
2020-05-18 12:56:30 +00:00
Richard Stotz
9282c90732 [wasm][liftoff][x64] Add saturated conversion float->int32
Bug: v8:10520
Change-Id: I0b4867d9b705058536b0f4640a9a87059db3aca7
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2201576
Commit-Queue: Richard Stotz <rstz@chromium.org>
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67858}
2020-05-18 10:36:21 +00:00
Jakob Kummerow
f87539b4a8 [cleanup] Replace some "default:" with explicit cases
When the intention is to handle every case, *and* when we can be
reasonably sure that no invalid enum values will occur (e.g. from
reading untrusted data), then we shouldn't have a "default:" case
in a switch statement so that the compiler will warn us when a
case is missing.

Bug: v8:10506
Change-Id: Iefdebd54802611e7ec3479afa3c4e6506f97a095
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2204284
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67854}
2020-05-18 09:30:00 +00:00
Zhao Jiazhong
e3a7b2177e [mips][wasm-simd][liftoff] Implement i32x4, i16x8, i8x16 shr
Port 0ba8b7165a
https://crrev.com/c/2202356

Port 67a337b5b6
https://crrev.com/c/2202718

Port 99e4ef48e1
https://crrev.com/c/2202722

Change-Id: I435c9859b9ef341682814bb989fe91ba8cae3d86
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2203896
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Zhao Jiazhong <zhaojiazhong-hf@loongson.cn>
Cr-Commit-Position: refs/heads/master@{#67849}
2020-05-18 07:40:41 +00:00
Clemens Backes
f47c6a5ace [wasm] Print debug side table together with code
For debugging (either with --print-wasm-code, or inspecting the current
code object in a debugger) it's helpful to also see the debug side
table, if available.

This CL adds print support for that, and uses it when printing wasm
code, and after generating a new debug side table.

R=thibaudm@chromium.org

Bug: v8:10359
Change-Id: I700b6eacb80f015212115e91b94c513e88c04288
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2202902
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Thibaud Michaud <thibaudm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67848}
2020-05-18 07:33:44 +00:00
Manos Koukoutos
5ccf1bf955 [wasm][refactor] Make SigEnv a ZoneObject
Also, change its 'locals' field to a ZoneVector.
This is needed for 'let' as per [wasm-gc].

Bug: v8:7748
Change-Id: I9e6ca7f7e483b4bc13b64643107297be31af0e35
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2202995
Commit-Queue: Manos Koukoutos <manoskouk@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67847}
2020-05-18 07:24:39 +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
Milad Farazmand
ed7f102e91 PPC/s390: [wasm-simd][liftoff] Implement i16x8 shr
Port 67a337b5b6

Original Commit Message:

    Implement for x64, ia32, arm64, and arm.

R=zhin@chromium.org, joransiu@ca.ibm.com, jyan@ca.ibm.com, michael_dawson@ca.ibm.com
BUG=
LOG=N

Change-Id: I8b512992a3cc583f31f433db037fabf65714628a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2204542
Reviewed-by: Zhi An Ng <zhin@chromium.org>
Commit-Queue: Milad Farazmand <miladfar@ca.ibm.com>
Cr-Commit-Position: refs/heads/master@{#67844}
2020-05-15 21:56:04 +00:00
Zhi An Ng
db1ab4fa89 Revert "[wasm-simd][liftoff][ia32][x64] Implement i8x16 shr"
This reverts commit edf90ee828.

Reason for revert: https://ci.chromium.org/p/v8/builders/ci/V8%20Win32%20-%20debug%20builder/36129?

Original change's description:
> [wasm-simd][liftoff][ia32][x64] Implement i8x16 shr
> 
> The code sequence is the same as TurboFan, only wrapped in a template to
> share the implementation.
> 
> Bug: v8:9909
> Change-Id: I9c1b37bbfafe91d1bd8edd7f9dafd86ff1c07623
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2202723
> Commit-Queue: Zhi An Ng <zhin@chromium.org>
> Reviewed-by: Clemens Backes <clemensb@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#67842}

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

Change-Id: I04b9993040fa8a1dd69a4fa892a35273682d3efa
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: v8:9909
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2204550
Reviewed-by: Zhi An Ng <zhin@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67843}
2020-05-15 21:20:16 +00:00
Ng Zhi An
edf90ee828 [wasm-simd][liftoff][ia32][x64] Implement i8x16 shr
The code sequence is the same as TurboFan, only wrapped in a template to
share the implementation.

Bug: v8:9909
Change-Id: I9c1b37bbfafe91d1bd8edd7f9dafd86ff1c07623
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2202723
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67842}
2020-05-15 21:12:44 +00:00
Ng Zhi An
99e4ef48e1 [wasm-simd][liftoff][arm][arm64] Implement i8x16 shr
Only for arm and arm64 now. The ia32 and x64 ones are more complicated
and will be included in subsequent changes.

Bug: v8:9909
Change-Id: I6597efbccd780e12234f8674e09e60bb3f803630
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2202722
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67840}
2020-05-15 21:00:04 +00:00
Milad Farazmand
013ad9e23d PPC/s390: [wasm-simd][liftoff] Implement i32x4 shr_s shr_u
Port 0ba8b7165a

Original Commit Message:

    Implemented for x64, ia32, arm64, arm.

R=zhin@chromium.org, joransiu@ca.ibm.com, jyan@ca.ibm.com, michael_dawson@ca.ibm.com
BUG=
LOG=N

Change-Id: I45caa3fbf643e3caa7b452383155fa32d3ca399e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2204333
Reviewed-by: Junliang Yan <jyan@ca.ibm.com>
Commit-Queue: Milad Farazmand <miladfar@ca.ibm.com>
Cr-Commit-Position: refs/heads/master@{#67839}
2020-05-15 19:11:34 +00:00
Jakob Kummerow
509866f778 [cleanup][wasm] Use explicit types instead of "auto"
in function-body-decoder-impl.h.

Bug: v8:10506
Change-Id: If31aa9e35cc34f6c1c191bd487b1b01727e01dc1
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2204204
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67838}
2020-05-15 18:31:12 +00:00
Andreas Haas
0b5f3c70a3 [d8][wasm] Don't enable streaming compilation without async compilation
The --wasm-test-streaming flag enabled streaming compilation after a
check that streaming compilation is not enabled if async compilation is
not enabled. This caused a later check to trigger. With this CL
streaming compilation does not get enabled by --wasm-test-streaming if
async compilation is not enabled.

R=clemensb@chromium.org

Bug: chromium:1082990
Change-Id: Ibe12389beae6a3335d3c8b6039fcea450f25d281
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2202985
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67837}
2020-05-15 18:11:22 +00:00
Ng Zhi An
67a337b5b6 [wasm-simd][liftoff] Implement i16x8 shr
Implement for x64, ia32, arm64, and arm.

Bug: v8:9909
Change-Id: Ia9499b211e915f8763b4f593824099391dca7e1f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2202718
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67836}
2020-05-15 17:47:03 +00:00
Ng Zhi An
0ba8b7165a [wasm-simd][liftoff] Implement i32x4 shr_s shr_u
Implemented for x64, ia32, arm64, arm.

Bug: v8:9909
Change-Id: Ib1479525d44c29b2ba02de31d655da2cde21d9fc
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2202356
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67835}
2020-05-15 17:13:52 +00:00