Commit Graph

3997 Commits

Author SHA1 Message Date
Ng Zhi An
70b4f28bec [wasm-simd][liftoff][arm][arm64] Implement div and sqrt
Bug: v8:9909
Change-Id: Ia5038fccb756d79b08b10a5fd0664b0da8b6a8ca
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2151172
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67185}
2020-04-16 16:53:32 +00:00
Ng Zhi An
c490c73d83 [wasm-simd][liftoff][arm][arm64] Implement eq
Bug: v8:9909
Change-Id: Ib94db390f70ddaa7eafb5af77023b1024c2b96b9
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2151168
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67181}
2020-04-16 16:27:07 +00:00
Philip Pfaffe
f47009a8f5 [wasm-debug-eval] Reland: Implement additional evaluator API
This CL relands the implementation of the __getLocal and __sbrk APIs of
the evaluator interface reverted in efea740. Update the original
commit to account for a changes to the import function name tracking and
defaulting to debugging with liftoff.

Change-Id: I9674aad419fb1dab0a9ecbb5d3fd4c33186b127a
Bug: chromium:1020120
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2151353
Commit-Queue: Philip Pfaffe <pfaffe@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67178}
2020-04-16 15:10:07 +00:00
Clemens Backes
a776ccaa69 [wasm] Clean up tiering logic
This cleans up several parts of the tiering logic.
1) Instead of using the {ExecutionTier} to specify whether we do tier up
   or down, we introduce a new {TieringState} enum and use that
   consistently (also where a {bool} was used before).
2) When tiering up or tiering down, always recompile all functions. It's
   very unlikely that we can reuse previous code anyway (tiering down is
   cheap enough to just always do it, and when tiering up we need to
   recompile everything anyway).
3) Remove the {WasmEngine::RecompileAllFunctions} method and inline the
   implementation into callers.
4) Drive-by: Remove some obsolete comments and fix or extend others.

R=thibaudm@chromium.org

Bug: v8:10410
Change-Id: Ic765c6760dd97473ccfd469f22a2514695075587
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2151355
Reviewed-by: Thibaud Michaud <thibaudm@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67175}
2020-04-16 14:03:17 +00:00
Andreas Haas
6210bc8254 [wasm] Change liftoff assembler interface for atomic binops
The existing interface assumed that for atomic binop instructions, the
value register and the result register are the same. However, for x64,
this assumption is not always useful, and for platforms like arm, this
assumption is even negative.

The existing interface was originally introduced because ia32 lacks
registers, and we wanted to avoid platform-specific code in
liftoff-compiler.cc. However, by now the lack of registers on ia32
required us to use platform-specific code also in other places, so
we can also use it for atomic binops and thereby enable a better code
generation.

R=clemensb@chromium.org

Bug: v8:10108
Change-Id: If39cc5f49934422b632bb2a5793c7f5d5d2b65c0
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2150585
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67173}
2020-04-16 13:20:57 +00:00
Philip Pfaffe
8d368f09ac [wasm] ZoneBuffer: Avoid memcpy of Empty Byte Arrays
Trying to write an empty byte array currently invokes undefined behavior
if the byte array is null. That's the case when trying to write an empty
vector for example. Copying zero bytes from nullptr is defined as UB for
memcpy.

Change-Id: I6f7e920c1e19e8b2e3779bbc1c0ad79fc8bd6e98
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2148789
Commit-Queue: Philip Pfaffe <pfaffe@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67168}
2020-04-16 10:55:24 +00:00
Clemens Backes
0b392da22d [wasm] Re-enable native module cache
This reverts commit https://crrev.com/c/2144966, which was merged to
v8.1 in https://crrev.com/c/2151345.

R=thibaudm@chromium.org

Bug: chromium:1070199
Change-Id: Idb25cfaa52f7f7aa07353cf0372e6758adb58d78
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2151346
Reviewed-by: Thibaud Michaud <thibaudm@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67166}
2020-04-16 09:35:54 +00:00
Zhao Jiazhong
5ad6adc3ad [mips][wasm-simd][liftoff] Implement div/sqrt
Port ad55fa63d3
https://crrev.com/c/2147148

Change-Id: I5375ae4bddb2221c6f7860e55111c95beeed757d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2152069
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Zhao Jiazhong <zhaojiazhong-hf@loongson.cn>
Cr-Commit-Position: refs/heads/master@{#67165}
2020-04-16 09:30:44 +00:00
Kim-Anh Tran
7dd38901ec [wasm][debug] Rename global scope to module scope
Bug: chromium:1043034
Change-Id: I18b1c307ab198e7fbd4d5bc7df399c310f317c4b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2149419
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Kim-Anh Tran <kimanh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67159}
2020-04-15 19:10:50 +00:00
Ng Zhi An
63f5cecf18 [wasm-simd][liftoff][arm][arm64] Implement abs
Bug: v8:9909
Change-Id: I8beaa9a430c86c00311e5cc713c2870d2a588ab8
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2149712
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67157}
2020-04-15 16:34:00 +00:00
Ng Zhi An
34e5a0b55c [wasm-simd][liftoff][arm][arm64] Implement sub saturate
Bug: v8:9909
Change-Id: I6e367b98c0f85c740947d72e9b0a29870e9e03e2
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2147602
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67156}
2020-04-15 16:23:50 +00:00
Milad Farazmand
2a96e26218 PPC/s390: [wasm-simd][liftoff] Implement eq on x64 and ia32
Port 325e329040

R=jing.bao@intel.com, joransiu@ca.ibm.com, jyan@ca.ibm.com, michael_dawson@ca.ibm.com
BUG=
LOG=N

Change-Id: I743d710a501e1f01cbe4c4052fb26423e8a3990e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2150303
Reviewed-by: Joran Siu <joransiu@ca.ibm.com>
Commit-Queue: Milad Farazmand <miladfar@ca.ibm.com>
Cr-Commit-Position: refs/heads/master@{#67155}
2020-04-15 15:59:39 +00:00
Clemens Backes
baa9dc1da0 [wasm][gc] Fix rare never-ending code GCs
Sometimes we were triggering a wasm code GC at a time where all native
modules just died. Thus, no isolates took part in that GC, and it never
finished (because no isolate would ever call {ReportLiveCodeForGC}).
This never-ending GC would then block all other GCs for the rest of the
life of this wasm engine.

This CL fixes this by just finishing the GC immediately if no isolates
are outstanding.

R=ahaas@chromium.org

Change-Id: I4c25dd6ba4132cf9f72de39c30da5d5cba0526ad
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2150588
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67154}
2020-04-15 15:50:20 +00:00
Kong, Fanchen
ad55fa63d3 [wasm-simd] [liftoff] Implement div/sqrt on x64 and ia32
Bug: v8:9909
Change-Id: I5afad8ef0c5bf2ccad61d71fcc0c89db48851e24
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2147148
Commit-Queue: Fanchen Kong <fanchen.kong@intel.com>
Reviewed-by: Zhi An Ng <zhin@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67146}
2020-04-15 11:27:29 +00:00
Zhao Jiazhong
29300ffe16 [mips][wasm-simd][liftoff] Implement eq
Port 325e329040
https://crrev.com/c/2147594

Change-Id: If453f75dbf632d84817eca254d0b31e095d5bebb
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2147590
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Zhao Jiazhong <zhaojiazhong-hf@loongson.cn>
Cr-Commit-Position: refs/heads/master@{#67142}
2020-04-15 08:11:34 +00:00
jing.bao
325e329040 [wasm-simd][liftoff] Implement eq on x64 and ia32
Bug: v8:9909
Change-Id: I04e50b02f52c24dd39ff3edb26cbaf8843b6910a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2147594
Reviewed-by: Zhi An Ng <zhin@chromium.org>
Commit-Queue: Jing Bao <jing.bao@intel.com>
Cr-Commit-Position: refs/heads/master@{#67137}
2020-04-15 00:44:12 +00:00
Zhao Jiazhong
244a9e318c [mips][wasm-simd][liftoff] Implement abs
Port 4558c1dfc5
https://crrev.com/c/2141654

Original Commit Message:

  As a drive-by, the order of rounding_average_u is adjusted according to
  src/wasm/wasm-opcodes.h.

Change-Id: Ia2d39753f618f10e0795f83daa7e5a63f49f554a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2147578
Reviewed-by: Zhi An Ng <zhin@chromium.org>
Commit-Queue: Zhao Jiazhong <zhaojiazhong-hf@loongson.cn>
Cr-Commit-Position: refs/heads/master@{#67136}
2020-04-15 00:21:22 +00:00
Andreas Haas
401190baf0 [wasm] Fix return value of concurrent memory.grow
When memory.grow was executed concurrently on multiple threads a data
race could happen such that two memory.grow operations result in the
same return value. With this CL the return value of memory.grow is
unique, given that memory.grow actually grows the memory.

As a concrete example, assume a shared WebAssembly memory initially has
a size of 100. Assume two threads call memory.grow concurrently with a
parameter `10`. Then with the existing code, memory would grow correctly
to a size of 120, but the data race may cause both memory.grow
operations to return 100. With the change in this CL one memory.grow
operation would return 100, the other would return 110.

R=gdeepti@chromium.org
CC=rreverser@google.com

Bug: chromium:1067621
Change-Id: Ib22b5135714a56799e0818ccb39e5dce327e5f8e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2144113
Reviewed-by: Ben Smith <binji@chromium.org>
Reviewed-by: Deepti Gandluri <gdeepti@chromium.org>
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67135}
2020-04-14 21:37:32 +00:00
Ng Zhi An
1171a5fcfa [wasm-simd][liftoff][arm][arm64] Implement rounding average unsigned
Bug: v8:9909
Change-Id: I9145ac93392073f01e2df9fec8eeae0b6e75dd00
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2145238
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67132}
2020-04-14 18:56:42 +00:00
Ng Zhi An
601c489d2e [wasm-simd][liftoff][arm][arm64] Implement neg
Bug: v8:9909
Change-Id: I38e3a8d8915148107b7ff810e1e28c97351da65a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2145237
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67131}
2020-04-14 18:18:02 +00:00
Thibaud Michaud
ab6aa5179d [wasm][mv] Fix multi-return validation order
R=ahaas@chromium.org

Bug: v8:10328
Change-Id: I19ecad9161ea61b4c8a22f80f8ac10ebf23dee53
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2148783
Commit-Queue: Thibaud Michaud <thibaudm@chromium.org>
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67127}
2020-04-14 16:34:13 +00:00
Andreas Haas
4615655c78 [wasm][liftoff] Implement atomic load and store on arm
The CL also mooves the {ClearRegister} function to the
platform-independent LiftoffAssembler code.

R=clemensb@chromium.org

Bug: v8:10108
Change-Id: Ibf9f1829a525c859ad004636f678b82aa72d39ae
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2129637
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Reviewed-by: Jacob Bramley <jacob.bramley@arm.com>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67126}
2020-04-14 16:04:22 +00:00
Clemens Backes
efea740768 Revert "[wasm-debug-eval] Implement additional evaluator API methods"
This reverts commit f2ea42d6b8.

Reason for revert: Makes UBSan unhappy: https://ci.chromium.org/p/v8/builders/ci/V8%20Linux64%20UBSan/10634

Original change's description:
> [wasm-debug-eval] Implement additional evaluator API methods
> 
> This CL implements the __getLocal and __sbrk APIs of the evaluator
> interface.  Also includes a drive-by fix of the imports' module: put
> them on the "env" module.
> 
> Change-Id: Ie16d1b1cf924b88734eda184d1ce98d52f32f828
> Bug: chromium:1020120
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2132786
> Commit-Queue: Philip Pfaffe <pfaffe@chromium.org>
> Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#67122}

TBR=jkummerow@chromium.org,pfaffe@chromium.org

Change-Id: I23b078d37971e083c08c9b83994bbf38ac13f103
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: chromium:1020120
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2148787
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67124}
2020-04-14 15:43:04 +00:00
Clemens Backes
cf382c89fe [wasm][debug] Prefer debug code in tiered down mode
We were still occasionally failing tests because sometimes non-debug
Liftoff code was published *after* debug Liftoff code. This would
overwrite the debug code and we would not stop on function entry then.
This fixes this by only preferring Liftoff code in publishing if it has
been compiled for debugging.
As a side effect, this will also prefer TurboFan code which has been
compiled for debugging (i.e. Liftoff bailed out), but this would only
happen for experimental features and in this case we will just overwrite
TurboFan code with TurboFan code, which is fine.

R=thibaudm@chromium.org

Bug: v8:10410
Change-Id: I6516e9f474f6118f0f0c077e6789f604ca128e74
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2144122
Reviewed-by: Thibaud Michaud <thibaudm@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67123}
2020-04-14 15:21:51 +00:00
Philip Pfaffe
f2ea42d6b8 [wasm-debug-eval] Implement additional evaluator API methods
This CL implements the __getLocal and __sbrk APIs of the evaluator
interface.  Also includes a drive-by fix of the imports' module: put
them on the "env" module.

Change-Id: Ie16d1b1cf924b88734eda184d1ce98d52f32f828
Bug: chromium:1020120
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2132786
Commit-Queue: Philip Pfaffe <pfaffe@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67122}
2020-04-14 15:18:11 +00:00
Clemens Backes
4721585bee [wasm] Store whether code was generated for debugging
This adds a flag to {WasmCode} objects to store whether this code was
generated for debugging. This flag can be set for Liftoff code (in which
case the code will e.g. have an extended prologue for debugging), but it
can also be set for TurboFan, in case Liftoff bailed out when producing
the debugging code.

Having this flag allows us to remove the hack to pass the compilation
results to {OnFinishedUnits} just to check whether we actually wanted to
compile Liftoff functions.

Drive-by: Replace the {ReachedRecompilationTierField} by a
{MissingRecompilationField}, because all we need to know is if we are
still waiting for that function to get recompiled.

R=ahaas@chromium.org

Bug: v8:10330,v8:10410
Change-Id: Ia023df8955a60d9f5595a6cb2737e14d83baf716
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2142259
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67119}
2020-04-14 14:51:39 +00:00
Clemens Backes
e0433f7dd0 [wasm][debug] Store "for debugging" flag on compilation unit
Before the "debug" flag was stored on the {CompilationEnv}. But each
background compilation task only gets the {CompilationEnv} once when
starting compilation, so by the time it picks up the "Liftoff for
debugging" compilation jobs, it might still compile them without the
debug flag being set. This leads to flakes in the "debug-step-into-wasm"
test, because we won't stop in the function prologue when stepping in
(because the function prologue does not check the "hook on function
call" flag if debug mode was not enabled).

This CL does not increase the size of a compilation unit, since both the
tier and the debug flag only need a single byte each.

As a nice side effect, this change allows us to remove the lock in
{CreateCompilationEnv}, because no modifyable flag is read any more.

R=thibaudm@chromium.org

Bug: v8:10410
Change-Id: Ic296ea0c4dd1d4dedde119f0536e87e5d301b5a1
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2144116
Reviewed-by: Thibaud Michaud <thibaudm@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67115}
2020-04-14 13:58:59 +00:00
Milad Farazmand
a6e80499ab PPC/s390: [wasm-simd][liftoff] Implement abs on x64 and ia32
Port 4558c1dfc5

Original Commit Message:

    As a drive-by, the order of rounding_average_u is adjusted according to src/wasm/wasm-opcodes.h.

R=zhiguo.zhou@intel.com, joransiu@ca.ibm.com, jyan@ca.ibm.com, michael_dawson@ca.ibm.com
BUG=
LOG=N

Change-Id: Ib5c72c9187ee3803c5c04b4fb62422be67382bf1
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2148649
Reviewed-by: Junliang Yan <jyan@ca.ibm.com>
Commit-Queue: Milad Farazmand <miladfar@ca.ibm.com>
Cr-Commit-Position: refs/heads/master@{#67113}
2020-04-14 13:55:09 +00:00
Zhao Jiazhong
22b09a61c2 [mips][wasm-simd][liftoff] Implement sub_saturate
Port c054847d0c
https://crrev.com/c/2131323

Change-Id: I21e534399eed573affd3bf65004b3e570c549ff4
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2147573
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Zhao Jiazhong <zhaojiazhong-hf@loongson.cn>
Cr-Commit-Position: refs/heads/master@{#67105}
2020-04-14 07:30:10 +00:00
Zhou, Zhiguo
4558c1dfc5 [wasm-simd][liftoff] Implement abs on x64 and ia32
As a drive-by, the order of rounding_average_u is adjusted according to src/wasm/wasm-opcodes.h.

Bug: v8:9909
Change-Id: Ia3a2ed5869f8df8a2191afa034e0b9438de98bc5
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2141654
Reviewed-by: Zhi An Ng <zhin@chromium.org>
Commit-Queue: Zhiguo Zhou <zhiguo.zhou@intel.com>
Cr-Commit-Position: refs/heads/master@{#67104}
2020-04-13 23:43:47 +00:00
Clemens Backes
335c9941a9 [wasm] Temporarily disable native module cache
v8.1 has a stability issue where we free code too early. Thus disable
for now, such that we can merge this back to v8.1.
v8.2 does not have this problem, since https://crrev.com/c/2078583 fixed
it. This CL is not easily backmergable though.

R=tebbi@chromium.org

Bug: chromium:1070199, chromium:1070182
Change-Id: I4bf468b3e7b5b1e66b314907f844d4195b3ff029
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2144966
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67103}
2020-04-13 17:51:52 +00:00
Zhao Jiazhong
0d011fb21f [mips][wasm-simd][liftoff] Implement neg
Port 445f9ef13c
https://crrev.com/c/2107511

Change-Id: Ib3517c186da6e49574b873ac568afd0e8e4336c5
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2143980
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Zhao Jiazhong <zhaojiazhong-hf@loongson.cn>
Cr-Commit-Position: refs/heads/master@{#67102}
2020-04-13 16:01:27 +00:00
Milad Farazmand
0b15ec3fbe PPC/s390: [wasm-simd][liftoff] Implement neg on x64 and ia32
Port 445f9ef13c

R=zhiguo.zhou@intel.com, joransiu@ca.ibm.com, jyan@ca.ibm.com, michael_dawson@ca.ibm.com
BUG=
LOG=N

Change-Id: I3b383071ea26286e9d1d5121565020a0c6f31a91
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2147030
Reviewed-by: Junliang Yan <jyan@ca.ibm.com>
Commit-Queue: Milad Farazmand <miladfar@ca.ibm.com>
Cr-Commit-Position: refs/heads/master@{#67101}
2020-04-13 14:33:51 +00:00
Milad Farazmand
d29853c5c3 PPC/s390: [wasm-simd] [liftoff] Implement rounding average on x64 and ia32
Port bd04ee0864

R=fanchen.kong@intel.com, joransiu@ca.ibm.com, jyan@ca.ibm.com, michael_dawson@ca.ibm.com
BUG=
LOG=N

Change-Id: I3b8e2625816a8517a0557882d6acdb6d6f28766b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2147029
Reviewed-by: Junliang Yan <jyan@ca.ibm.com>
Commit-Queue: Milad Farazmand <miladfar@ca.ibm.com>
Cr-Commit-Position: refs/heads/master@{#67100}
2020-04-13 13:58:02 +00:00
Kong, Fanchen
c054847d0c [wasm-simd] [liftoff] Implement sub_saturate on x64 and ia32
Bug: v8:9909
Change-Id: I13d7ae7b304fe55645ef7bcc9ac404782bb55d4e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2131323
Reviewed-by: Zhi An Ng <zhin@chromium.org>
Commit-Queue: Fanchen Kong <fanchen.kong@intel.com>
Cr-Commit-Position: refs/heads/master@{#67099}
2020-04-13 12:05:31 +00:00
Zhao Jiazhong
ffb4f2b77f [mips][wasm-simd][liftoff] Implement rounding average
Port bd04ee0864
https://crrev.com/c/2143386

Change-Id: I547c9b5b341abe76d6983a07633129299c32e017
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2143978
Reviewed-by: Zhi An Ng <zhin@chromium.org>
Commit-Queue: Zhao Jiazhong <zhaojiazhong-hf@loongson.cn>
Cr-Commit-Position: refs/heads/master@{#67098}
2020-04-11 01:41:28 +00:00
Zhou, Zhiguo
445f9ef13c [wasm-simd][liftoff] Implement neg on x64 and ia32
Bug: v8:9909
Change-Id: I21980ee97e0d2483c064e40cae181297b4d563a1
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2107511
Commit-Queue: Zhiguo Zhou <zhiguo.zhou@intel.com>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67096}
2020-04-10 01:43:25 +00:00
Kong, Fanchen
bd04ee0864 [wasm-simd] [liftoff] Implement rounding average on x64 and ia32
Bug: v8:9909
Change-Id: I5dd3e88ab6f7508a07b2a8e5adb033fff7e28fe2
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2143386
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Zhi An Ng <zhin@chromium.org>
Commit-Queue: Fanchen Kong <fanchen.kong@intel.com>
Cr-Commit-Position: refs/heads/master@{#67095}
2020-04-10 01:37:44 +00:00
Zhao Jiazhong
2bfc26581e [mips][wasm-simd][liftoff] Reorder SIMD opcodes
Port 04b6e0de24
https://crrev.com/c/2135074

Original Commit Message:

  This reorders the SIMD opcodes together with their implementations
  on x64, ia32 according to src/wasm/wasm-opcodes.h.

Change-Id: I82c8b678eb65b616d02d20333d479ee4ae0564d0
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2143974
Reviewed-by: Zhi An Ng <zhin@chromium.org>
Commit-Queue: Zhao Jiazhong <zhaojiazhong-hf@loongson.cn>
Cr-Commit-Position: refs/heads/master@{#67094}
2020-04-10 00:48:16 +00:00
Thibaud Michaud
a874463aff Reland "[wasm] Cleanup wasm script creation"
This is a reland of f902ef3257

Original change's description:
> [wasm] Cleanup wasm script creation
> 
> - Do not expose CreateWasmScript since we should now use
> WasmEngine:GetOrCreateScript instead,
> - Initialize all Script fields in CreateWasmScript, not in
> WasmModuleObject::New,
> - Do not pass code size estimate argument, since we can always use the
> actual native module's committed code space.
> 
> R=clemensb@chromium.org
> 
> Bug: v8:10349
> Change-Id: If9250d62ffc271ab6efc3b9c45958a305c9d1827
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2135633
> Reviewed-by: Clemens Backes <clemensb@chromium.org>
> Commit-Queue: Thibaud Michaud <thibaudm@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#67083}

Bug: v8:10349
Change-Id: I38c8b6beb07a1e5d565c6a5fd749daea147817bb
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2144064
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Thibaud Michaud <thibaudm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67087}
2020-04-09 14:43:54 +00:00
Clemens Backes
e24b8bf751 Revert "[wasm] Cleanup wasm script creation"
This reverts commit f902ef3257.

Reason for revert: Makes gc-stress unhappy: https://ci.chromium.org/p/v8/builders/ci/V8%20Linux%20-%20gc%20stress/27404

Original change's description:
> [wasm] Cleanup wasm script creation
> 
> - Do not expose CreateWasmScript since we should now use
> WasmEngine:GetOrCreateScript instead,
> - Initialize all Script fields in CreateWasmScript, not in
> WasmModuleObject::New,
> - Do not pass code size estimate argument, since we can always use the
> actual native module's committed code space.
> 
> R=​clemensb@chromium.org
> 
> Bug: v8:10349
> Change-Id: If9250d62ffc271ab6efc3b9c45958a305c9d1827
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2135633
> Reviewed-by: Clemens Backes <clemensb@chromium.org>
> Commit-Queue: Thibaud Michaud <thibaudm@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#67083}

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

Change-Id: Iac2978af1a300ec079baebab0feb8c9598711738
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: v8:10349
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2144058
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67085}
2020-04-09 12:39:13 +00:00
Thibaud Michaud
f902ef3257 [wasm] Cleanup wasm script creation
- Do not expose CreateWasmScript since we should now use
WasmEngine:GetOrCreateScript instead,
- Initialize all Script fields in CreateWasmScript, not in
WasmModuleObject::New,
- Do not pass code size estimate argument, since we can always use the
actual native module's committed code space.

R=clemensb@chromium.org

Bug: v8:10349
Change-Id: If9250d62ffc271ab6efc3b9c45958a305c9d1827
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2135633
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Thibaud Michaud <thibaudm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67083}
2020-04-09 11:55:03 +00:00
Thibaud Michaud
cecf826277 [liftoff][mv] Support multi-value loops in Liftoff
R=ahaas@chromium.org

Bug: v8:10408
Change-Id: I6a4a1d82333cf31520526c766357c78d3d8dd206
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2140941
Commit-Queue: Thibaud Michaud <thibaudm@chromium.org>
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67082}
2020-04-09 11:47:03 +00:00
Clemens Backes
b9976edb10 [liftoff] Replace i32 cmp op macro by template
Templates provide better error messages and make debugging easier.

R=zhin@chromium.org

Bug: v8:10364
Change-Id: Ia3581c4458e8edb3b24371605000b0b00bb5069d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2140936
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67081}
2020-04-09 11:11:53 +00:00
Clemens Backes
8e755eaa02 [liftoff] Inline simple cmp op macros
This increases source code size, but the code is simple and repetitive.
Complexity is reduced by removing the macros.

R=zhin@chromium.org

Bug: v8:10364
Change-Id: I989c4d78aaebe00c7fbb525d88a6670cd0fe3b92
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2141732
Reviewed-by: Zhi An Ng <zhin@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67078}
2020-04-09 09:07:43 +00:00
Ng Zhi An
f711f5a1de [wasm-simd][fuzzer] Add S8x16Shuffle to fuzzer
Bug: v8:10180
Change-Id: I5e7e83c23b6029cc5b55c2aadee77898173a77f0
Fixed: v8:9543
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2110951
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67071}
2020-04-09 01:02:57 +00:00
Paolo Severini
24c4b77669 [wasm] Fix ClearBreakPoint when debugging in Liftoff
This fixes an issue in WasmScript::ClearBreakPoint, which is was still removing
breakpoints in the interpreter, even when debugging in Liftoff.
The existing test inspector/debugger/wasm-stepping-liftoff.js does not require
any changes.

Change-Id: I5c60839ffde91cdd11d9f808a3102f2cc1324087
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2136872
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Paolo Severini <paolosev@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#67065}
2020-04-08 15:57:14 +00:00
Philip Pfaffe
d5f07e76f8 Fix two bugs in wasm debug evaluate.
Change-Id: If7691bc70aac4a8f2ba8fe383bd44a829a9a0bdb
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2132265
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Philip Pfaffe <pfaffe@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67062}
2020-04-08 13:34:31 +00:00
Zhou, Zhiguo
04b6e0de24 [wasm-simd][liftoff] Reorder SIMD opcodes
This reorders the SIMD opcodes together with their implementations
on x64, ia32 according to src/wasm/wasm-opcodes.h.

Bug: v8:9909
Change-Id: Ib2e75927b3b44ebc951005222c8641c256d8872c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2135074
Reviewed-by: Zhi An Ng <zhin@chromium.org>
Commit-Queue: Zhiguo Zhou <zhiguo.zhou@intel.com>
Cr-Commit-Position: refs/heads/master@{#67051}
2020-04-08 08:24:20 +00:00
Clemens Backes
744123fcf4 [liftoff] Replace lambda in cmp ops by templates
The compare operations pass a hard-coded first argument to the emit
function. Instead of implementing this via a lambda, put it in a separate
{BindFirst} helper, similar to {std::bind_front} (C++20).

R=zhin@chromium.org

Bug: v8:10364
Change-Id: If48c87a3df5ea6fa2b155873e4586af5d6b21119
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2139580
Reviewed-by: Zhi An Ng <zhin@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67047}
2020-04-08 07:05:40 +00:00
Ng Zhi An
350e0f7997 [liftoff][wasm-simd][arm][arm64] Implement max
Bug: v8:9909
Change-Id: Ia680558a03c4de4cf31e233d58e574020a58a0d2
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2137476
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67045}
2020-04-07 19:28:48 +00:00
Ng Zhi An
b9fa48ce3b [liftoff][wasm-simd][arm][arm64] Implement min
Bug: v8:9909
Change-Id: Ie56a99718ee16b70e93ae812a68a1cb08f95da56
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2136869
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67044}
2020-04-07 17:51:55 +00:00
Ng Zhi An
bfe8e95559 [liftoff] Add overload to get Simd128 register from LiftoffRegister
Bug: v8:9909
Change-Id: I578f797f27c304c5212597fe146d62c3607f8d2e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2137471
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67043}
2020-04-07 17:34:59 +00:00
Clemens Backes
813c59545d [wasm][debug] Do not hold lock while recompiling functions
This is to avoid a lock inversion problem. In many situation, the
{NativeModule} lock is held while getting the {DebugInfo} lock.
Hence we should never do is the other way around, otherwise we risk a
deadlock.
When setting a breakpoint, we hold the {DebugInfo} lock when triggering
recompilation, but recompilation accesses the {NativeModule} for
creating the {CompilationEnv}, and therefore takes the {NativeModule}
lock.
This CL fixes this lock inversion by giving up the {DebugInfo} lock
before recompiling functions.

R=thibaudm@chromium.org

Bug: v8:10351
Change-Id: Ic818c6589b2b532006aee4c16bac92b2fe79fa65
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2139574
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Thibaud Michaud <thibaudm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67042}
2020-04-07 15:40:05 +00:00
Kim-Anh Tran
972c096564 [wasm][debug] Remove stack from local scope
This removes the stack from the local scope, as the stack is now
in its own scope.

Bug: chromium:1043034
Change-Id: I595604da71ecf4362ef67134ade8b3987086d258
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2128049
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Kim-Anh Tran <kimanh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67038}
2020-04-07 12:10:35 +00:00
Zhao Jiazhong
7b322ce493 [mips][wasm-simd][liftoff] Implement max of i8x16, i16x8, i32x4
Port dd1dbd99a6
https://crrev.com/c/2134420

Change-Id: Ia1ab8e07a6e126e5b4cdaa5113846d859dd9e9e1
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2138654
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Zhao Jiazhong <zhaojiazhong-hf@loongson.cn>
Cr-Commit-Position: refs/heads/master@{#67035}
2020-04-07 08:38:37 +00:00
Z Nguyen-Huu
f13c807eac [wasm] WAT-compatible naming for memory
Currently, only one memory is supported.

For memory, we would use name as follows.
1. If import: use <import_module>.<field_name> from WasmImport.
2. If export: use <field_name> from WasmExport.
3. Use memory<index>.

Doc: https://docs.google.com/document/d/1XoXWONLBgZWQ9dhtoMpQPvD0fnnWA50OorsuSXfME3g
Bug: v8:10242
Change-Id: Ifd342bcd86ac302f5b43f2ee88a8ea21a28b5a0f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2132724
Commit-Queue: Z Nguyen-Huu <duongn@microsoft.com>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Kim-Anh Tran <kimanh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67020}
2020-04-06 18:07:45 +00:00
Thibaud Michaud
3a524239b2 Reland "Reland "[wasm] Deduplicate wasm scripts""
This is a reland of c9ce1b5662

Original change's description:
> Reland "[wasm] Deduplicate wasm scripts"
> 
> This is a reland of 6ebccbd1f4
> 
> Original change's description:
> > [wasm] Deduplicate wasm scripts
> > 
> > R=clemensb@chromium.org
> > 
> > Bug: v8:6847
> > Change-Id: I4509a7011a0d32f5bbd2eabf3d2ee6ef5304263d
> > Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2124320
> > Commit-Queue: Thibaud Michaud <thibaudm@chromium.org>
> > Reviewed-by: Clemens Backes <clemensb@chromium.org>
> > Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
> > Cr-Commit-Position: refs/heads/master@{#66981}
> 
> Bug: v8:6847
> Change-Id: I74f51b9b15df74de800fbbf031515d26aaa70dbc
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2135735
> Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
> Reviewed-by: Clemens Backes <clemensb@chromium.org>
> Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
> Commit-Queue: Thibaud Michaud <thibaudm@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#67006}

Bug: v8:6847
Change-Id: I82b83deaa826fd12d4605f66c5921d432169248d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2135643
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Thibaud Michaud <thibaudm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67017}
2020-04-06 14:55:04 +00:00
Clemens Backes
c4a2d8bb88 [wasm] Shrink WasmCode and make space for more flags
This shrinks the WasmCode a bit more (to the minimum which is currently
required) and at the same time makes space for more flags to be stored
in a bitfield.

R=ahaas@chromium.org

Bug: v8:10254
Change-Id: I98a24e917a00d74dd2306f18d45525e82b245826
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2135738
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67015}
2020-04-06 14:43:14 +00:00
Milad Farazmand
4d7e9bdb33 PPC/s390: [wasm-simd][liftoff] Implement max of i8x16, i16x8, i32x4 on x64 and ia32
Port dd1dbd99a6

R=jing.bao@intel.com, joransiu@ca.ibm.com, jyan@ca.ibm.com, michael_dawson@ca.ibm.com
BUG=
LOG=N

Change-Id: I857933ec03c7ee57a44eab0629435f9b6c7c5290
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2137156
Reviewed-by: Junliang Yan <jyan@ca.ibm.com>
Commit-Queue: Milad Farazmand <miladfar@ca.ibm.com>
Cr-Commit-Position: refs/heads/master@{#67012}
2020-04-06 14:30:14 +00:00
Nico Hartmann
740c9502c4 Revert "Reland "[wasm] Deduplicate wasm scripts""
This reverts commit c9ce1b5662.

Reason for revert: https://ci.chromium.org/p/v8/builders/ci/V8%20Linux64%20TSAN%20-%20isolates/8923

Original change's description:
> Reland "[wasm] Deduplicate wasm scripts"
> 
> This is a reland of 6ebccbd1f4
> 
> Original change's description:
> > [wasm] Deduplicate wasm scripts
> > 
> > R=clemensb@chromium.org
> > 
> > Bug: v8:6847
> > Change-Id: I4509a7011a0d32f5bbd2eabf3d2ee6ef5304263d
> > Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2124320
> > Commit-Queue: Thibaud Michaud <thibaudm@chromium.org>
> > Reviewed-by: Clemens Backes <clemensb@chromium.org>
> > Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
> > Cr-Commit-Position: refs/heads/master@{#66981}
> 
> Bug: v8:6847
> Change-Id: I74f51b9b15df74de800fbbf031515d26aaa70dbc
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2135735
> Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
> Reviewed-by: Clemens Backes <clemensb@chromium.org>
> Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
> Commit-Queue: Thibaud Michaud <thibaudm@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#67006}

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

Change-Id: Ie9da956519673b85262ba0cbcc80a946624d8c45
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: v8:6847
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2135634
Reviewed-by: Nico Hartmann <nicohartmann@chromium.org>
Commit-Queue: Nico Hartmann <nicohartmann@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67007}
2020-04-06 10:27:54 +00:00
Thibaud Michaud
c9ce1b5662 Reland "[wasm] Deduplicate wasm scripts"
This is a reland of 6ebccbd1f4

Original change's description:
> [wasm] Deduplicate wasm scripts
> 
> R=clemensb@chromium.org
> 
> Bug: v8:6847
> Change-Id: I4509a7011a0d32f5bbd2eabf3d2ee6ef5304263d
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2124320
> Commit-Queue: Thibaud Michaud <thibaudm@chromium.org>
> Reviewed-by: Clemens Backes <clemensb@chromium.org>
> Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#66981}

Bug: v8:6847
Change-Id: I74f51b9b15df74de800fbbf031515d26aaa70dbc
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2135735
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Thibaud Michaud <thibaudm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67006}
2020-04-06 09:37:24 +00:00
jing.bao
dd1dbd99a6 [wasm-simd][liftoff] Implement max of i8x16, i16x8, i32x4 on x64 and ia32
Bug: v8:9909
Change-Id: I954c2d48d0116e0f1fcfcb801671e320f8e4fee6
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2134420
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Zhi An Ng <zhin@chromium.org>
Commit-Queue: Jing Bao <jing.bao@intel.com>
Cr-Commit-Position: refs/heads/master@{#67003}
2020-04-05 02:29:43 +00:00
Clemens Backes
db39fadf5b [wasm][debug] Always regenerate Liftoff debug code
If there is still Liftoff code installed on a function, we cannot reuse
it when tiering down, since we don't know if it was compiled with
debugging capabilities. This made the "debug-step-into-wasm" test flake.

R=thibaudm@chromium.org

Bug: v8:10368
Change-Id: I3672940015c85ec10ead2e33e7792410b47589d4
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2135732
Reviewed-by: Thibaud Michaud <thibaudm@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66993}
2020-04-03 16:59:24 +00:00
Ng Zhi An
b997b1d00e [wasm-simd][liftoff][arm][arm64] Implement add_saturate
Bug: v8:9909
Change-Id: Ie894f91107c2a6e59c121c7db581112c5340fe48
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2132709
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66992}
2020-04-03 16:58:20 +00:00
Clemens Backes
3aedafbbbf [wasm] Reorganize source position lookup
Instead of two copies of the lookup code in frames.cc and wasm-debug.cc,
put one lookup method on the WasmCode. This is where it belongs really,
since the WasmCode is the main input to the function (besides the
offset).

Also refactor how source positions are computed in WasmCompiledFrame.
Avoid going through the summary, which is unneccessarily complex. This
also adds another {byte_offset} accessor which can be used for
debugging.

Bug: v8:10235
Change-Id: I5c545ee302754b86009f09bedc5ff6e39ba664f6
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2135726
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66991}
2020-04-03 16:57:14 +00:00
Milad Farazmand
6a99e67329 PPC/s390: [wasm-simd][liftoff] Implement min of i8x16, i16x8, i32x4 on x64 and ia32
Port ec4ccade1b

R=zhiguo.zhou@intel.com, joransiu@ca.ibm.com, jyan@ca.ibm.com, michael_dawson@ca.ibm.com
BUG=
LOG=N

Change-Id: Ide15cd0350633b5fb4f2af0ce55a334b428d1320
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2134421
Reviewed-by: Junliang Yan <jyan@ca.ibm.com>
Commit-Queue: Milad Farazmand <miladfar@ca.ibm.com>
Cr-Commit-Position: refs/heads/master@{#66984}
2020-04-03 13:52:04 +00:00
Clemens Backes
4d0d82de25 Revert "[wasm] Deduplicate wasm scripts"
This reverts commit 6ebccbd1f4.

Reason for revert: Fails gc-stress: https://ci.chromium.org/p/v8/builders/ci/V8%20Linux%20-%20gc%20stress/27313

Original change's description:
> [wasm] Deduplicate wasm scripts
>
> R=​clemensb@chromium.org
>
> Bug: v8:6847
> Change-Id: I4509a7011a0d32f5bbd2eabf3d2ee6ef5304263d
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2124320
> Commit-Queue: Thibaud Michaud <thibaudm@chromium.org>
> Reviewed-by: Clemens Backes <clemensb@chromium.org>
> Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#66981}

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

Change-Id: I58e857d43b524115be3e29b9524794f05d631544
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: v8:6847
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2135730
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66982}
2020-04-03 13:14:04 +00:00
Thibaud Michaud
6ebccbd1f4 [wasm] Deduplicate wasm scripts
R=clemensb@chromium.org

Bug: v8:6847
Change-Id: I4509a7011a0d32f5bbd2eabf3d2ee6ef5304263d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2124320
Commit-Queue: Thibaud Michaud <thibaudm@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66981}
2020-04-03 12:47:54 +00:00
Zhao Jiazhong
1bb1d634e1 [mips][wasm-simd][liftoff] Implement min of i8x16, i16x8, i32x4
Port ec4ccade1b
https://crrev.com/c/2129176

Change-Id: I6c37c6a2be4a42c440dd8c0920647a587f55e44d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2135546
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Zhao Jiazhong <zhaojiazhong-hf@loongson.cn>
Cr-Commit-Position: refs/heads/master@{#66980}
2020-04-03 10:51:14 +00:00
Clemens Backes
e8ff83ddb4 [wasm] Split adding code from publishing
Adding code can happen in parallel (it includes copying the code to the
code region and relocation it). Publishing happens under one lock per
native module though. We eventually want to avoid blocking on this lock
for too long. This CL prepares that by splitting the actions of adding
and publishing code.

R=ahaas@chromium.org

Bug: v8:10330, v8:10387
Change-Id: Iddbdadfe32e691bbf5e7b387ea947579bc3376f3
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2134372
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66979}
2020-04-03 10:27:04 +00:00
Clemens Backes
2a303b1c62 [liftoff] Add code comments for OOL code
For easier debugging of Liftoff code generation issues, add code
comments or out-of-line code.

The name is generated from the {RuntimeStubId}. The respective name
accessor is currently defined on the {NativeModule}, this CL makes it a
top-level function so we can reuse it from Liftoff.

R=thibaudm@chromium.org

Bug: v8:10235
Change-Id: I7b99779217b9c052e34ad132eb34859b20548092
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2134307
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Thibaud Michaud <thibaudm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66978}
2020-04-03 09:42:24 +00:00
Zhou, Zhiguo
ec4ccade1b [wasm-simd][liftoff] Implement min of i8x16, i16x8, i32x4 on x64 and ia32
Bug: v8:9909
Change-Id: I11fae10593d135e007866411c61076300ac4ae7d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2129176
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Zhi An Ng <zhin@chromium.org>
Commit-Queue: Zhiguo Zhou <zhiguo.zhou@intel.com>
Cr-Commit-Position: refs/heads/master@{#66972}
2020-04-02 22:22:27 +00:00
Ng Zhi An
a4ebf1f0f0 [wasm-simd][liftoff][arm][arm64] Implement mul
i64x2 mul is more tricky, the algorithm is slightly modified:
- for arm64, we can only use 2 temporaries
- for arm, we only have 1 temporary, so we get another register
manually, if we need it (modify lhs/rhs if they are not used)

Bug: v8:9909
Change-Id: I0398e2c95348a8b49ca9773a78ccfb7af73e2eef
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2128606
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66971}
2020-04-02 21:19:37 +00:00
Zhao Jiazhong
09982b6bad [mips][wasm-simd][liftoff] Implement add_saturate
Port 767401ba54
https://crrev.com/c/2116878

Change-Id: I566a014a4d3021ac9b3576030c08fe0b46b33809
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2132349
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Zhao Jiazhong <zhaojiazhong-hf@loongson.cn>
Cr-Commit-Position: refs/heads/master@{#66965}
2020-04-02 14:42:25 +00:00
Zhao Jiazhong
58640de6ba [mips][liftoff] Remove lambdas for binops with immediate
Port a1bd722799
https://crrev.com/c/2129631

Original Commit Message:

  This is the same cleanup as in the previous CL, but for {EmitBinOpImm}.
  This requires a minor change in the name of the emit functions with
  immediate, to make them distinguishable from the emit functions with two
  registers. We just append an "i" to the functions with immediate.

Change-Id: I5089097cb74e204002f0dfcfb6ed10d3ade4da0d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2132346
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Zhao Jiazhong <zhaojiazhong-hf@loongson.cn>
Cr-Commit-Position: refs/heads/master@{#66959}
2020-04-02 07:50:31 +00:00
Milad Farazmand
4b56b1f858 PPC/s390: [wasm-simd] [liftoff] Implement add_saturate on ia32 and x64
Port 767401ba54

R=fanchen.kong@intel.com, joransiu@ca.ibm.com, jyan@ca.ibm.com, michael_dawson@ca.ibm.com
BUG=
LOG=N

Change-Id: Ice8b33376e22ab6658503cda9e34202f96688bcf
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2131509
Reviewed-by: Junliang Yan <jyan@ca.ibm.com>
Reviewed-by: Milad Farazmand <miladfar@ca.ibm.com>
Commit-Queue: Milad Farazmand <miladfar@ca.ibm.com>
Cr-Commit-Position: refs/heads/master@{#66950}
2020-04-01 14:47:44 +00:00
Kong, Fanchen
767401ba54 [wasm-simd] [liftoff] Implement add_saturate on ia32 and x64
Bug: v8:9909
Change-Id: Ib744bcbfe3df66d6904421bcbd2581dd6a95b75c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2116878
Commit-Queue: Fanchen Kong <fanchen.kong@intel.com>
Reviewed-by: Zhi An Ng <zhin@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66947}
2020-04-01 13:13:54 +00:00
Clemens Backes
0612910150 [liftoff] Remove some binop macros
This inlines the first set of macros in order reduce an unneccessary
layer of abstraction. This makes the code easier to read and to debug.

R=zhin@chromium.org

Bug: v8:10364
Change-Id: Ia8ccb90c285c365ae5b3d52b6b6912ad1a76d81d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2129532
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66945}
2020-04-01 12:08:54 +00:00
Clemens Backes
219b0edb6e [liftoff] Shorten names of value types
Import the most commonly used ValueType kinds as constants into
{LiftoffCompiler}, so that we don't need the fully-qualified accessor on
{ValueType}.
This makes many template instantiations much shorter and hence easier to
read.

Drive-by: Replace break after function by return. This often saves
  another line, making macros and switch statements much shorter.

R=zhin@chromium.org

Bug: v8:10364
Change-Id: If78352c2fa6b854989fa82718d0b3478b4d73aad
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2129634
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66943}
2020-04-01 11:57:44 +00:00
Clemens Backes
a1bd722799 [liftoff] Remove lambdas for binops with immediate
This is the same cleanup as in the previous CL, but for {EmitBinOpImm}.
This requires a minor change in the name of the emit functions with
immediate, to make them distinguishable from the emit functions with two
registers. We just append an "i" to the functions with immediate.

R=zhin@chromium.org

Bug: v8:10364
Change-Id: Ie3732a956698368a5f1fbe67334a13014cd2f354
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2129631
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66941}
2020-04-01 10:26:54 +00:00
Clemens Backes
bff40c9927 [liftoff] Replace lambdas by generic templates
Liftoff has lots of macros that just convert between {LiftoffRegister}
and either {Register} or {DoubleRegister}.
This CL avoids most of these lambdas by passing the original assembler
function to {EmitUnOp} and {EmitBinOp}, and converting the register
types only when calling the respective function.

This makes the code in many macros a lot shorter, and might allow us to
eliminate many macros and just inline their code.

R=zhin@chromium.org

Bug: v8:10364
Change-Id: I8b7dbb19e367d33181d94472ab422a0a50786449
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2129629
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66938}
2020-04-01 09:03:17 +00:00
Clemens Backes
e7cb911a93 [wasm] Fix capitalization of "Wasm"
If we want external people to stop shouting WASM, we should start
by avoiding that in our own code base.
This CL replaces almost all occurrences of "WASM" by "Wasm". The
last remaining ones (in frames.cc) are in capitalized contexts where
WASM fits.

TBR=ecmziegler@chromium.org

Bug: v8:10155
Change-Id: I905b92220768b99bb5e1165255691ffe4498dba3
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2126917
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Emanuel Ziegler <ecmziegler@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66917}
2020-03-31 06:55:16 +00:00
Z Nguyen-Huu
9c9167124b [wasm] WAT-compatible naming for imported and exported globals
For globals, we would use name as follows.
1. If import: use <import_module>.<field_name> from WasmImport.
2. If export: use <field_name> from WasmExport.
3. Use global<index>.

Add DecodeGlobalNames similar to DecodeFunctionNames.

Doc: https://docs.google.com/document/d/1XoXWONLBgZWQ9dhtoMpQPvD0fnnWA50OorsuSXfME3g
Bug: v8:10242
Change-Id: I11131528fc6ae6ca50727e9b428f76e76b0000e5
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2122523
Commit-Queue: Z Nguyen-Huu <duongn@microsoft.com>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Kim-Anh Tran <kimanh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66910}
2020-03-30 18:06:47 +00:00
Milad Farazmand
c2ebc886df PPC/s390: [wasm-simd][liftoff] Implement mul on x64 and ia32
Port a3d2f7a4ef

R=zhiguo.zhou@intel.com, joransiu@ca.ibm.com, jyan@ca.ibm.com, michael_dawson@ca.ibm.com
BUG=
LOG=N

Change-Id: If5888f737b10afa00c96d13243e3147cfcfbbb3e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2127386
Reviewed-by: Junliang Yan <jyan@ca.ibm.com>
Commit-Queue: Milad Farazmand <miladfar@ca.ibm.com>
Cr-Commit-Position: refs/heads/master@{#66907}
2020-03-30 13:53:45 +00:00
Clemens Backes
788bffd532 [liftoff][debug] Fix step in from JS
When stepping in from JS, the stepping frame ID will not be set.
Instead of ensuring to set it properly, we can just skip the check for
the frame ID. It was needed before, when we didn't properly reset
stepping information. Now, it's redundant anyway.

Also, ensure that we don't redirect to the interpreter if the
--debug-in-liftoff flag is set.

Drive-by: Fix and clang-format some parts of the test (no semantic
change).

R=thibaudm@chromium.org, szuend@chromium.org

Bug: v8:10351
Change-Id: I58a3cd68937006c2d6b755a4465e793abcf8a20c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2124317
Reviewed-by: Simon Zünd <szuend@chromium.org>
Reviewed-by: Thibaud Michaud <thibaudm@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66904}
2020-03-30 12:30:20 +00:00
Zhao Jiazhong
7a3bc09cd2 [mips][wasm-simd][liftoff] Implement mul.
Port a3d2f7a4ef
https://crrev.com/c/2113301

Change-Id: I2fefac5482e55c307226b417b51ab530b1f1d3ae
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2126588
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Zhao Jiazhong <zhaojiazhong-hf@loongson.cn>
Cr-Commit-Position: refs/heads/master@{#66903}
2020-03-30 11:51:49 +00:00
Zhou, Zhiguo
a3d2f7a4ef [wasm-simd][liftoff] Implement mul on x64 and ia32
Bug: v8:9909
Change-Id: Ie9a3098bcaa894266e850cc7094894d25709afd2
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2113301
Commit-Queue: Zhiguo Zhou <zhiguo.zhou@intel.com>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66898}
2020-03-27 23:57:10 +00:00
Ng Zhi An
6b6c1b4f11 [wasm-simd][liftoff][arm][arm64] Implement replace_lane
All 6 replace_lane operations for ARM and ARM64.

Changes to wasm-compiler required for ARM (where register aliasing is
different - 2 fp registers map to 1 simd register). When src2_rc is
kFpReg, and src1_rc is kFpRegPair, we still need to pin src2 when
getting a register for src1, since the registers can overlap. (On other
backends, src1_rc == src2_rc == kFpReg, so the current condition is met,
and we correctly pin src2). Same for result_rc and src2_rc.

Bug: v8:9909
Change-Id: Ib39b71534290a7109fb0da4bf62dabc66460a0dd
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2117637
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66893}
2020-03-27 17:57:10 +00:00
Thibaud Michaud
8f8839b5b0 [debug] Fix wrong offset in RemoveBreakpoint
DebugInfo::RemoveBreakpoint did not remove the correct breakpoint
because of a confusion between offsets relative to the function and
offsets relative to the module. This is not visible in the tests, as
removed breakpoints are already skipped by the runtime function.

Drive-by: replace a return which should have been a continue in OSR.

R=clemensb@chromium.org

Change-Id: I574c474139e969bd91217cfa7adc806d43db3c99
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2120589
Commit-Queue: Thibaud Michaud <thibaudm@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66891}
2020-03-27 14:00:48 +00:00
Andreas Haas
e92fb6e401 [wasm] Passive element segments don't need a table
This CL fixes a spec violation that new spec tests uncovered.

R=thibaudm@chromium.org
CC=ecmziegler@chromium.org

Change-Id: Ie8ae455117f1c719815bad78f14c3b2c5e404e79
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2122023
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Reviewed-by: Thibaud Michaud <thibaudm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66885}
2020-03-27 08:38:03 +00:00
Kim-Anh Tran
a07dd51079 [wasm][debug] Change stack value order in stack scope
This patch changes the order in which stack values are shown
in the stack scope. As a result, changes to the stack show up
at the end of the stack.

Bug: chromium:1043034
Change-Id: I735fc29d3957b6484589554ce046114e1b7bd9e3
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2122987
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Kim-Anh Tran <kimanh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66884}
2020-03-27 07:17:39 +00:00
Z Nguyen-Huu
073c5d2dd6 [wasm] WAT-compatible naming for exported function
For exported functions that do not have a name yet, we use the field
name (see <name> of WasmExport) of the first export entry.

Doc: https://docs.google.com/document/d/1XoXWONLBgZWQ9dhtoMpQPvD0fnnWA50OorsuSXfME3g/edit#heading=h.6yuhg1v2w3q4
Bug: v8:10242
Change-Id: Icfa55fd50e5d1c4cf10581b7d322112e9f113388
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2112684
Commit-Queue: Z Nguyen-Huu <duongn@microsoft.com>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Kim-Anh Tran <kimanh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66877}
2020-03-26 17:29:49 +00:00
Clemens Backes
dbda6c3d4f [wasm][debug] Make some control opcodes non-breakable
Most control structures in WebAssembly do not have a clear execution
semantics, they are more like markers. Hence the execute state, and the
change in the state, when breaking on them and stepping over them is
unclear.
Hence this CL just makes them non-breakable. If the user tries to set a
breakpoint on them, this breakpoint will automatically be propagated to
the first instruction after the respective control opcode (this is
tested for other cases in existing tests).

R=thibaudm@chromium.org

Bug: v8:10326
Change-Id: Iaf540a94789c9cbc87d23ddfb794e4b01776b49f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2122017
Reviewed-by: Thibaud Michaud <thibaudm@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66876}
2020-03-26 16:49:43 +00:00
Andreas Haas
47cdcc4aea [wasm] Passive data segments don't need a memory
This CL fixes a spec violation that new spec tests uncovered.

R=thibaudm@chromium.org
CC=ecmziegler@chromium.org

Change-Id: I1004eca9e4f98a0960795907fea0ab263c907938
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2122022
Reviewed-by: Thibaud Michaud <thibaudm@chromium.org>
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66874}
2020-03-26 16:07:43 +00:00
Thibaud Michaud
dd0d9c6194 [liftoff][debug] Fix source position after OSR
The top wasm frame position can be inaccurate after removing a
breakpoint and OSRing the new code. This is because we are missing the
source position which was associated with that breakpoint in the old
code. Fix this by explicitly introducing the missing source position.

R=clemensb@chromium.org

Change-Id: I0d18061c4c2411de8d2ccaaebbb4eb550a4c3160
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2120591
Commit-Queue: Thibaud Michaud <thibaudm@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66871}
2020-03-26 12:45:16 +00:00
Kim-Anh Tran
155d2bc4ae [wasm][debug] Add stack scope to CDP and V8
This change adds a stack scope for wasm debugging.
Currently the local scope contains both local variables as well as
the expression stack. For now, this change duplicates the information
available on stacks into the stack scope, until we have added
support for the stack scope in the DevTools front-end.

Bug: chromium:1043034
Change-Id: Ib0a07e07be7c53003526a7b1e1dbfaa1116b41ad
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2093510
Commit-Queue: Kim-Anh Tran <kimanh@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66867}
2020-03-26 07:54:15 +00:00
Thibaud Michaud
28d2cb1fa5 [liftoff][debug] Implement StepOut
R=clemensb@chromium.org

Bug: v8:10321
Change-Id: I318d46fa638c1d6f4d5d347e5aa0ad1faf02d5e2
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2120532
Commit-Queue: Thibaud Michaud <thibaudm@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66855}
2020-03-25 11:38:03 +00:00
Clemens Backes
04774ffaaa [liftoff][debug] Implement StepOver at return locations
A StepOver at a return (either explicit return instruction, or implicit
return at the end of the function) should stop again in the caller
frame.

R=thibaudm@chromium.org

Bug: v8:10321
Change-Id: I313e6b612ac52e73b33ef07c6da1ced2aa0db600
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2110250
Reviewed-by: Thibaud Michaud <thibaudm@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66852}
2020-03-25 07:23:54 +00:00
Clemens Backes
851a395fb5 [wasm] Fix OSR on wasm calls
This fixes issues with replacing the return address of deeper (non-top)
wasm frames, i.e. frames which are at a call position. The replaced
address should also point after the call in the new code, so we don't
execute the same call again.

This is achieved by using slightly different encodings for breakpoint
positions and other (wasm instruction) positions. Breakpoints set
{is_instruction} to {false} in the source position table entry, whereas
usual wasm instruction set it to {true}.
Also, during stack walking for OSR, we remember whether we want to OSR
to the position before the instruction (if it's the top frame), or after
the call instruction (if it's deeper in the stack). We then use the
{is_instruction} predicate to find the right location.

R=thibaudm@chromium.org

Bug: v8:10321
Change-Id: I73212a7532c6ecf4c82bde76fe4059c8203e422c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2116206
Reviewed-by: Thibaud Michaud <thibaudm@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66850}
2020-03-24 17:44:25 +00:00
Milad Farazmand
c785c4fc4f PPC/s390: [wasm-simd] [liftoff] Implement replace_lane on x64 and ia32
Port e5b4cb4567

R=fanchen.kong@intel.com, joransiu@ca.ibm.com, jyan@ca.ibm.com, michael_dawson@ca.ibm.com
BUG=
LOG=N

Change-Id: I2198b423aa22b41b1b55f4ba733d2c2c5c3fe1ba
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2117781
Commit-Queue: Milad Farazmand <miladfar@ca.ibm.com>
Reviewed-by: Junliang Yan <jyan@ca.ibm.com>
Cr-Commit-Position: refs/heads/master@{#66844}
2020-03-24 14:21:06 +00:00
Clemens Backes
48c38718e8 [wasm] Stop correctness fuzzing if growing memory fails
We have similar logic in place when allocating wasm memory fails. For
growing, we also need to hard-abort the program, because it would cause
observable differences in program behaviour otherwise.

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

Bug: chromium:1063951
Change-Id: I98f3b5364100900fce0e6553a347155a39923ca6
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2116036
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66842}
2020-03-24 09:51:56 +00:00
Zhao Jiazhong
15348f1a1c [mips][wasm-simd][liftoff] Implement replace_lane.
Port e5b4cb4567
https://crrev.com/c/2108299

Change-Id: Iac7e70aaa13cd46be4aaec1bf52388071ce17ae9
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2115835
Auto-Submit: Zhao Jiazhong <zhaojiazhong-hf@loongson.cn>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66840}
2020-03-24 08:24:16 +00:00
Andreas Haas
612e8dbaf7 [wasm][liftoff] Implement table.copy
R=clemensb@chromium.org

Bug: v8:10281
Change-Id: Id6c004c60e3bf142c603d9e37f730348f89cd89d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2111221
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66839}
2020-03-24 07:19:16 +00:00
Kong, Fanchen
e5b4cb4567 [wasm-simd] [liftoff] Implement replace_lane on x64 and ia32
Bug: v8:9909
Change-Id: Ia830b2fc00751abfb4dadb61651a252f1da48a1f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2108299
Commit-Queue: Fanchen Kong <fanchen.kong@intel.com>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66837}
2020-03-24 02:49:36 +00:00
Clemens Backes
92bd7818b7 [wasm] Fix placement of the events section
Before, it was specified between the globals and the exports section.
This changed with
https://github.com/WebAssembly/exception-handling/issues/98. The event
section is now placed between the memory and the globals section.

R=jkummerow@chromium.org
CC=aheejin@chromium.org

Bug: v8:10176
Change-Id: Icafeaae4ff7796273c73d61ed417c028fcbcb02d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2116032
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66833}
2020-03-23 18:22:46 +00:00
Andreas Haas
03d226bf31 [wasm][liftoff] Implement table.init
R=clemensb@chromium.org

Bug: v8:10281
Change-Id: Ife66eef08ad3a578884b42d7171c04a3003ccee5
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2111219
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66831}
2020-03-23 16:58:05 +00:00
Thibaud Michaud
df15ce65e6 [liftoff][debug] Generate missing source positions
We previously could not OSR a frame paused in a breakpoint with another
frame in which the same breakpoint was removed, because the latter was
missing the source position.
This change fixes this by iterating the stack to collect frame
positions, and emitting the corresponding source positions in Liftoff.

R=clemensb@chromium.org

Bug: v8:10321,v8:10147
Change-Id: I5a7950d5ce6e3cd5a0648b861db75f4f3dafa644
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2115433
Commit-Queue: Thibaud Michaud <thibaudm@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66830}
2020-03-23 16:47:55 +00:00
Thibaud Michaud
80b6867c9e [wasm] Fix WasmCodeRefScope use after free
Close WasmCodeRefScope before we potentially free the native module in
UpdateNativeModuleCache.

R=clemensb@chromium.org

Bug: chromium:1062868
Change-Id: I7cd11fd2283a2cc399d05e32c609ff1af07e2706
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2113380
Commit-Queue: Thibaud Michaud <thibaudm@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66829}
2020-03-23 16:00:19 +00:00
Clemens Backes
404ce209ab [wasm] Make rethrow trap on nullptr
The behaviour was clarified in the spec:
https://github.com/WebAssembly/exception-handling/pull/97

br_on_exn (which was done in another CL) and also rethrow should trap on
nullptr. This CL implements this by an explicit check in the builtin
called for rethrow.

R=jkummerow@chromium.org
CC=aheejin@chromium.org

Bug: v8:10128
Change-Id: Icb0f4e54991b3385917bf183efa825048db4cb82
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2115430
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66827}
2020-03-23 14:21:05 +00:00
Clemens Backes
bcc055c158 [wasm] Make br_on_exn trap on nullptr
The behaviour was clarified in the spec:
https://github.com/WebAssembly/exception-handling/pull/97

br_on_exn (and also rethrow, which will be added in another CL) should
trap on nullptr. This CL implements this by an explicit check on each
br_on_exn (within {GetExceptionTag}). This check will be redundant if
several br_on_exn follow each other. Since also the runtime call for
{GetExceptionTag} is redundant, and also the fact that we do a runtime
call is suboptimal, I consider the whole implementation prototypical for
now anyway.

R=jkummerow@chromium.org
CC=aheejin@chromium.org

Bug: v8:10128
Change-Id: I234c3183f93fe0884aadd2ab6dbd6c2b7a07c660
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2113381
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66826}
2020-03-23 14:13:35 +00:00
Clemens Backes
31846fae92 [wasm] Make traps non-catchable
The spec was changed such that traps are not catchable in wasm:
https://github.com/WebAssembly/exception-handling/pull/93

This CL implements this in V8 by adding a private symbol as a property
to all uncatchable exceptions. It also adds a number of tests.

R=jkummerow@chromium.org
CC=aheejin@chromium.org

Bug: v8:10194
Change-Id: I498531762e8876f809d3b8aeb72ccc053e0e3cd4
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2113375
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66824}
2020-03-23 13:45:45 +00:00
Thibaud Michaud
aafc733fc8 [liftoff] Lazily remove unused breakpoints
Remove unused breakpoints as we hit them. OSR in this case does not work
properly yet, because we are missing the source position for the removed
breakpoint in the new code.

R=clemensb@chromium.org

Bug: v8:10321
Change-Id: I908546c1b37ca044166b24b4900126ab79f117ba
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2111216
Commit-Queue: Thibaud Michaud <thibaudm@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66821}
2020-03-23 09:35:17 +00:00
Andreas Haas
2d8ca349f8 [wasm][liftoff] Implement elem.drop
R=clemensb@chromium.org

Bug: v8:10281
Change-Id: I2c49093585fbd6e9ba1fe777492188d64625dc92
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2111222
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66819}
2020-03-23 07:39:05 +00:00
Andreas Haas
4212c303b6 [wasm][liftoff] Introduce PrepareBuiltinCall
This CL provides a generic way to prepare a builtin call: The
{PrepareBuiltinCall} takes the builtin signature for 64-bit systems,
the CallDescriptor, and a Vector of VarStates for the parameters, and
moves all parameters to their correct place, which is either in a
register or on the stack.

To test the new code this CL adjusts the implementation of AtomicWait
to use PrepareBuiltinCall. Thereby AtomicWait is now also supported
on 32-bit platforms, including ia32.

R=clemensb@chromium.org

Bug: v8:10108, v8:10281
Change-Id: Ia8589166310ea2e8442531b4ed20db62d7b4aff0
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2108554
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66810}
2020-03-20 14:00:41 +00:00
Andreas Haas
1e1d4d8291 [wasm] Introduce a TableCopy builtin
This CL introduces a CSA builtin for the TableCopy instruction. This
builtin allows to generate smaller code for both TurboFan and Liftoff,
and easier code generation from Liftoff.

The smaller code size comes from:
* Parameters are passed through registers, not the stack.
* Lower number of parameters: the call target, number of parameters, and
context are not passed as parameters.
* No int to smi conversion in generated code.

R=clemensb@chromium.org

Bug: v8:10281
Change-Id: I4734b94c8a2aff08a5938504e3e36d0d2424f8ca
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2110010
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66797}
2020-03-19 16:47:33 +00:00
Ng Zhi An
4ac48b600e [wasm-simd][liftoff][arm][arm64] Implement sub for Liftoff
Bug: v8:9909
Change-Id: Ica1cb36e7e071e5755009d57a0f03080b74bbf8e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2108743
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66795}
2020-03-19 16:06:43 +00:00
Ng Zhi An
3406cba8fe [wasm-simd][arm64] Bitmask instructions
Implement i8x16.bitmask, i16x8.bitmask, i32x4.bitmask on interpreter and
arm64.

These operations are behind wasm_simd_post_mvp flag, as we are only
prototyping to evaluate performance. The codegen is based on guidance at
https://github.com/WebAssembly/simd/pull/201.

Bug: v8:10308
Change-Id: I835aa8a23e677a00ee7897c1c31a028850e238a9
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2099451
Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
Reviewed-by: Deepti Gandluri <gdeepti@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66793}
2020-03-19 15:52:23 +00:00
Andreas Haas
ca5ee9d636 [wasm] Introduce a WasmTableInit CSA builtin
This CL introduces a CSA builtin for the TableInit instruction. This
builtin allows to generate smaller code for both TurboFan and Liftoff,
and easier code generation from Liftoff.

The smaller code size comes from:
* Parameters are passed through registers, not the stack.
* Lower number of parameters: the call target, number of parameters, and
context are not passed as parameters.
* No int to smi conversion in generated code.

The CL also introduces a small CSA function which takes an uint32 value
and a max value as parameters and returns a Smi of the minimum of these
two.

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

Bug: v8:10281
Change-Id: I40f248c20ec76e6ae9483a5e2907a68f42f2cb04
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2106201
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66792}
2020-03-19 14:52:28 +00:00
Clemens Backes
599a6e0ae8 [liftoff] Add some more code comments
Add some more code comments for code snippets that are not obvious,
especially if debug code is enabled.
The comments help when looking at Liftoff code for debugging code
generation issues.

R=thibaudm@chromium.org

Change-Id: I566bf2b05a454fb8addc030359969d36cb2cb707
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2108557
Reviewed-by: Thibaud Michaud <thibaudm@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66791}
2020-03-19 14:45:25 +00:00
Clemens Backes
a1439d4182 [liftoff][debug] Minor cleanup
1) Replace a condition by a DCHECK.
2) Remove dead argument.

R=thibaudm@chromium.org

Bug: v8:10321
Change-Id: I546d18e7e5520630ab32b4f73f9fe12b0441cb95
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2108556
Reviewed-by: Thibaud Michaud <thibaudm@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66790}
2020-03-19 14:36:23 +00:00
Clemens Backes
da6476671f [liftoff][debug] Implement StepIn
Update the "hook on function call" flag also in the wasm case, and
slightly change the {IsStepping} logic to stop in any frame if the last
step action was anything other than StepNext.
In future CLs, this has to be extended further for StepOut and for
StepOver at a return location.
When that is done, we can also reenable more stepping in the test.

R=thibaudm@chromium.org

Bug: v8:10321
Change-Id: Ib3aa8c2c2e137690140e5879a33e2bcc340821e3
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2108035
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Simon Zünd <szuend@chromium.org>
Reviewed-by: Thibaud Michaud <thibaudm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66789}
2020-03-19 11:27:53 +00:00
Philip Pfaffe
9696695000 [wasm-debug-evaluate] Implement the foundation for wasm debug evaluate
This implements the first part of WebAssembly debug evaluate. The patch
includes the foundation required to execute evaluator modules. It only
implements the first of the APIs of the evaluator module spec.

Bug: chromium:1020120
Change-Id: I06ec98a63d0a0ec8d81c2eac4319c4b85d3e16c1
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2089936
Commit-Queue: Philip Pfaffe <pfaffe@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66787}
2020-03-19 10:18:23 +00:00
Clemens Backes
0d05e8d2db [liftoff][debug] Add nops to avoid source position collisions
Without the nops, the PC after the call might be the same as the PC of
the next instruction, and we might emit two different source positions
for the same PC.
This will not be the final solution, see attached bug.

R=thibaudm@chromium.org

Bug: v8:10337
Change-Id: I8c893d8d7ad00684ec6e1bc7f6c00f649695029f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2108029
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Thibaud Michaud <thibaudm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66775}
2020-03-18 16:32:17 +00:00
Clemens Backes
21dde46b82 [liftoff][debug] Check for "hook on function call"
This extends the Liftoff function prologue in the debug case. It now
checks the "hook on function call" flag, and if that flag is set, it
triggers a breakpoint.
The address of that flag is stored in the WasmInstanceObject for fast
access.

Drive-by: Add an output operator for ValueType, which helps with
debugging.

R=thibaudm@chromium.org

Bug: v8:10321
Change-Id: I572de802815259ee0ef0df9b22ce30b510b4e30d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2106211
Reviewed-by: Thibaud Michaud <thibaudm@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66774}
2020-03-18 16:01:27 +00:00
Zhao Jiazhong
ebd85d2cee [mips][wasm-simd][liftoff] Implement sub
Port 3e1b6b4034
https://crrev.com/c/2101129

Change-Id: Icc7198221f44f52c88b205947665898b6813cd8c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2107247
Auto-Submit: Zhao Jiazhong <zhaojiazhong-hf@loongson.cn>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66770}
2020-03-18 13:34:34 +00:00
Milad Farazmand
cd36155e89 PPC/s390: [wasm-simd] [liftoff] Implement sub on x64 and ia32
Port 3e1b6b4034

R=jing.bao@intel.com, joransiu@ca.ibm.com, jyan@ca.ibm.com, michael_dawson@ca.ibm.com
BUG=
LOG=N

Change-Id: I3f4837a896217dd3331b60e1477806d05f106c24
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2107727
Reviewed-by: Junliang Yan <jyan@ca.ibm.com>
Commit-Queue: Milad Farazmand <miladfar@ca.ibm.com>
Cr-Commit-Position: refs/heads/master@{#66769}
2020-03-18 13:30:54 +00:00
Tobias Tebbi
8cb5dea960 [torque] generate int accessors for Smi fields
In the runtime, we always had a convention to use int-typed accessors
for Smi fields. For Torque-generated classes, we kept them Smi-typed
but then added int wrappers around that.
This CL makes Torque generate int-typed accessors directly, removing the
need for these wrappers.

TBR=hpayer@chromium.org

Bug: v8:7793
Change-Id: I348e1d96295c9676fafda32b7d49088848527f89
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2106210
Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
Reviewed-by: Nico Hartmann <nicohartmann@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66760}
2020-03-18 09:24:08 +00:00
jing.bao
3e1b6b4034 [wasm-simd] [liftoff] Implement sub on x64 and ia32
Bug: v8:9909
Change-Id: If16056ebe0e8c3519afd49982561f96655a03786
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2101129
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Zhi An Ng <zhin@chromium.org>
Commit-Queue: Jing Bao <jing.bao@intel.com>
Cr-Commit-Position: refs/heads/master@{#66758}
2020-03-18 06:46:58 +00:00
Thibaud Michaud
20eb2e4454 [liftoff] Test stepping over a recursive call
And fix a few issues revealed by this new test. Incidentally, the test
uses removeBreakpoint which was still untested with Liftoff. But as
expected this seems to work out of the box.

R=clemensb@chromium.org

Bug: v8:10321
Change-Id: Ifa4e867737d925ea8c6c9731575a32f3da3e16dc
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2106206
Commit-Queue: Thibaud Michaud <thibaudm@chromium.org>
Reviewed-by: Simon Zünd <szuend@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66752}
2020-03-17 18:14:08 +00:00
Georgia Kouveli
ea82d0311b [arm64] Use BTI instructions for forward CFI
Generate a BTI instruction at each target of an indirect branch
(BR/BLR). An indirect branch that doesn't jump to a BTI instruction
will generate an exception on a BTI-enabled core. On cores that do
not support the BTI extension, the BTI instruction is a NOP.

Targets of indirect branch instructions include, among other things,
function entrypoints, exception handlers and jump tables. Lazy deopt
exits can potentially be reached through an indirect branch when an
exception is thrown, so they also get an additional BTI instruction.

Bug: v8:10026
Change-Id: I0ebf51071f1b604f60f524096e013dfd64fcd7ff
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1967315
Commit-Queue: Georgia Kouveli <georgia.kouveli@arm.com>
Reviewed-by: Ross McIlroy <rmcilroy@chromium.org>
Reviewed-by: Georg Neis <neis@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66751}
2020-03-17 17:52:28 +00:00
Philip Pfaffe
e71d328fb3 Report additional wasm script info on the CDP
Add a scriptLanguage enum to the new scripts events. This overhauls
crrev.com/c/2011083 that was related. Report the code section offset
as well as the script language on the Debugger.scriptParsed and
Debugger.scriptFailedToParse events.

Bug: chromium:1057569
Change-Id: I40b43f28f0b3e094720db4fc1f07db1a0c293ee0
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2083025
Reviewed-by: Sigurd Schneider <sigurds@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Philip Pfaffe <pfaffe@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66749}
2020-03-17 13:25:24 +00:00
Kong, Fanchen
73064523b1 [wasm-simd] [liftoff] Emit Simd commutative binop on x64 and ia32
Bug: v8:9909
Change-Id: I0d00aa79055667b627126b28f277dc5f670f25f3
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2097820
Reviewed-by: Zhi An Ng <zhin@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Fanchen Kong <fanchen.kong@intel.com>
Cr-Commit-Position: refs/heads/master@{#66738}
2020-03-17 01:25:13 +00:00
Ng Zhi An
b7971e95d0 [wasm-simd][liftoff][arm][arm64] Implement extract_lane
Implement all 8 extract_lane ops on ARM and ARM64.

Bug: v8:9909
Change-Id: I72e30b53c92933bd5830008ec02e1f4526e8b4c4
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2103169
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66735}
2020-03-16 18:36:23 +00:00
Ng Zhi An
817ba0a228 [wasm-simd][liftoff][arm][arm64] Implement adds
Implement f64x2.add, i64x2.add, i8x16.add on ARM and ARM64.

Bug: v8:9909
Change-Id: Id41bb3c02c1873e1380463264a3e5fd31949c949
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2103107
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66733}
2020-03-16 17:56:03 +00:00
Clemens Backes
371580bb54 [wasm] Improve error message for missing Liftoff support
Complete Liftoff support is needed for debugging. In case of a bailout
from Liftoff, produce a better error message, also in release builds.

R=thibaudm@chromium.org

Bug: v8:10147
Change-Id: I8cdb11a5c54f9101ea611e28dd3fb7dc4fe5c538
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2105633
Reviewed-by: Thibaud Michaud <thibaudm@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66730}
2020-03-16 15:29:53 +00:00
Andreas Haas
cc571fd7ac [wasm][liftoff] Implement data.drop
R=clemensb@chromium.org

Bug: v8:10281
Change-Id: I34e6d1ec57d59e266d3182a3d3cc69d4cbb9d047
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2104889
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66728}
2020-03-16 15:10:03 +00:00
Clemens Backes
f2a0f53c8e [wasm] Fix Liftoff bailout
The bailout was guarded by the "if (counters)" condition, which does not
make sense.
If Liftoff compilation is executed for debugging, no counters will be
passed. On platforms that do not implement Liftoff, we still need to
bail out correctly.

R=ahaas@chromium.org

Bug: v8:10147
Change-Id: I188460183bb1c376d456e0d4e54e2338f4a66e23
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2105353
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66725}
2020-03-16 14:33:03 +00:00
Clemens Backes
a80071457d [wasm] Add a fast path to {FindJumpTablesForRegion}
This method is called in the critical section in {PublishCode}, hence
performance is important here. Since most modules will only have a
single code space anyway, we can use the main jump table in the vast
majority of cases, and avoid taking a lock and iterating another data
structure.

R=ahaas@chromium.org

Bug: v8:10330
Change-Id: I18cbd3b127172963ccc9ec576a0985e874da7865
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2104891
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66721}
2020-03-16 14:17:38 +00:00
Clemens Backes
ae03752fd9 [wasm] Load register values from DebugBreak frame
This implements inspection of live registers on breakpoints in Liftoff.
To that end, the frame pointer of the WasmDebugBreak frame is remembered
when iterating the stack. Based on a platform-specific implementation of
{WasmDebugBreakFrameConstants}, the offset of the respective register
within that frame is computed, and the value is read from the frame.

As a drive-by, the wasm debug side table is storing register codes as
liftoff codes, which can also store register pairs (needed for i64 on
32-bit platforms, and for SIMD, which is not supported yet).

R=jkummerow@chromium.org
CC=thibaudm@chromium.org

Bug: v8:10222
Change-Id: I01b669baf56430e100cd46cc46f210121ea679da
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2102574
Reviewed-by: Simon Zünd <szuend@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66719}
2020-03-16 13:29:03 +00:00
Thibaud Michaud
dded093312 [liftoff] Skip unreachable breakpoints
Forward the breakpoint iterator to the current position, ignoring
unreachable breakpoints.

R=clemensb@chromium.org

Bug: v8:10147
Change-Id: Ic7e7fca4c69fdea68676ff75031bb5133bfc69d9
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2100993
Commit-Queue: Thibaud Michaud <thibaudm@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66716}
2020-03-16 13:02:23 +00:00
Andreas Haas
3556facb7c [wasm][liftoff] Implement memory.fill
R=clemensb@chromium.org

Bug: v8:10281
Change-Id: I33ca74a1536f4a99478aa1ee42dd7c7a46980f6d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2100999
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66708}
2020-03-13 17:24:07 +00:00
Andreas Haas
4613f3a2c6 [wasm][cleanup] Cleanup reading from buffer in simple runtime functions
This CL extracts a function which reads from a buffer and additionally
increments an offset for the next read.

R=clemensb@chromium.org

Bug: v8:10281, v8:10155
Change-Id: Id8d79130cde17053d701d2508e40cba993471e55
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2101001
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66707}
2020-03-13 17:20:17 +00:00
Milad Farazmand
7eeb53807c PPC/s390: [wasm-simd] [liftoff] Implement extract_lane on x64 and ia32
Port 11da29a745

R=fanchen.kong@intel.com, joransiu@ca.ibm.com, jyan@ca.ibm.com, michael_dawson@ca.ibm.com
BUG=
LOG=N

Change-Id: I5ea7bc62dcbd2411b84c5b9bfbe1fb6cdf0ee592
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2102769
Reviewed-by: Junliang Yan <jyan@ca.ibm.com>
Commit-Queue: Milad Farazmand <miladfar@ca.ibm.com>
Cr-Commit-Position: refs/heads/master@{#66705}
2020-03-13 15:48:07 +00:00
Thibaud Michaud
9009939437 [liftoff] Allow resuming execution after stepping
R=clemensb@chromium.org

Bug: v8:10321
Change-Id: Ia082b842de8947ead3931943b3bc05903a0f9e29
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2101002
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Thibaud Michaud <thibaudm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66704}
2020-03-13 14:49:47 +00:00
Andreas Haas
a0913c9dea [wasm] Refactor memory.fill to do the bounds check in C++
Doing the bounds check in C++ has the advantage that we generate less
code, and that TurboFan graphs get smaller. Additionally it will make
code generation from Liftoff easier. There is not really a downside:
We already called C++ anyways to do the actual memory.fill operation.

R=clemensb@chromium.org

Bug: v8:10281
Change-Id: If4e36d45a3fd1c4c0fef9137d37097a012e7a409
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2100991
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66703}
2020-03-13 14:20:27 +00:00
Jakob Kummerow
a44c71e7b9 [wasm-c-api] Fix component builds of wasm_api_tests
SignatureHelper::kMarker needs an explicit instantiation after
f3b4167f8b.

Change-Id: Ia5a0696a576a2c59bea262359058bd63eb3c8426
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2101004
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Georg Neis <neis@chromium.org>
Reviewed-by: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66701}
2020-03-13 13:18:14 +00:00
Andreas Haas
bb637954c8 [wasm] Add memory masking to memory.copy and memory.init
This CL adds memory masking to our implementation of memory.copy and
memory.init when spectre mitigations are enabled.

R=clemensb@chromium.org

Bug: v8:10281
Change-Id: I8722fa7ab244f339d859d5479eceede85dbbd08c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2100990
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66700}
2020-03-13 11:40:22 +00:00
Zhao Jiazhong
fe424b3b8f [mips][wasm] Turn ValueType from an enum to a class.
Port f3b4167f8b
https://crrev.com/c/2091471

Original Commit Message:

  In preparation for adding reference types, which need an additional
  parameter to indicate the referenced type.

Change-Id: I1b66bffea3ac2637886673476c8f7d62150b33a3
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2100695
Auto-Submit: Zhao Jiazhong <zhaojiazhong-hf@loongson.cn>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66699}
2020-03-13 10:52:12 +00:00
Zhao Jiazhong
1c565fdccf [mips][wasm-simd][liftoff] Implement extract_lane.
Port 11da29a745
https://crrev.com/c/2086706

Change-Id: I1f9227bfc12a0d1a60aa6d34f41a3a3903a5a24f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2100703
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Auto-Submit: Zhao Jiazhong <zhaojiazhong-hf@loongson.cn>
Cr-Commit-Position: refs/heads/master@{#66698}
2020-03-13 10:44:52 +00:00
Thibaud Michaud
83ff405b1a [liftoff] Add initial logic for stepping
Flood functions with breakpoints to prepare them for stepping. With a
small modification to the runtime function, this already implements a
basic step over functionality.

We still cannot resume, step in or step out (including stepping over a
return instruction).

R=clemensb@chromium.org

Bug: v8:10321
Change-Id: Ia4a6335d24c1a511c2f1fc9b48d728f327b3df56
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2098732
Reviewed-by: Simon Zünd <szuend@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Thibaud Michaud <thibaudm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66697}
2020-03-13 10:25:13 +00:00
Andreas Haas
cfb157a0b1 [wasm] Add bounds check in debug opcode printing
In debug builds of Liftoff, the opcode of the next instruction is
printed as a code comment. For multi-byte opcodes, all but the first
byte have to be extracted explicitly from the wasm code in the
{NextInstruction} function. The bounds check for this extraction was
missing.

R=clemensb@chromium.org

Bug: chromium:1061304
Change-Id: I16a05d54e50506c1387970ad84082d7e76108fc0
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2100996
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66696}
2020-03-13 10:17:05 +00:00
Kong, Fanchen
11da29a745 [wasm-simd] [liftoff] Implement extract_lane on x64 and ia32
Bug: v8:9909
Change-Id: If1293fd4ec36f56e459c79ee6ed4fdc466bbded1
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2086706
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Zhi An Ng <zhin@chromium.org>
Commit-Queue: Fanchen Kong <fanchen.kong@intel.com>
Cr-Commit-Position: refs/heads/master@{#66694}
2020-03-13 09:11:12 +00:00
Milad Farazmand
e97b7b0e26 PPC/s390: [wasm] Turn ValueType from an enum to a class
Port f3b4167f8b

Original Commit Message:

    In preparation for adding reference types, which need an additional
    parameter to indicate the referenced type.

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

Change-Id: Ia6d933611440096247dda159846f6c119f5167d5
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2101607
Reviewed-by: Junliang Yan <jyan@ca.ibm.com>
Commit-Queue: Milad Farazmand <miladfar@ca.ibm.com>
Cr-Commit-Position: refs/heads/master@{#66689}
2020-03-12 20:39:06 +00:00
Seth Brenith
0c72c71900 Move branch inversion on ==0 into platform-agnostic reducer
This change is based on a discussion from
https://crrev.com/c/v8/v8/+/2053769/4/src/compiler/machine-operator-reducer.cc#1696
wherein Tobias suggested moving the folding away of ==0 operations out
of the platform-specific instruction selectors and into the
MachineOperatorReducer. I noticed that CommonOperatorReducer already
handles some very similar cases, so I have tried putting the ==0 folding
into CommonOperatorReducer instead. I'm happy to move it into
MachineOperatorReducer if that's better; I still don't have a very good
understanding of how roles are separated among reducers.

Change-Id: Ia0285bd9fafeef29d87cc88654bd6d355d467e8f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2076498
Commit-Queue: Seth Brenith <seth.brenith@microsoft.com>
Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66688}
2020-03-12 17:56:56 +00:00
Jakob Kummerow
f3b4167f8b [wasm] Turn ValueType from an enum to a class
In preparation for adding reference types, which need an additional
parameter to indicate the referenced type.

Bug: v8:7748
Change-Id: If4023f3d9c7f42ed603b69c43356d2e8b81a0daa
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2091471
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66687}
2020-03-12 17:03:16 +00:00
Andreas Haas
4253a00ec8 [wasm] Reset thread-in-wasm flag in C functions
On Windows in an asan build we have to reset the thread-in-wasm flag in
the memory_init_wrapper, memory_copy_wrapper, and memory_fill_wrapper.
Accidentally I removed this code for the memory_init_wrapper and the
memory_copy_wrapper recently. This CL introduces the code again.

R=clemensb@chromium.org

Bug: v8:10281
Change-Id: If46def5cd64ac8cbff9b86108189462717961edd
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2098737
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66686}
2020-03-12 14:49:12 +00:00
Andreas Haas
402b7f15a4 [wasm] Add zero-extension for I64AtomicCompareExchange32U
x64's cmpxchgl instruction does not zero-extend the register. The stale
high word caused the difference in the results of the interpreter and
Liftoff/TurboFan.

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

Bug: chromium:1059529
Change-Id: I0fd440bee26e25b90b29533cfa9151e4d87754e3
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2098726
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Jakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66685}
2020-03-12 14:35:42 +00:00
Andreas Haas
41a75e88c0 [wasm][liftoff] Implement memory.init
R=clemensb@chromium.org

Bug: v8:10281
Change-Id: I321e65f42fd68a3451b49881b04bfb38dd7ff8ad
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2091469
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66682}
2020-03-12 11:41:52 +00:00
Zhao Jiazhong
622b1dc293 [mips][wasm-simd][liftoff] Implement add for f64x2, i64x2, i8x16
Port 485e66ba8e
https://crrev.com/c/2094198

Change-Id: I4e3ce2a70f2ccf4e95b0fa69834522d988e00f9b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2097895
Reviewed-by: Zhi An Ng <zhin@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66677}
2020-03-12 08:12:11 +00:00
Andreas Haas
e35b048c49 [wasm][liftoff] Implement memory.copy
R=clemensb@chromium.org

Bug: v8:10281
Change-Id: Icf7f8138d0acc172da6ff31935e50de3e4c79e10
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2096622
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66675}
2020-03-12 07:00:41 +00:00
Andreas Haas
e08e9d8992 Reland "[wasm] Do memory.init bounds check in C++ code"
The return value of {memory_init_wrapper} was defined as {bool} in
the original CL. When compiled with clang, the full return register is
written when {true} or {false} is returned. With msvc, however, the
return value is written as a single byte, without zero-extension. In
generated code, the full return register is used and therefore stale
bytes in the return register caused problems.

With this CL the return value is changed to {uint32_t}. This enforces
zero-extension of the return value and thereby fixes the issue.

R=clemensb@chromium.org

Bug: v8:10281
Change-Id: I1446e51d88a35def56bd39a8336baa81543497bf
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2096627
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66670}
2020-03-11 22:05:49 +00:00
Z Nguyen-Huu
e7de8c3a2d [wasm] Remove $ prefix in naming variable, global
Bug: v8:10242
Change-Id: Ie6583fe819de94185826dfd6a1b11870800847c4
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2098216
Commit-Queue: Z Nguyen-Huu <duongn@microsoft.com>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Kim-Anh Tran <kimanh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66669}
2020-03-11 20:50:59 +00:00
Z Nguyen-Huu
1dcaea823f [wasm] Adopt compatible naming for functions
We want to be consistent with wasdk/wasmparser.

Unnamed function's name would be func#

Doc: https://docs.google.com/document/d/1XoXWONLBgZWQ9dhtoMpQPvD0fnnWA50OorsuSXfME3g
Bug: v8:10242
Change-Id: I12222eef38a57242e9f606007d0ffa76b8e2a4af
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2084052
Commit-Queue: Z Nguyen-Huu <duongn@microsoft.com>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Kim-Anh Tran <kimanh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66667}
2020-03-11 16:53:09 +00:00
Andreas Haas
126f1ee14f Reland "[wasm] Do memory.copy bounds check in C++ code"
The return value of {memory_copy_wrapper} was defined as {bool} in
the original CL. When compiled with clang, the full return register is
written when {true} or {false} is returned. With msvc, however, the
return value is written as a single byte, without zero-extension. In
generated code, the full return register is used and therefore stale
bytes in the return register caused problems.

With this CL the return value is changed to {uint32_t}. This enforces
zero-extension of the return value and thereby fixes the issue.

R=clemensb@chromium.org

Bug: v8:10281
Change-Id: I628d01cfd7193fa960a7ccdf0d9fd896f510cd3e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2096626
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66666}
2020-03-11 16:39:19 +00:00
Milad Farazmand
384b94170a PPC/s390: [wasm-simd] [liftoff] Implement add for f64x2, i64x2, i8x16 on X64 and IA32
Port 485e66ba8e

R=fanchen.kong@intel.com, joransiu@ca.ibm.com, jyan@ca.ibm.com, michael_dawson@ca.ibm.com
BUG=
LOG=N

Change-Id: I2e1b79a995661243ff05b3d13e310f6315de0c97
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2097450
Reviewed-by: Junliang Yan <jyan@ca.ibm.com>
Commit-Queue: Milad Farazmand <miladfar@ca.ibm.com>
Cr-Commit-Position: refs/heads/master@{#66662}
2020-03-11 13:38:29 +00:00
Clemens Backes
b8eeb071c3 Revert "[wasm] Do memory.copy bounds check in C++ code"
This reverts commit c475e70460.

Reason for revert: Fails on MSVC: https://ci.chromium.org/p/v8/builders/ci/V8%20Win64%20-%20msvc/12805

Original change's description:
> [wasm] Do memory.copy bounds check in C++ code
> 
> In the existing implementation we first did a bounds check in generated
> code, and then called a simple C++ function to do the actual copying.
> With this CL now we pass the WasmInstanceObject to the C++ function in
> addition to the memory.copy parameters. Thereby we can do the bounds
> check in C++, which is much easier, less error prone, and which also
> speeds up code generation and reduces code size. Performance should not
> be worse, because we were already doing the call to C++ anyways.
> 
> R=​clemensb@chromium.org
> 
> Bug: v8:10281
> Change-Id: I24488d92056f0b5df27a61783a274895bd37cc24
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2093434
> Commit-Queue: Andreas Haas <ahaas@chromium.org>
> Reviewed-by: Clemens Backes <clemensb@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#66655}

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

Change-Id: Ic2491f635a292e004f6c95498a045ba102138dc5
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: v8:10281
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2096623
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66658}
2020-03-11 11:54:44 +00:00
Clemens Backes
c5cecf8d3d Revert "[wasm] Do memory.init bounds check in C++ code"
This reverts commit c7a26b1316.

Reason for revert: Need to revert previous CL because it fails on MSVC: https://ci.chromium.org/p/v8/builders/ci/V8%20Win64%20-%20msvc/12805

Original change's description:
> [wasm] Do memory.init bounds check in C++ code
> 
> In the existing implementation we first did a bounds check in generated
> code, and then called a simple C++ function to do the actual copying.
> With this CL now we pass the WasmInstanceObject to the C++ function in
> addition to the memory.init parameters. Thereby we can do the bounds
> check in C++, which is much easier, less error prone, and which also
> speeds up code generation and reduces code size. Performance should not
> be worse, because we were already doing the call to C++ anyways.
> 
> R=​clemensb@chromium.org
> 
> Bug: v8:10281
> Change-Id: Ia86e1d08001a8bc7556277abeaa9208ec1128f89
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2096621
> Commit-Queue: Andreas Haas <ahaas@chromium.org>
> Reviewed-by: Clemens Backes <clemensb@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#66656}

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

Change-Id: I1064113e7f1c445d04652a973c994317fd3e739a
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: v8:10281
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2096624
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66657}
2020-03-11 11:53:38 +00:00
Andreas Haas
c7a26b1316 [wasm] Do memory.init bounds check in C++ code
In the existing implementation we first did a bounds check in generated
code, and then called a simple C++ function to do the actual copying.
With this CL now we pass the WasmInstanceObject to the C++ function in
addition to the memory.init parameters. Thereby we can do the bounds
check in C++, which is much easier, less error prone, and which also
speeds up code generation and reduces code size. Performance should not
be worse, because we were already doing the call to C++ anyways.

R=clemensb@chromium.org

Bug: v8:10281
Change-Id: Ia86e1d08001a8bc7556277abeaa9208ec1128f89
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2096621
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66656}
2020-03-11 10:57:39 +00:00
Andreas Haas
c475e70460 [wasm] Do memory.copy bounds check in C++ code
In the existing implementation we first did a bounds check in generated
code, and then called a simple C++ function to do the actual copying.
With this CL now we pass the WasmInstanceObject to the C++ function in
addition to the memory.copy parameters. Thereby we can do the bounds
check in C++, which is much easier, less error prone, and which also
speeds up code generation and reduces code size. Performance should not
be worse, because we were already doing the call to C++ anyways.

R=clemensb@chromium.org

Bug: v8:10281
Change-Id: I24488d92056f0b5df27a61783a274895bd37cc24
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2093434
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66655}
2020-03-11 10:53:49 +00:00
Kong, Fanchen
485e66ba8e [wasm-simd] [liftoff] Implement add for f64x2, i64x2, i8x16 on X64 and IA32
Bug: v8:9909
Change-Id: I6766c1d0f347f8e0c8dea588e5984eb48ad18d5c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2094198
Reviewed-by: Zhi An Ng <zhin@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Jing Bao <jing.bao@intel.com>
Cr-Commit-Position: refs/heads/master@{#66653}
2020-03-11 01:32:27 +00:00
Ng Zhi An
f63189d60f [wasm-simd][liftoff][arm][arm64] I32x4 I16x8 F32x4 add
Bug: v8:9909
Change-Id: Ic309d394620ec17791bac2902116e15058b28a68
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2091634
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66652}
2020-03-10 17:15:18 +00:00
Z Nguyen-Huu
fe74c4f7c7 [wasm] Tierup wasm module on debugger.disable
Bug: v8:10290
Change-Id: I35670fef49a89cd075fb654daec4b55440266673
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2088231
Commit-Queue: Z Nguyen-Huu <duongn@microsoft.com>
Reviewed-by: Simon Zünd <szuend@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66634}
2020-03-09 17:39:37 +00:00
Seth Brenith
8b1a5681de [tools] Fix v8windbg behavior on Map's bit_field2
Bill kindly pointed out to me that v8windbg was not handling bit_field2
correctly. The issue was that the constexpr type for ElementsKind was,
somewhat unsurprisingly, "ElementsKind", but v8windbg expected a fully-
qualified type name like "v8::internal::ElementsKind". This change
addresses the problem in two ways:
1. Update v8windbg's type resolution logic to resolve type names as if
   they were used in the v8::internal namespace. This makes it more
   consistent with how those type names are used in other generated
   Torque code, reducing surprises and the number of times we have to
   write `v8::internal::` in .tq files.
2. Add compile-time verification that any constexpr type name used as a
   string in class-debug-readers-tq.cc can also resolve as a type name.

Bug: v8:9376
Change-Id: I349cd6ab586fd8345a1fa8bfc3989bb8e6376ab8
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2063769
Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Seth Brenith <seth.brenith@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#66633}
2020-03-09 17:36:27 +00:00
Ng Zhi An
9b666ea6ab [wasm-simd][liftoff] Skip loads of high fp reg in simd pairs
When dst is a fp pair, we set both low and high fp regs. Later when we
look at set regs to determine which registers to load into, we examine
both low and high fp. This is wrong - we only need to look at the low
fp, since Fill will load into the correct fp pairs. The bug was
triggered because we were examining into junk values in register_loads
indexed by the high fp.

Fixed: v8:10307
Change-Id: I6cbc212a969090818a5da0fe3dab36a418c23d04
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2091632
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66632}
2020-03-09 16:26:57 +00:00
Dan Elphick
b097a8e5de [api] Create v8::String::NewFromLiteral that returns Local<String>
String::NewFromLiteral is a templated function that takes a char[N]
argument that can be used as an alternative to String::NewFromUtf8 and
returns a Local<String> rather than a MaybeLocal<String> reducing the
number of ToLocalChecked() or other checks.

Since the string length is known at compile time, it can statically
assert that the length is less than String::kMaxLength, which means that
it can never fail at runtime.

This also converts all found uses of NewFromUtf8 taking a string literal
or a variable initialized from a string literal to use the new API. In
some cases the types of stored string literals are changed from const
char* to const char[] to ensure the size is retained.

This API does introduce a small difference compared to NewFromUtf8. For
a case like "abc\0def", NewFromUtf8 (using length -1 to infer length)
would treat this as a 3 character string, whereas the new API will treat
it as a 7 character string.

As a drive-by fix, this also fixes all redundant uses of
v8::NewStringType::kNormal when passed to any of the String::New*
functions.

Change-Id: Id96a44bc068d9c4eaa634aea688e024675a0e5b3
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2089935
Commit-Queue: Dan Elphick <delphick@chromium.org>
Reviewed-by: Mathias Bynens <mathias@chromium.org>
Reviewed-by: Mythri Alle <mythria@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66622}
2020-03-09 12:02:07 +00:00
Zhao Jiazhong
0b5ce79d60 [mips][wasm-simd][liftoff] Implement add for i32x4, i16x8, f32x4.
Port fd735e84f1
https://crrev.com/c/2067631

Change-Id: I720c4e218ea7a6088c61c2411c7c74e636f0772a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2089228
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Zhi An Ng <zhin@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66619}
2020-03-06 23:30:44 +00:00
Ng Zhi An
1333214417 [wasm-simd][liftoff][arm][arm64] Implement remaining splats
Implement f64x2, i64x2, i8x16 splats on arm and arm64.

Bug: v8:9909
Change-Id: I41f635ae5c6f025ece7f6445a58fbad1ad678fbd
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2087694
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66616}
2020-03-06 18:42:54 +00:00
Milad Farazmand
d29c68beae PPC/s390: [wasm-simd][liftoff] Implement add for i32x4, i16x8, f32x4 on X64 and IA32
Port fd735e84f1

R=fanchen.kong@intel.com, joransiu@ca.ibm.com, jyan@ca.ibm.com, michael_dawson@ca.ibm.com
BUG=
LOG=N

Change-Id: I8a46492241be9686da2220cb99162c9610962b5c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2091212
Reviewed-by: Junliang Yan <jyan@ca.ibm.com>
Commit-Queue: Milad Farazmand <miladfar@ca.ibm.com>
Cr-Commit-Position: refs/heads/master@{#66614}
2020-03-06 14:26:43 +00:00
Andreas Haas
85382b8169 [wasm][liftoff] Correctly print prefixed opcodes in code comments
Prefixed opcodes do not get written correctly in code comments in
Liftoff. The reason is that only one byte is interpreted as the opcode,
but prefixed opcodes take two bytes. This CL loads the second byte if
necessary.

The change could be done in function-body-decoder-impl.h, but that could
lead to performance regressions: it is a hot code path, and the change
here is just for debugging.

R=clemensb@chromium.org

Bug: v8:10155
Change-Id: I2282c068c81b5b1e2e2ed9757f4e77687d1d4ede
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2091467
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66613}
2020-03-06 13:31:43 +00:00
Andreas Haas
dcbe436d40 [wasm] Add signature check to new WebAssembly.Function
This CL fixes a special case where a WasmExportedFunction is passed to
the WebAssembly.Function constructor. This is a case that was not yet
implemented in V8, and which is also not specified in the proposal yet.

With this CL we do a signature check of the provided function. If it
matches, the function itself is returned. Otherwise a TypeError is
thrown.

I filed an issue: https://github.com/WebAssembly/js-types/issues/13

R=jkummerow@chromium.org

Bug: chromium:1057534
Change-Id: Ib09d1ba18abaa6a8dd451aa747fd26c03d927413
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2084813
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66610}
2020-03-06 11:09:03 +00:00
Andreas Haas
d20b023cbd [wasm] Change signature of memory_copy_wrapper
All other simple C functions take a pointer to a stack slot which
contains the actual parameters, whereas the memory_copy_wrapper takes
three parameters. This makes the code generation from Liftoff more
difficult. This CL changes the signature of memory_copy_wrapper to match
the signature of other simple C functions.

As MemoryCopy and MemoryInit are already implemented with C calls, this
change should not make a big difference in terms of performance. Simpler
and smaller Liftoff code may have more effect on performance. If this
assumption turns out wrong, we can change it in the future.

R=clemensb@chromium.org

Bug: v8:10281
Change-Id: I39e0ea00fcb22b4e84e612fe58eb4642856b72c9
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2078576
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66607}
2020-03-06 10:05:33 +00:00
Kong, Fanchen
fd735e84f1 [wasm-simd][liftoff] Implement add for i32x4, i16x8, f32x4 on X64 and IA32
Bug: v8:9909
Change-Id: I8dc5d0143d90ecad6766c686af2d3f0f8ea89c16
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2067631
Reviewed-by: Zhi An Ng <zhin@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Jing Bao <jing.bao@intel.com>
Cr-Commit-Position: refs/heads/master@{#66603}
2020-03-06 02:55:03 +00:00
Clemens Backes
13cdf3a7fc Reland "[wasm] Further reduce the size of WasmCode"
This is a reland of 79398ab09d

Original change's description:
> [wasm] Further reduce the size of WasmCode
>
> Also, save dynamic allocations (plus their memory overhead).
> This is realized by storing the relocation information, source position
> table, and protected instruction information together in one "metadata"
> byte array.
> For each of the three components, we just store their size, such that
> the accessors can return the respecitive {Vector} views as before.
>
> This makes each WasmCode object 24 bytes smaller on 64-bit
> architectures. It also saves a few more bytes per code object because
> less padding is needed for the individual allocations, and each dynamic
> allocation comes with some constant memory overhead.
>
> Since the protected instructions will just be stored in a byte array
> now, some APIs are refactored to just return that byte array directly
> (instead of an array of {ProtectedInstructionData}). This also
> simplifies serialization and deserialization, and will allow for
> switching to a more compact representation in the future.
>
> Drive-by: Add some more checks to {Vector::cast} to protect against
>   undefined behaviour.
>
> R=ahaas@chromium.org
>
> Bug: v8:10254
> Change-Id: I81ca847023841110e3e52cc402fcb0349325d7af
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2078545
> Reviewed-by: Andreas Haas <ahaas@chromium.org>
> Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
> Commit-Queue: Clemens Backes <clemensb@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#66596}

Tbr: ahaas@chromium.org
Bug: v8:10254
Change-Id: Idcdcb4f13c3eb7a3f7fb5ef8a1229103ca0ae975
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2089934
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66598}
2020-03-05 16:21:18 +00:00
Clemens Backes
28afd1c9af Revert "[wasm] Further reduce the size of WasmCode"
This reverts commit 79398ab09d.

Reason for revert: Makes UBSan unhappy: https://ci.chromium.org/p/v8/builders/ci/V8%20Linux64%20UBSan/10186

Original change's description:
> [wasm] Further reduce the size of WasmCode
> 
> Also, save dynamic allocations (plus their memory overhead).
> This is realized by storing the relocation information, source position
> table, and protected instruction information together in one "metadata"
> byte array.
> For each of the three components, we just store their size, such that
> the accessors can return the respecitive {Vector} views as before.
> 
> This makes each WasmCode object 24 bytes smaller on 64-bit
> architectures. It also saves a few more bytes per code object because
> less padding is needed for the individual allocations, and each dynamic
> allocation comes with some constant memory overhead.
> 
> Since the protected instructions will just be stored in a byte array
> now, some APIs are refactored to just return that byte array directly
> (instead of an array of {ProtectedInstructionData}). This also
> simplifies serialization and deserialization, and will allow for
> switching to a more compact representation in the future.
> 
> Drive-by: Add some more checks to {Vector::cast} to protect against
>   undefined behaviour.
> 
> R=​ahaas@chromium.org
> 
> Bug: v8:10254
> Change-Id: I81ca847023841110e3e52cc402fcb0349325d7af
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2078545
> Reviewed-by: Andreas Haas <ahaas@chromium.org>
> Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
> Commit-Queue: Clemens Backes <clemensb@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#66596}

TBR=jkummerow@chromium.org,ahaas@chromium.org,clemensb@chromium.org,tebbi@chromium.org

Change-Id: Id80aa82cfce8942879031032b322ee66855b5600
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: v8:10254
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2089933
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66597}
2020-03-05 15:26:58 +00:00
Clemens Backes
79398ab09d [wasm] Further reduce the size of WasmCode
Also, save dynamic allocations (plus their memory overhead).
This is realized by storing the relocation information, source position
table, and protected instruction information together in one "metadata"
byte array.
For each of the three components, we just store their size, such that
the accessors can return the respecitive {Vector} views as before.

This makes each WasmCode object 24 bytes smaller on 64-bit
architectures. It also saves a few more bytes per code object because
less padding is needed for the individual allocations, and each dynamic
allocation comes with some constant memory overhead.

Since the protected instructions will just be stored in a byte array
now, some APIs are refactored to just return that byte array directly
(instead of an array of {ProtectedInstructionData}). This also
simplifies serialization and deserialization, and will allow for
switching to a more compact representation in the future.

Drive-by: Add some more checks to {Vector::cast} to protect against
  undefined behaviour.

R=ahaas@chromium.org

Bug: v8:10254
Change-Id: I81ca847023841110e3e52cc402fcb0349325d7af
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2078545
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66596}
2020-03-05 15:01:48 +00:00
Zhao Jiazhong
6f2c7b1354 [mips][wasm-simd][liftoff] Implement splat for i64x2, f64x2, i8x16
Port 9245e3b498
https://crrev.com/c/2049247

Change-Id: Ic2df706a4d5f7df8a2cdb4f53c4679cf96f0b8b8
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2086535
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Zhi An Ng <zhin@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66594}
2020-03-05 13:57:14 +00:00
Milad Farazmand
578c3a3ba0 [wasm] Use kSystemPointerSize to check for alignment
Change-Id: I84d53282278d12c2e47b8e9a07b69ecf89dba237
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2087692
Commit-Queue: Milad Farazmand <miladfar@ca.ibm.com>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66584}
2020-03-04 15:10:10 +00:00
Andreas Haas
90a3a6609f Reland "[wasm][liftoff] Implement Atomic(Compare)Exchange on x64"
There was an issue in the register allocation in the original CL. The
register of the new_value did not get pinned, so it was used for the
expected value as well.

Bug: v8:10108
Change-Id: I2589fc31f8fbfda39c94ea5801f63ed370a3b7ce
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2084815
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66579}
2020-03-04 09:14:30 +00:00
Z Nguyen-Huu
2f52803ea6 [wasm] Tier up in parallel
Add tier up to existing recompilation logic.
This is a part of Tier up to Turbofan on Debugger.disable

Bug: v8:10290
Change-Id: I44731df520201ac254f2d1bfbfb5c49d8bb50117
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2080658
Commit-Queue: Z Nguyen-Huu <duongn@microsoft.com>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66573}
2020-03-03 19:02:34 +00:00
Milad Farazmand
d48b10b4e9 PPC/s390: [wasm-simd][liftoff] Implement splat for i64x2, f64x2, i8x16 on x64 and ia32
Port 9245e3b498

R=zhiguo.zhou@intel.com, joransiu@ca.ibm.com, jyan@ca.ibm.com, michael_dawson@ca.ibm.com
BUG=
LOG=N

Change-Id: I9a6358dfd2bfd69e421c85fe3bbf343e7aee3b8c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2081575
Reviewed-by: Junliang Yan <jyan@ca.ibm.com>
Commit-Queue: Milad Farazmand <miladfar@ca.ibm.com>
Cr-Commit-Position: refs/heads/master@{#66564}
2020-03-03 14:22:55 +00:00
Clemens Backes
547e857b56 [wasm] Remove samples for obsolete histograms
The histograms were removed from chrome. This CL cleans up the V8 code
to stop reporting samples.

R=ahaas@chromium.org

Bug: chromium:1053285
Change-Id: I7c6ff36ac9bb5d86e81e5f36849903a95a8ed618
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2083478
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66553}
2020-03-03 09:44:42 +00:00
Zhou, Zhiguo
9245e3b498 [wasm-simd][liftoff] Implement splat for i64x2, f64x2, i8x16 on x64 and ia32
Bug: v8:9909
Change-Id: Id89ddb429c90f3f454a581d75b783ff56775b01e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2049247
Commit-Queue: Zhiguo Zhou <zhiguo.zhou@intel.com>
Reviewed-by: Zhi An Ng <zhin@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66552}
2020-03-03 08:44:37 +00:00
Andreas Haas
24110ef046 [wasm][liftoff] Implement atomic.fence
R=clemensb@chromium.org

Bug: v8:10108
Change-Id: I3bdb4c2abe0b1db1babec370921463dbdfcd0a32
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2074403
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66544}
2020-03-02 22:28:31 +00:00
Deepti Gandluri
f57943788e [wasm-simd] Add flag for post-MVP SIMD, gate opcodes with it
Some opcodes are introduced in V8 for prototyping, and performance
measurements that are not officially a part of the current SIMD proposal
but may be included in future, gate these by a separate flag.

Change-Id: Icc6a9e89c6196c8ff144d2e0193d707e1f60c38b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2079539
Commit-Queue: Deepti Gandluri <gdeepti@chromium.org>
Reviewed-by: Zhi An Ng <zhin@chromium.org>
Reviewed-by: Ben Smith <binji@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66542}
2020-03-02 20:38:51 +00:00
Andreas Haas
c9a2703891 [wasm][liftoff] Implement AtomicNotify
R=clemensb@chromium.org

Bug: v8:10108
Change-Id: I72294ae6fa62209e078b3d00151207524b32e67e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2074401
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66541}
2020-03-02 17:37:05 +00:00
Andreas Haas
cdec094f27 [wasm][liftoff] Implement AtomicWait on 64-bit platforms
Implements AtomicWait on 64-bit platforms. Note that this implementation
does not use {PrepareCall}, as planned originally. This will be done in
a separate CL, to prepare the implementation for 32-bit platforms. This
CL for now unblocks the implementation on x64.

R=clemensb@chromium.org

Bug: v8:10108
Change-Id: I52eb752364b231043975f62913c2ef9579321038
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2074400
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66537}
2020-03-02 15:58:06 +00:00
Andreas Haas
7ad6b04edb Reland "[wasm] Refactor AtomicWait implementation"
Stack parameters in the StubCallDescriptor were set to the wrong type. I
changed it now so that for stack parameters that are specified in the
CallInterfaceDescriptor, type specified type is used. All other
parameters are assumed to be tagged, as it has been until now.

Original change's description:
> [wasm] Refactor AtomicWait implementation
>
> The existing implementation included aspects that are not
> straight-forward to implement in Liftoff and seemed inefficient:
> * Convert the timeout in WebAssembly code from I64 to F64, just to
>   convert it back in the runtime.
>   * On 32-bit platforms this conversion needs an additional C-call.
> * Split the I64 expected value from I64 into two I32 values in the
>   wasm-compiler.
>   * Ideally the int64-lowering takes care of 32-bit specific handling.
>
> With this CL the timeout and the expected value are passed as I64 to
> the runtime (a builtin moves the I64 into a bigint for that). The
> int64-lowering takes care of 32-bit platforms. There are special
> builtins for 32-bit platforms, but they are written such that ideally
> also the int64-lowering could create them.

Bug: v8:10108
Change-Id: Ib87b543666708457c0d686208a86e46cdca3f9a2
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2080362
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66533}
2020-03-02 14:49:55 +00:00
Deepti Gandluri
c6f611be26 [wasm] Cleanup wasm opcode text
Change-Id: Iaf8e02b201c547fb8b74a7e7f2defd4bfbc098d0
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2079049
Reviewed-by: Zhi An Ng <zhin@chromium.org>
Commit-Queue: Deepti Gandluri <gdeepti@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66508}
2020-02-28 22:55:22 +00:00
Sathya Gunasekaran
9945e90829 Revert "[wasm] Refactor AtomicWait implementation"
This reverts commit 77d4e23047.

Reason for revert: verify csa build bot broken
https://ci.chromium.org/p/v8/builders/ci/V8%20Linux%20-%20verify%20csa/16218?

Original change's description:
> [wasm] Refactor AtomicWait implementation
> 
> The existing implementation included aspects that are not
> straight-forward to implement in Liftoff and seemed inefficient:
> * Convert the timeout in WebAssembly code from I64 to F64, just to
>   convert it back in the runtime.
>   * On 32-bit platforms this conversion needs an additional C-call.
> * Split the I64 expected value from I64 into two I32 values in the
>   wasm-compiler.
>   * Ideally the int64-lowering takes care of 32-bit specific handling.
> 
> With this CL the timeout and the expected value are passed as I64 to
> the runtime (a builtin moves the I64 into a bigint for that). The
> int64-lowering takes care of 32-bit platforms. There are special
> builtins for 32-bit platforms, but they are written such that ideally
> also the int64-lowering could create them.
> 
> R=​jkummerow@chromium.org, binji@chromium.org
> 
> Bug: v8:10108
> Change-Id: I2dbba5839779961b1c5bde4c23fc3f38f1895a52
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2071867
> Commit-Queue: Andreas Haas <ahaas@chromium.org>
> Reviewed-by: Clemens Backes <clemensb@chromium.org>
> Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
> Reviewed-by: Ben Smith <binji@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#66497}

TBR=binji@chromium.org,jkummerow@chromium.org,ahaas@chromium.org,clemensb@chromium.org

Change-Id: If284aa07eedddd2fbea4df8c53c7d371cac1d42e
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: v8:10108
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2080250
Reviewed-by: Sathya Gunasekaran  <gsathya@chromium.org>
Commit-Queue: Sathya Gunasekaran  <gsathya@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66498}
2020-02-28 12:32:37 +00:00
Andreas Haas
77d4e23047 [wasm] Refactor AtomicWait implementation
The existing implementation included aspects that are not
straight-forward to implement in Liftoff and seemed inefficient:
* Convert the timeout in WebAssembly code from I64 to F64, just to
  convert it back in the runtime.
  * On 32-bit platforms this conversion needs an additional C-call.
* Split the I64 expected value from I64 into two I32 values in the
  wasm-compiler.
  * Ideally the int64-lowering takes care of 32-bit specific handling.

With this CL the timeout and the expected value are passed as I64 to
the runtime (a builtin moves the I64 into a bigint for that). The
int64-lowering takes care of 32-bit platforms. There are special
builtins for 32-bit platforms, but they are written such that ideally
also the int64-lowering could create them.

R=jkummerow@chromium.org, binji@chromium.org

Bug: v8:10108
Change-Id: I2dbba5839779961b1c5bde4c23fc3f38f1895a52
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2071867
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Ben Smith <binji@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66497}
2020-02-28 12:25:47 +00:00
Jakob Kummerow
20b892b5a0 [wasm] Fix memory growth to >2GB
There were a few places that still checked against the limit for
initial memory size rather than the limit for memory size after
growth (which was recently separated from the former).

Bug: v8:7881
Change-Id: Id17d86e2f7a5dfa4f1dd35153b0cefc01f72ed33
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2078574
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66496}
2020-02-28 11:48:37 +00:00
Andreas Haas
fda7ef4fc0 Revert "[wasm][liftoff] Implement Atomic(Compare)Exchange on x64"
This reverts commit c8e10a1693.

Reason for revert: This CL causes problems with webpages in the wild: https://crbug.com/1056295

Original change's description:
> [wasm][liftoff] Implement Atomic(Compare)Exchange on x64
> 
> R=​clemensb@chromium.org
> 
> Bug: v8:10108
> Change-Id: Ic9ef9ba35218450d3f9e7838890c82b785c34da4
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2037433
> Commit-Queue: Andreas Haas <ahaas@chromium.org>
> Reviewed-by: Clemens Backes <clemensb@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#66429}

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

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

Bug: v8:10108
Change-Id: I69251b9e3de13d8314e413a4196c8185a73bfb5c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2078544
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66494}
2020-02-28 09:52:27 +00:00
Thibaud Michaud
c78539f96e [wasm] Update native module info on cache hit
The set of isolates known to a native module and the set of native
modules known to an isolate were not updated on cache hit. This caused
the wasm engine to collect code when it was still live in some isolate.

R=clemensb@chromium.org

Bug: chromium:1055131
Change-Id: I56682509b284c9c0dce7c95ee20ec3929e2e8c9f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2078583
Commit-Queue: Thibaud Michaud <thibaudm@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66488}
2020-02-27 19:20:07 +00:00
Clemens Backes
8d1c5f3344 [wasm][cleanup] Avoid passing non-const FunctionSig*
Most function signatures are created once and never changed. Hence pass
them as const pointer. This makes it clear in function signatures that
these parameters will not be modified.

This also avoids a few ugly const_casts where we were passing pointers
to constexpr FunctionSigs via non-const pointers.

R=jkummerow@chromium.org

Bug: v8:10155
Change-Id: Ieb658ab5582bff276f76babdaf7ddb8f72bd4790
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2072739
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66478}
2020-02-27 09:44:42 +00:00
Seth Brenith
74131bdd2e Move a bunch of bitfield definitions to Torque
This allows Torque code to refer to these bitfields (not currently
relevant for any of these classes), and allows the postmortem debugging
API to provide details about these bitfields.

Change-Id: I79c74a3c5ef1f77e839720a4e8ee1f8482a576ca
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2049870
Commit-Queue: Seth Brenith <seth.brenith@microsoft.com>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66471}
2020-02-26 21:07:51 +00:00
Clemens Backes
9a96f1bbad Reland "[wasm] Refactor callback triggering"
This is a reland of 0dc598df0c

Original change's description:
> [wasm] Refactor callback triggering
> 
> 1) Instead of passing three boolean values to |TriggerCallbacks|, pass
>    one EnumSet which contains all events to trigger.
> 2) Remember which events already happened, to avoid triggering them
>    again.
> 3) Compute triggered events once after the loop in |OnFinishedUnits|,
>    instead of checking for every finished unit.
> 4) When a new callback is registered, trigger all previous events
>    immediately. This solves issue v8:10217.
> 5) Replace |NotifyTopTierReady| by |AddCallback| which is identical now.
> 6) Do not call |OnFinishedJSToWasmWrapperUnits| if no wrappers were
>    compiled (this is a minor performance optimization; we save taking
>    and releasing a lock).
> 7) Drive-by: Make the |EnumSet| constructor really constexpr (by making
>    |Mask| constexpr).
> 
> R=ahaas@chromium.org
> 
> Bug: v8:10217
> Change-Id: Ib3688a1687ad7b523e90efd73f4073e9f1193016
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2072737
> Commit-Queue: Clemens Backes <clemensb@chromium.org>
> Reviewed-by: Andreas Haas <ahaas@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#66459}

Bug: v8:10217
Change-Id: I9f7ca424fa7f1d0379dabe230bebf62522dfc857
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2074501
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66468}
2020-02-26 16:16:33 +00:00
Clemens Backes
c626bc5e88 [wasm] Reduce size of {WasmCode} objects
This is a first step to make {WasmCode} objects smaller. Many code
offsets are currently stored in {size_t} even though there were
originally (during assembly) an int. Others are stored in {uint32_t}.

This CL switches the function index and all code lengths and offsets to
int, because
a) bigger code is not supported anyway, and
b) the style guide recommends int over unsigned types.

This makes the {WasmCode} 24 bytes smaller on x64 (from 144 to 120
bytes).

R=ahaas@chromium.org

Bug: v8:10254
Change-Id: I8f78bf4be64d59cf9393e3b6662d9d3bd153d387
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2074217
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66462}
2020-02-26 14:09:38 +00:00
Clemens Backes
6a2865d26e Revert "[wasm] Refactor callback triggering"
This reverts commit 0dc598df0c.

Reason for revert: Fails the wasm-cache-test blink test.

Original change's description:
> [wasm] Refactor callback triggering
> 
> 1) Instead of passing three boolean values to |TriggerCallbacks|, pass
>    one EnumSet which contains all events to trigger.
> 2) Remember which events already happened, to avoid triggering them
>    again.
> 3) Compute triggered events once after the loop in |OnFinishedUnits|,
>    instead of checking for every finished unit.
> 4) When a new callback is registered, trigger all previous events
>    immediately. This solves issue v8:10217.
> 5) Replace |NotifyTopTierReady| by |AddCallback| which is identical now.
> 6) Do not call |OnFinishedJSToWasmWrapperUnits| if no wrappers were
>    compiled (this is a minor performance optimization; we save taking
>    and releasing a lock).
> 7) Drive-by: Make the |EnumSet| constructor really constexpr (by making
>    |Mask| constexpr).
> 
> R=​ahaas@chromium.org
> 
> Bug: v8:10217
> Change-Id: Ib3688a1687ad7b523e90efd73f4073e9f1193016
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2072737
> Commit-Queue: Clemens Backes <clemensb@chromium.org>
> Reviewed-by: Andreas Haas <ahaas@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#66459}

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

Change-Id: I564b053e898db5f7b51cefa4626c0625a225c89a
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: v8:10217
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2074638
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66461}
2020-02-26 14:08:33 +00:00
Clemens Backes
0dc598df0c [wasm] Refactor callback triggering
1) Instead of passing three boolean values to |TriggerCallbacks|, pass
   one EnumSet which contains all events to trigger.
2) Remember which events already happened, to avoid triggering them
   again.
3) Compute triggered events once after the loop in |OnFinishedUnits|,
   instead of checking for every finished unit.
4) When a new callback is registered, trigger all previous events
   immediately. This solves issue v8:10217.
5) Replace |NotifyTopTierReady| by |AddCallback| which is identical now.
6) Do not call |OnFinishedJSToWasmWrapperUnits| if no wrappers were
   compiled (this is a minor performance optimization; we save taking
   and releasing a lock).
7) Drive-by: Make the |EnumSet| constructor really constexpr (by making
   |Mask| constexpr).

R=ahaas@chromium.org

Bug: v8:10217
Change-Id: Ib3688a1687ad7b523e90efd73f4073e9f1193016
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2072737
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66459}
2020-02-26 11:57:14 +00:00
Clemens Backes
4e2ed06f20 [wasm] Some cleanup in recompilation logic
1) Merge |AddBaselineCompilationUnits| into
   |InitializeRecompilationProgress|.
2) Rename |InitializeRecompilationProgress| to
   |InitializeRecompilation|.
3) Unify the update of |ReachedRecompilationTierField| in
   |compilation_progress_|.

R=ahaas@chromium.org
CC=duongn@microsoft.com

Bug: v8:9654
Change-Id: I58324b553bf226cacb355e387c235841fdea82d4
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2071863
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66454}
2020-02-26 10:38:38 +00:00
Clemens Backes
e7fa1fbffe [wasm] Avoid adding callback that will never be called
In {InitializeRecompilationProgress}, we already have logic in place to
call the callback (all callbacks really) if no compilation units were
added.
In that case, the callback in fact does not need to be added to the list
of callbacks. Instead, it's enough to just call this one callback and
then discard it.

R=ahaas@chromium.org

Bug: v8:9654
Change-Id: I60bab2d67d67d10964404d897d13ffd628ff9964
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2071861
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66450}
2020-02-26 09:34:42 +00:00
Emanuel Ziegler
abb727a3d9 [wasm][reference-types] Check type on Table.Init & Table.Copy
Added a type field to elements to distinguish anyref, funcref and
nullref elements and do a proper type checking at compile time as
the spec requires.

R=ahaas@chromium.org

Change-Id: I31be7aa1170439859ca7ec5e20aabb2720c290b3
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2069330
Commit-Queue: Emanuel Ziegler <ecmziegler@chromium.org>
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66448}
2020-02-26 09:29:43 +00:00
Ng Zhi An
fa350b5bf4 [wasm-simd][x64] Implement integer absolute on x64 and interpreter
Implements i8x16.abs, i16x8.abs, and i32x4.abs.

Bug: v8:10233
Change-Id: Iefe3c70bdc229c6da6a0ef07273ca654ca1e937e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2063200
Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
Reviewed-by: Deepti Gandluri <gdeepti@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66440}
2020-02-26 03:57:11 +00:00
Ng Zhi An
a67a16aae4 [wasm-simd] Fix OpcodeLength of load splat/extend ops
Move load splat and load extend ops into the list of SIMD memory
opcodes, since they similarly take an i32 and an memarg. This fixes the
OpcodeLength calculation in function-body-decoder-impl.h.

And in turn, fixes the mjsunit test code that the fuzzer generates. See
the regress-1055692.js file for the weird S8x16LoadSplat followed by 2
kExprUnreachable, where the kExprUnreachable really is a memarg
{0x0, 0x0}. This bug was caught by the fuzzer, and that was the
generated test (with small fixes to add kExprDrop), so leaving it as it
is.

Bug: chromium:1055692
Change-Id: I743b6beb82350b5fea22c8dd10b546a02741cfed
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2071401
Reviewed-by: Deepti Gandluri <gdeepti@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66439}
2020-02-26 02:57:20 +00:00
Z Nguyen-Huu
560d366df9 [wasm] Adopt WAT compatible naming
We want to be consistent with wasdk/wasmparser.

The names used in V8 should follow the WAT convention and always start
with a dollar, both for names from the "names" section as well as
generated names.

Bug: v8:10242
Change-Id: If4dbd4c38208c9dd9377dd2f79120635a531d881
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2070637
Commit-Queue: Z Nguyen-Huu <duongn@microsoft.com>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Kim-Anh Tran <kimanh@chromium.org>
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66434}
2020-02-25 20:14:52 +00:00
Andreas Haas
7a31813024 Reland "[wasm] The name of a custom section can cause a validation error"
This is a reland of 03d5a7ba9b

Nothing changed here compared to the original test. The tests on the
blink side were invalid, I fixed them in https://crrev.com/c/2066907.

Original change's description:
> [wasm] The name of a custom section can cause a validation error
>
> The WebAssembly spec defines that the name of a custom section can cause
> a validation error. The streaming decoder, however, used a separate
> Decoder object to decode the name, and thereby avoided a validation
> error. With this CL the streaming decoder uses the main decoder to
> decode the name of the custom section.
>
> In addition this CL removes the test mjsunit/regress/wasm/regress-789952.
> This test defined an invalid WebAssembly module and expected it to
> compile. As it is a regression test, it makes no sense to fix the test.
> The module is invalid because it defines the length of the custom section
> to be '0', so there are no bytes in the custom section for its name.
>
> R=clemensb@chromium.org
> CC=thibaudm@chromium.org
>
> Bug: v8:10126
> Change-Id: I8cfc77c9a5916570d5362d5922e0179a29774da8
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2041446
> Commit-Queue: Andreas Haas <ahaas@chromium.org>
> Reviewed-by: Clemens Backes <clemensb@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#66348}

Bug: v8:10126
Change-Id: I48aaed8eb9899da1703030fb6809fe46a6e66191
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2069325
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66431}
2020-02-25 15:38:27 +00:00
Andreas Haas
c8e10a1693 [wasm][liftoff] Implement Atomic(Compare)Exchange on x64
R=clemensb@chromium.org

Bug: v8:10108
Change-Id: Ic9ef9ba35218450d3f9e7838890c82b785c34da4
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2037433
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66429}
2020-02-25 14:24:46 +00:00
Andreas Haas
6e452a1c9c [cleanup][wasm] Use early return in validation of FunctionIndexImmediate
R=clemensb@chromium.org

Bug: v8:10155
Change-Id: Ia89724ed5f8af4199bbce41ed12a0dace578c43f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2069326
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66428}
2020-02-25 14:21:16 +00:00
Ng Zhi An
0d0d38fec0 Reland "[liftoff] Check fp_pair when looking up register for reuse"
This is a reland of 548fda4afb

regress-1054466 is modified to not use 64x2 operations, since that was
causing problems on noavx/nosse builds, which requires scalar lowering,
and scalar lowering for 64x2 ops is not implemented.

Original change's description:
> [liftoff] Check fp_pair when looking up register for reuse
>
> Given two registers that are both not gp_pair, one could be an fp_pair,
> and the other not, and we will incorrect call == on them. The current
> check needs to be expanded to check that both registers are fp_pair.
>
> Bug: chromium:1054466
> Change-Id: Ib986c002a8a5cadb9668458597a797cecfd971b1
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2070006
> Commit-Queue: Zhi An Ng <zhin@chromium.org>
> Reviewed-by: Clemens Backes <clemensb@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#66402}

Bug: chromium:1054466
Change-Id: If88f1ff2fb17aaa3727758cda5b368be1c6d9bd6
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2071396
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66423}
2020-02-25 12:18:46 +00:00
Philip Pfaffe
f07db34d85 Revert "[wasm-debug] Let wasm scripts report correct column information."
This reverts commit 827107a7dc.

Reason for revert: https://bugs.chromium.org/p/chromium/issues/detail?id=1054664

Original change's description:
> [wasm-debug] Let wasm scripts report correct column information.
>
> In the debugger, wasm scripts currently do not contain meaningful column
> informations. Fix that by keeping track of the offset and size of the
> wasm code section inthe module and reporting that to the debugger.
>
> Bug: chromium:1042636
> Change-Id: Ie2b5d3a50952a467d256f815c16e459cb0ae600e
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2011083
> Commit-Queue: Philip Pfaffe <pfaffe@chromium.org>
> Reviewed-by: Simon Zünd <szuend@chromium.org>
> Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#65913}


Bug: chromium:1042636
Change-Id: Ic59d71111c3274688828bdbf6894f7f3274dc50a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2066983
Commit-Queue: Philip Pfaffe <pfaffe@chromium.org>
Reviewed-by: Sigurd Schneider <sigurds@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Simon Zünd <szuend@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66409}
2020-02-24 14:24:26 +00:00
Clemens Backes
75931f18ee [wasm] Extend debug side table for registers
This extends the debug side table to also store register locations in
addition to constants and stack values.
Previously, every value that was not constant was assumed to be spilled
to the stack. This made sense, because without breakpoints we would only
emit debug side table entries at call sites, where all registers are
spilled.
With breakpoints, this changes. At break locations, values might be live
in registers.

The logic to decide whether a value will live in the register or on the
stack is extended, because we sometimes generate the debug side table
entry at a point where the registers are not spilled yet. The debug side
table entry creation needs to account for that, and assume that these
registers will still be spilled.

R=thibaudm@chromium.org

Bug: v8:10147, v8:10222
Change-Id: I3b020dfaa29fc007047663706ee286180a996bfd
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2066960
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Thibaud Michaud <thibaudm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66407}
2020-02-24 13:29:06 +00:00
Clemens Backes
37425fe968 Revert "[liftoff] Check fp_pair when looking up register for reuse"
This reverts commit 548fda4afb.

Reason for revert: Segfault on nosse bot: https://ci.chromium.org/p/v8/builders/ci/V8%20Linux/35905?

Original change's description:
> [liftoff] Check fp_pair when looking up register for reuse
> 
> Given two registers that are both not gp_pair, one could be an fp_pair,
> and the other not, and we will incorrect call == on them. The current
> check needs to be expanded to check that both registers are fp_pair.
> 
> Bug: chromium:1054466
> Change-Id: Ib986c002a8a5cadb9668458597a797cecfd971b1
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2070006
> Commit-Queue: Zhi An Ng <zhin@chromium.org>
> Reviewed-by: Clemens Backes <clemensb@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#66402}

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

Change-Id: I56f13406ef3cc3793c9d0e2273c4dc5fb0e3de38
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: chromium:1054466
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2069327
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66405}
2020-02-24 13:18:46 +00:00
Ng Zhi An
548fda4afb [liftoff] Check fp_pair when looking up register for reuse
Given two registers that are both not gp_pair, one could be an fp_pair,
and the other not, and we will incorrect call == on them. The current
check needs to be expanded to check that both registers are fp_pair.

Bug: chromium:1054466
Change-Id: Ib986c002a8a5cadb9668458597a797cecfd971b1
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2070006
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66402}
2020-02-24 12:24:06 +00:00
Jakob Kummerow
a8b7d47733 [wasm] Bring memory limits up to spec
Make sure the "initial pages" memory limit is enforced correctly and
throws a CompileError when exceeded.
Bump the "maximum pages" memory limit to 65536.
The --wasm-max-mem-pages flag now controls the "initial pages" limit;
the "maximum pages" limit is always 65536 as spec'ed.

This CL depends on https://github.com/WebAssembly/spec/pull/1121.

Bug: v8:7881, v8:8633
Change-Id: I68d07cef56633b8b8ce3b3d047c14e1096daf547
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2035876
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Reviewed-by: Georg Neis <neis@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66400}
2020-02-24 11:00:16 +00:00
Wouter Vermeiren
8199a7ac23 [ppc64][ppc] Split up ARCH_PPC and ARCH_PPC64
After support for ARCH_PPC was dropped, it became a subset of
ARCH_PPC64. If you compile for ppc64, then you set the ARCH_PPC64
define which also sets the ARCH_PPC define.
To be able to again support ppc (32 bit) those defines should be
split up again.

This commit only splits up the defines but does not introduce a
working ARCH_PPC variant.

Bug: v8:10102
Change-Id: I64e0749f8e5a7dc078ee7890d92e57b82706a849
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1989826
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Peter Marshall <petermarshall@chromium.org>
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: Hannes Payer <hpayer@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Reviewed-by: Milad Farazmand <miladfar@ca.ibm.com>
Reviewed-by: Jakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66390}
2020-02-21 15:42:20 +00:00
Paolo Severini
03fc414908 Add initial support for Wasm debugging with LLDB: implements a GDB-remote stub
This is the first piece of the wasm debugging prototype (besides the changes to
add/remove breakpoints in WasmModuleObject made with
e699f39cae).

This changelist adds the infrastructure for a GDB-remote stub that will be used
to manage debugging sessions via the gdb-remote protocol.
It enables the creation and termination of debugging sessions over TCP
connections that are managed in a separate thread.
The logic to actually send, receive and decode GDB-remote packets will be part
of a future changelist.

Build with: v8_enable_wasm_gdb_remote_debugging = true
Run with:
  --wasm-gdb-remote                  Enables Wasm debugging with LLDB
                                     (default: false)
  --wasm-gdb-remote-port             TCP port to be used for debugging
                                     (default: 8765)
  --wasm-pause-waiting-for-debugger  Pauses the execution of Wasm code waiting
                                     for a debugger (default: false)
  --trace-wasm-gdb-remote            Enables tracing of Gdb-remote packets
                                     (default: false)

Note that most of this code is "borrowed" from the code of the Chromium NaCL
GDB-remote stub (located in Chromium in src\native_client\src\trusted\debug_stub).

Implementation details:
- class GdbServer acts as a singleton manager for the gdb-remote stub. It is
  instantiated as soon as the first Wasm module is loaded in the Wasm engine.
- class GdbServerThread spawns the worker thread for the TCP connection.
- class Transport manages the socket connection, in a portable way.
- class Session represents a remote debugging session.
- class Target represents a debugging target and it’s the place where the
  debugging packets will be processed and will implement the logic to debug
  a Wasm engine.

Bug: chromium:1010467
Change-Id: Ib2324e5901f5ae1d855b96b99ef0995d407322b6
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1923407
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Commit-Queue: Paolo Severini <paolosev@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#66379}
2020-02-20 22:27:58 +00:00
Clemens Backes
93d3527948 [wasm] Refactor debug side table
This refactors the debug side table such that we can easily add
register information later.
In particular
- vectors for types and stack offsets are combined into one;
- constants are stored in the same vector;
- locals and operand stack values are stored in the same vector.

A follow-up CL will extend the DebugSideTable to also encode locals
or operand stack values held in registers.

R=thibaudm@chromium.org

Bug: v8:10147, v8:10222
Change-Id: I97adb56b31afdb22896530c7ba2e8a24b5d31da9
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2062405
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Thibaud Michaud <thibaudm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66374}
2020-02-20 16:17:06 +00:00
Clemens Backes
3e3deb4bdf [wasm] Fix name used for code logging
Different loggers had different logic to handle unnamed wasm functions.
This CL makes sure that we always set a reasonable name when logging
wasm code, and removes handling for unnamed code in individual loggers.

Since logging only happens on user action, the code is not optimized for
performance (i.e. we always just write to a {std::string}, even if the
length of the string is known to be limited).

R=jkummerow@chromium.org

Bug: chromium:863205
Change-Id: I941f7e8050c97dc938afd7883aaeb3b6347b762d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2064977
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66370}
2020-02-20 13:50:38 +00:00
Thibaud Michaud
9457f48eb4 [wasm] Add missing mutex guard for tier down flag
R=clemensb@chromium.org

Bug: v8:10245
Change-Id: If99608d12034c241c37e8b0b345e92dce8847b9f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2064976
Commit-Queue: Thibaud Michaud <thibaudm@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66366}
2020-02-20 11:27:29 +00:00
Clemens Backes
1403fd7deb [wasm] Avoid unnecessary jump tables
If multiple code spaces are created, each of them currently gets its own
jump table (on 64 bit platforms). Since we try to allocate new code
spaces right after existing ones, this is often not necessary. We could
instead reuse the existing jump table(s).
This saves code space for the unneeded jump tables and avoid the cost of
patching the redundant jump tables when we replace code objects.

This CL implements this by checking whether an existing jump table (or
pair of far jump table and (near) jump table) fully covers a new code
space, and reuses the existing jump table in that case.

R=ahaas@chromium.org

Change-Id: Id8751b9c4036cf8f85f9baa2b0be8b2cfb5716ff
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2043846
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66364}
2020-02-20 10:21:08 +00:00
Michael Achenbach
43accc8b7f Revert "[wasm] The name of a custom section can cause a validation error"
This reverts commit 03d5a7ba9b.

Reason for revert: Needs rebaseline:
https://ci.chromium.org/p/v8/builders/ci/V8%20Blink%20Linux/3243

Original change's description:
> [wasm] The name of a custom section can cause a validation error
> 
> The WebAssembly spec defines that the name of a custom section can cause
> a validation error. The streaming decoder, however, used a separate
> Decoder object to decode the name, and thereby avoided a validation
> error. With this CL the streaming decoder uses the main decoder to
> decode the name of the custom section.
> 
> In addition this CL removes the test mjsunit/regress/wasm/regress-789952.
> This test defined an invalid WebAssembly module and expected it to
> compile. As it is a regression test, it makes no sense to fix the test.
> The module is invalid because it defines the length of the custom section
> to be '0', so there are no bytes in the custom section for its name.
> 
> R=​clemensb@chromium.org
> CC=​thibaudm@chromium.org
> 
> Bug: v8:10126
> Change-Id: I8cfc77c9a5916570d5362d5922e0179a29774da8
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2041446
> Commit-Queue: Andreas Haas <ahaas@chromium.org>
> Reviewed-by: Clemens Backes <clemensb@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#66348}

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

Change-Id: I5a7ea265ce47b9e685a5056bb83db6dc58f774a9
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: v8:10126
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2065168
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66356}
2020-02-19 21:38:28 +00:00
Thibaud Michaud
c0de0ef311 [liftoff][debug] Update stack on new Liftoff code
After compiling a function with a different set of breakpoints, update
return addresses on the stack so that execution resumes in the new
code.
This allows new breakpoints to take effect immediately, which is the
expected behavior and a prerequisite for stepping.

R=clemensb@chromium.org

Bug: v8:10147
Change-Id: I67eb3b4ce23a1f3b0519935447f8b847ec888ead
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2064218
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Thibaud Michaud <thibaudm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66351}
2020-02-19 18:43:35 +00:00
Thibaud Michaud
e287b61fa3 [liftoff][debug] Add source positions after calls
To fully support debugging in Liftoff, we need to OSR active frames by
updating their return address. Introducing source positions after
each call will help us find the correct return address in the new code.

R=clemensb@chromium.org

Bug: v8:10147
Change-Id: I0a97fa86929c471abb4cd1ed75ac6724fc385944
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2064216
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Thibaud Michaud <thibaudm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66350}
2020-02-19 18:41:35 +00:00
Andreas Haas
03d5a7ba9b [wasm] The name of a custom section can cause a validation error
The WebAssembly spec defines that the name of a custom section can cause
a validation error. The streaming decoder, however, used a separate
Decoder object to decode the name, and thereby avoided a validation
error. With this CL the streaming decoder uses the main decoder to
decode the name of the custom section.

In addition this CL removes the test mjsunit/regress/wasm/regress-789952.
This test defined an invalid WebAssembly module and expected it to
compile. As it is a regression test, it makes no sense to fix the test.
The module is invalid because it defines the length of the custom section
to be '0', so there are no bytes in the custom section for its name.

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

Bug: v8:10126
Change-Id: I8cfc77c9a5916570d5362d5922e0179a29774da8
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2041446
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66348}
2020-02-19 18:39:25 +00:00
Zhao Jiazhong
bdaa7d66a3 [mips][wasm-simd][liftoff] Implement i16x8.splat
Port 59e9689 https://crrev.com/c/2036739

Change-Id: Ie90aa9afffe36938a97b06947db136dda7e2b840
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2063194
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Auto-Submit: Zhao Jiazhong <zhaojiazhong-hf@loongson.cn>
Reviewed-by: Zhi An Ng <zhin@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66328}
2020-02-19 09:20:14 +00:00
Ng Zhi An
35afef8676 [liftoff][wasm-simd] Implement i16x8.splat on arm and arm64
This is the same as codegen used in TurboFan, with the registers being
referred to in a different way.

Bug: v8:9909
Change-Id: I082caabc49d6adb367b103a77e44a4e6e1be0ac1
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2060265
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Deepti Gandluri <gdeepti@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66324}
2020-02-19 00:45:54 +00:00
Z Nguyen-Huu
e9036451af [wasm] Keep new module in tiered down upon "debugger.enable"
Store a flag per isolate whether new modules should be kept in
tiered-down state from the beginning. Adjust initial compilation if flag
is set.

Bug: v8:9654
Change-Id: I5aae435fb807f3eaa7efafe9af60451ad3c7e14d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2028452
Commit-Queue: Z Nguyen-Huu <duongn@microsoft.com>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66321}
2020-02-18 19:52:18 +00:00
Milad Farazmand
2a93685028 PPC/s390: [wasm-simd][liftoff] Implement i16x8.splat on X64 and IA32
Port 59e96890e8

R=zhiguo.zhou@intel.com, joransiu@ca.ibm.com, jyan@ca.ibm.com, michael_dawson@ca.ibm.com
BUG=
LOG=N

Change-Id: I01be626d6017d0d76daffc281f64352e3b8ead2b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2062248
Reviewed-by: Junliang Yan <jyan@ca.ibm.com>
Commit-Queue: Milad Farazmand <miladfar@ca.ibm.com>
Cr-Commit-Position: refs/heads/master@{#66310}
2020-02-18 15:22:48 +00:00
Zhou, Zhiguo
59e96890e8 [wasm-simd][liftoff] Implement i16x8.splat on X64 and IA32
Bug: v8:9909
Change-Id: Ia74282eab46335235cf4f0e55589af3fcc836d9e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2036739
Reviewed-by: Zhi An Ng <zhin@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Zhiguo Zhou <zhiguo.zhou@intel.com>
Cr-Commit-Position: refs/heads/master@{#66300}
2020-02-18 01:32:27 +00:00
Emanuel Ziegler
de17316ad2 [wasm][reference-types] Implement declarative segments
Implement the latest spec changes:
  - Allow declarative segments to behave like passive & dropped segments.
  - Enforce that only declared functions may be returned or used in globals
    as funcref.
  - Ensure that table fill does not modify any entries if OOB.

Spec tests for select and br_table are still failing due to proposal issue

Bug: v8:10156

R=ahaas@chromium.org

Change-Id: I5b95be36a67bc7482a84b848908cc4cbdf94af03
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2027458
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Commit-Queue: Emanuel Ziegler <ecmziegler@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66297}
2020-02-17 17:38:27 +00:00
Z Nguyen-Huu
0439220c36 [wasm] Add callback inside initializing recompilation
This is to fix the hang (rarely happen). The potential root cause is
that before initialing recompilation, the recompilation callback is
added and then already cleared out by other running threads from initial
compilation.

Bug: v8:10086, v8:9654
Change-Id: I769bac621cce4611ccde1f0998b0f2bc0e9c04cf
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2053248
Commit-Queue: Z Nguyen-Huu <duongn@microsoft.com>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66295}
2020-02-17 16:19:57 +00:00
Georgia Kouveli
9001b90f70 [wasm] Remove leftover src/wasm/wasm-memory.cc file
Change-Id: Ied0ee7f9c343dc802dec53c3d717a0ca359b504b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2050398
Reviewed-by: Deepti Gandluri <gdeepti@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Georgia Kouveli <georgia.kouveli@arm.com>
Cr-Commit-Position: refs/heads/master@{#66269}
2020-02-14 10:56:15 +00:00
Thibaud Michaud
80c7ab4d77 [wasm] Fix streaming compilation prefix hash
The previous code was relying on {compilation_unit_builder_} to check if
a section was after or before the code section. This only works for the
first section after code section, since the compilation unit builder is
then reset. Use an additional field to track this instead.

R=clemensb@chromium.org

Bug: chromium:1051912
Change-Id: Id1dfa803ecde2cf77f206ea781c007fc61168942
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2054099
Commit-Queue: Thibaud Michaud <thibaudm@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66265}
2020-02-13 20:53:17 +00:00
Milad Farazmand
3b55a6c89c [wasm-simd] Fix LoadTransform on BE architectures
LoadTransform cannot efficiently be executed on BE machines as a
single operation since loaded bytes need to be reversed to
match BE ordering before any operations can take place.

This CL divides LoadTransform into separate "load" and "operation"
nodes on BE machines.

Change-Id: Idc3f66d7f17647c189c75593e8906f8645448006
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2050811
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@{#66264}
2020-02-13 20:15:57 +00:00
Leszek Swirski
2201516f8f [cleanup] Clean-up CAS loops
Clean-up a couple of CAS loops to avoid loading after a compare_exchange
(which updates the old value), and to loosen the memory ordering to
acquire-release to avoid unnecessary fences.

Change-Id: Ifb8e5e5136f687ca5a71417a5d131a7023add054
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2050390
Auto-Submit: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66235}
2020-02-12 11:05:14 +00:00
Pierre Langlois
86d4b9f6ca [codegen][cleanup] Unify assembler's support for DebugBreak().
Each assembler has it's own way to place breakpoints:

  - stop() for arm, mips*, ppc* and s390.
  - debug() for arm64.
  - int3() for ia32 and x64.

We can mandate a macro-assembler `DebugBreak()` method that all should
implement so one can place a breakpoint in a portable way using a
macro-assembler. This way also assemblers are in line with TurboFan, CSA, Torque
and Liftoff which all have a DebugBreak() facility.

Change-Id: Ic4332bd19ca4db53e01441d54af6632c2c1189f1
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2020954
Reviewed-by: Ross McIlroy <rmcilroy@chromium.org>
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Commit-Queue: Pierre Langlois <pierre.langlois@arm.com>
Cr-Commit-Position: refs/heads/master@{#66198}
2020-02-10 13:39:33 +00:00
Emanuel Ziegler
d25872d51d [wasm] Use lookup-tables for ValueTypes static methods
Improve performance of switch statements by using constexpr lookup
tables wherever possible.

Bug: chromium:1042868

R=clemensb@chromium.org

Change-Id: I8a44bd8022d1c4e3a74243e3657498a2bc49ff64
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2041448
Commit-Queue: Emanuel Ziegler <ecmziegler@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66171}
2020-02-07 12:21:10 +00:00
Z Nguyen-Huu
1f7861c8a9 Reland "[wasm] Tierdown wasm module upon "Debugger.enable""
This is a reland of 410ca4c50e

Skip new test for unsupported liftoff architecture.
Previously, if there is some unsupported liftoff functions, it fall
through Turbofan but recompilation didn't catch and count it. This CL
fixes it by using requested_tier on finished units.

Avoid to tier down asm.js.
Introduce reached recompilation tier to monitor recompilation progress.

Original change's description:
> [wasm] Tierdown wasm module upon "Debugger.enable"
>
> Put a logic in Wasm Engine to tier down all existing modules per isolate
> when debugger is enabled. This CL does not handle new module added after
> debugger is enabled yet.
>
> Bug: v8:9654
> Change-Id: I87060f5c416506543fcaf231bff9999d06ba4c0d
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2013692
> Commit-Queue: Z Nguyen-Huu <duongn@microsoft.com>
> Reviewed-by: Simon Zünd <szuend@chromium.org>
> Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
> Reviewed-by: Clemens Backes <clemensb@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#66017}

TBR=szuend@chromium.org,bmeurer@chromium.org

Bug: v8:9654
Change-Id: I6014ae52d1e04726e64ee9267c5ce559090414d7
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2031744
Commit-Queue: Z Nguyen-Huu <duongn@microsoft.com>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66164}
2020-02-06 23:47:06 +00:00
Thibaud Michaud
9c44330d86 [wasm] Add some DCHECKs to the native module cache
And fix a few issues that were already found.

R=clemensb@chromium.org

Change-Id: Ib93626751220dcdd2b9647a6e352bd86bd0ef1ef
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2039053
Commit-Queue: Thibaud Michaud <thibaudm@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66155}
2020-02-06 15:28:14 +00:00