1From 1523e00a2a76e285262c8aa3721b5d99f3f2d612 Mon Sep 17 00:00:00 2001
2From: Thomas Devoogdt <thomas.devoogdt@barco.com>
3Date: Mon, 16 Jan 2023 17:03:30 +0100
4Subject: [PATCH] REGRESSION(257865@main): B3Validate.cpp: fix
5
6 !ENABLE(WEBASSEMBLY_B3JIT)
7
8https://bugs.webkit.org/show_bug.cgi?id=250681
9
10Reviewed by NOBODY (OOPS!).
11
12WasmTypeDefinition.h isn't included if not ENABLE(WEBASSEMBLY_B3JIT).
13Also, toB3Type and simdScalarType are not defined if it is included.
14
15Signed-off-by: Thomas Devoogdt <thomas.devoogdt@barco.com>
16
17Upstream-Status: Inappropriate [https://bugs.launchpad.net/ubuntu/+source/webkit2gtk/+bug/2008798]
18---
19 Source/JavaScriptCore/b3/B3Validate.cpp | 12 +++++++++---
20 1 file changed, 9 insertions(+), 3 deletions(-)
21
22diff --git a/Source/JavaScriptCore/b3/B3Validate.cpp b/Source/JavaScriptCore/b3/B3Validate.cpp
23index eaaa3749..1d089783 100644
24--- a/Source/JavaScriptCore/b3/B3Validate.cpp
25+++ b/Source/JavaScriptCore/b3/B3Validate.cpp
26@@ -47,6 +47,12 @@
27 #include <wtf/StringPrintStream.h>
28 #include <wtf/text/CString.h>
29
30+#if ENABLE(WEBASSEMBLY) && ENABLE(WEBASSEMBLY_B3JIT)
31+#define simdScalarTypeToB3Type(type) toB3Type(Wasm::simdScalarType(type))
32+#else
33+#define simdScalarTypeToB3Type(type) B3::Type()
34+#endif
35+
36 namespace JSC { namespace B3 {
37
38 namespace {
39@@ -454,7 +460,7 @@ public:
40             case VectorExtractLane:
41                 VALIDATE(!value->kind().hasExtraBits(), ("At ", *value));
42                 VALIDATE(value->numChildren() == 1, ("At ", *value));
43-                VALIDATE(value->type() == toB3Type(Wasm::simdScalarType(value->asSIMDValue()->simdLane())), ("At ", *value));
44+                VALIDATE(value->type() == simdScalarTypeToB3Type(value->asSIMDValue()->simdLane()), ("At ", *value));
45                 VALIDATE(value->child(0)->type() == V128, ("At ", *value));
46                 break;
47             case VectorReplaceLane:
48@@ -462,7 +468,7 @@ public:
49                 VALIDATE(value->numChildren() == 2, ("At ", *value));
50                 VALIDATE(value->type() == V128, ("At ", *value));
51                 VALIDATE(value->child(0)->type() == V128, ("At ", *value));
52-                VALIDATE(value->child(1)->type() == toB3Type(Wasm::simdScalarType(value->asSIMDValue()->simdLane())), ("At ", *value));
53+                VALIDATE(value->child(1)->type() == simdScalarTypeToB3Type(value->asSIMDValue()->simdLane()), ("At ", *value));
54                 break;
55             case VectorDupElement:
56                 VALIDATE(!value->kind().hasExtraBits(), ("At ", *value));
57@@ -484,7 +490,7 @@ public:
58                 VALIDATE(!value->kind().hasExtraBits(), ("At ", *value));
59                 VALIDATE(value->numChildren() == 1, ("At ", *value));
60                 VALIDATE(value->type() == V128, ("At ", *value));
61-                VALIDATE(value->child(0)->type() == toB3Type(Wasm::simdScalarType(value->asSIMDValue()->simdLane())), ("At ", *value));
62+                VALIDATE(value->child(0)->type() == simdScalarTypeToB3Type(value->asSIMDValue()->simdLane()), ("At ", *value));
63                 break;
64
65             case VectorPopcnt:
66