Commit 6735d74a authored by Clemens Backes's avatar Clemens Backes Committed by V8 LUCI CQ

Revert "[test][wasm] Increase coverage for value types in signature"

This reverts commit cd617a58.

Reason for revert: SIMD needs to be skipped if not supported: https://ci.chromium.org/ui/p/v8/builders/ci/V8%20Linux/47699/overview

Original change's description:
> [test][wasm] Increase coverage for value types in signature
>
> Change-Id: I19105432a71b5850264624c23d7bb732193100f3
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3791046
> Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
> Auto-Submit: Matthias Liedtke <mliedtke@chromium.org>
> Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#82071}

Change-Id: I0dc0cd479a2396ac65a14550468254eb5c5c7484
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3793398
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Auto-Submit: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/main@{#82075}
parent 044a18ac
......@@ -207,11 +207,11 @@ size_t ModuleDecoder::IdentifyUnknownSection(ModuleDecoder* decoder,
bool ModuleDecoder::ok() { return impl_->ok(); }
Result<const FunctionSig*> DecodeWasmSignatureForTesting(
const WasmFeatures& enabled, Zone* zone, const byte* start,
const byte* end) {
const FunctionSig* DecodeWasmSignatureForTesting(const WasmFeatures& enabled,
Zone* zone, const byte* start,
const byte* end) {
ModuleDecoderImpl decoder(enabled, start, end, kWasmOrigin);
return decoder.toResult(decoder.DecodeFunctionSignature(zone, start));
return decoder.DecodeFunctionSignature(zone, start);
}
ConstantExpression DecodeWasmInitExprForTesting(const WasmFeatures& enabled,
......
......@@ -97,8 +97,8 @@ V8_EXPORT_PRIVATE ModuleResult DecodeWasmModuleForDisassembler(
AccountingAllocator* allocator);
// Exposed for testing. Decodes a single function signature, allocating it
// in the given zone.
V8_EXPORT_PRIVATE Result<const FunctionSig*> DecodeWasmSignatureForTesting(
// in the given zone. Returns {nullptr} upon failure.
V8_EXPORT_PRIVATE const FunctionSig* DecodeWasmSignatureForTesting(
const WasmFeatures& enabled, Zone* zone, const byte* start,
const byte* end);
......
......@@ -182,23 +182,13 @@ struct ValueTypePair {
uint8_t code;
ValueType type;
} kValueTypes[] = {
{kI32Code, kWasmI32}, // --
{kI64Code, kWasmI64}, // --
{kF32Code, kWasmF32}, // --
{kF64Code, kWasmF64}, // --
{kFuncRefCode, kWasmFuncRef}, // --
{kExternRefCode, kWasmExternRef}, // --
{kAnyRefCode, kWasmAnyRef}, // --
{kS128Code, kWasmS128}, // --
{kEqRefCode, kWasmEqRef}, // --
{kI31RefCode, kWasmI31Ref}, // --
{kDataRefCode, kWasmDataRef}, // --
{kArrayRefCode, kWasmArrayRef}, // --
{kNoneCode, kWasmNullRef}, // --
{kStringRefCode, kWasmStringRef}, // --
{kStringViewWtf8Code, kWasmStringViewWtf8}, // --
{kStringViewWtf16Code, kWasmStringViewWtf16}, // --
{kStringViewIterCode, kWasmStringViewIter}, // --
// TODO(mliedtke): Cover other value types as well.
{kI32Code, kWasmI32}, // --
{kI64Code, kWasmI64}, // --
{kF32Code, kWasmF32}, // --
{kF64Code, kWasmF64}, // --
{kFuncRefCode, kWasmFuncRef}, // --
{kExternRefCode, kWasmExternRef}, // --
};
class WasmModuleVerifyTest : public TestWithIsolateAndZone {
......@@ -2225,20 +2215,7 @@ class WasmSignatureDecodeTest : public TestWithZone {
WasmFeatures enabled_features_ = WasmFeatures::None();
const FunctionSig* DecodeSig(const byte* start, const byte* end) {
Result<const FunctionSig*> res =
DecodeWasmSignatureForTesting(enabled_features_, zone(), start, end);
EXPECT_TRUE(res.ok()) << res.error().message() << " at offset "
<< res.error().offset();
return res.ok() ? res.value() : nullptr;
}
testing::AssertionResult DecodeSigError(const byte* start, const byte* end) {
Result<const FunctionSig*> res =
DecodeWasmSignatureForTesting(enabled_features_, zone(), start, end);
if (res.ok()) {
return testing::AssertionFailure() << "unexpected valid signature";
}
return testing::AssertionSuccess();
return DecodeWasmSignatureForTesting(enabled_features_, zone(), start, end);
}
};
......@@ -2254,10 +2231,6 @@ TEST_F(WasmSignatureDecodeTest, Ok_v_v) {
}
TEST_F(WasmSignatureDecodeTest, Ok_t_v) {
WASM_FEATURE_SCOPE(gc);
WASM_FEATURE_SCOPE(simd);
WASM_FEATURE_SCOPE(typed_funcref);
WASM_FEATURE_SCOPE(stringref);
for (size_t i = 0; i < arraysize(kValueTypes); i++) {
ValueTypePair ret_type = kValueTypes[i];
const byte data[] = {SIG_ENTRY_x(ret_type.code)};
......@@ -2272,10 +2245,6 @@ TEST_F(WasmSignatureDecodeTest, Ok_t_v) {
}
TEST_F(WasmSignatureDecodeTest, Ok_v_t) {
WASM_FEATURE_SCOPE(gc);
WASM_FEATURE_SCOPE(simd);
WASM_FEATURE_SCOPE(typed_funcref);
WASM_FEATURE_SCOPE(stringref);
for (size_t i = 0; i < arraysize(kValueTypes); i++) {
ValueTypePair param_type = kValueTypes[i];
const byte data[] = {SIG_ENTRY_v_x(param_type.code)};
......@@ -2290,10 +2259,6 @@ TEST_F(WasmSignatureDecodeTest, Ok_v_t) {
}
TEST_F(WasmSignatureDecodeTest, Ok_t_t) {
WASM_FEATURE_SCOPE(gc);
WASM_FEATURE_SCOPE(simd);
WASM_FEATURE_SCOPE(typed_funcref);
WASM_FEATURE_SCOPE(stringref);
for (size_t i = 0; i < arraysize(kValueTypes); i++) {
ValueTypePair ret_type = kValueTypes[i];
for (size_t j = 0; j < arraysize(kValueTypes); j++) {
......@@ -2312,10 +2277,6 @@ TEST_F(WasmSignatureDecodeTest, Ok_t_t) {
}
TEST_F(WasmSignatureDecodeTest, Ok_i_tt) {
WASM_FEATURE_SCOPE(gc);
WASM_FEATURE_SCOPE(simd);
WASM_FEATURE_SCOPE(typed_funcref);
WASM_FEATURE_SCOPE(stringref);
for (size_t i = 0; i < arraysize(kValueTypes); i++) {
ValueTypePair p0_type = kValueTypes[i];
for (size_t j = 0; j < arraysize(kValueTypes); j++) {
......@@ -2336,10 +2297,6 @@ TEST_F(WasmSignatureDecodeTest, Ok_i_tt) {
}
TEST_F(WasmSignatureDecodeTest, Ok_tt_tt) {
WASM_FEATURE_SCOPE(gc);
WASM_FEATURE_SCOPE(simd);
WASM_FEATURE_SCOPE(typed_funcref);
WASM_FEATURE_SCOPE(stringref);
for (size_t i = 0; i < arraysize(kValueTypes); i++) {
ValueTypePair p0_type = kValueTypes[i];
for (size_t j = 0; j < arraysize(kValueTypes); j++) {
......@@ -2365,14 +2322,16 @@ TEST_F(WasmSignatureDecodeTest, TooManyParams) {
static const byte data[] = {kWasmFunctionTypeCode,
WASM_I32V_3(kV8MaxWasmFunctionParams + 1),
kI32Code, 0};
EXPECT_TRUE(DecodeSigError(data, data + sizeof(data)));
const FunctionSig* sig = DecodeSig(data, data + sizeof(data));
EXPECT_FALSE(sig != nullptr);
}
TEST_F(WasmSignatureDecodeTest, TooManyReturns) {
for (int i = 0; i < 2; i++) {
byte data[] = {kWasmFunctionTypeCode, 0,
WASM_I32V_3(kV8MaxWasmFunctionReturns + 1), kI32Code};
EXPECT_TRUE(DecodeSigError(data, data + sizeof(data)));
const FunctionSig* sig = DecodeSig(data, data + sizeof(data));
EXPECT_EQ(nullptr, sig);
}
}
......@@ -2384,7 +2343,8 @@ TEST_F(WasmSignatureDecodeTest, Fail_off_end) {
for (int i = 0; i < p + 1; i++) {
// Should fall off the end for all signatures.
EXPECT_TRUE(DecodeSigError(data, data + sizeof(data)));
const FunctionSig* sig = DecodeSig(data, data + i);
EXPECT_EQ(nullptr, sig);
}
}
}
......@@ -2395,23 +2355,27 @@ TEST_F(WasmSignatureDecodeTest, Fail_invalid_type) {
byte data[] = {SIG_ENTRY_x_xx(kI32Code, kI32Code, kI32Code)};
if (i >= arraysize(data)) break;
data[i] = kInvalidType;
EXPECT_TRUE(DecodeSigError(data, data + sizeof(data)));
const FunctionSig* sig = DecodeSig(data, data + sizeof(data));
EXPECT_EQ(nullptr, sig);
}
}
TEST_F(WasmSignatureDecodeTest, Fail_invalid_ret_type1) {
static const byte data[] = {SIG_ENTRY_x_x(kVoidCode, kI32Code)};
EXPECT_TRUE(DecodeSigError(data, data + sizeof(data)));
const FunctionSig* sig = DecodeSig(data, data + sizeof(data));
EXPECT_EQ(nullptr, sig);
}
TEST_F(WasmSignatureDecodeTest, Fail_invalid_param_type1) {
static const byte data[] = {SIG_ENTRY_x_x(kI32Code, kVoidCode)};
EXPECT_TRUE(DecodeSigError(data, data + sizeof(data)));
const FunctionSig* sig = DecodeSig(data, data + sizeof(data));
EXPECT_EQ(nullptr, sig);
}
TEST_F(WasmSignatureDecodeTest, Fail_invalid_param_type2) {
static const byte data[] = {SIG_ENTRY_x_xx(kI32Code, kI32Code, kVoidCode)};
EXPECT_TRUE(DecodeSigError(data, data + sizeof(data)));
const FunctionSig* sig = DecodeSig(data, data + sizeof(data));
EXPECT_EQ(nullptr, sig);
}
class WasmFunctionVerifyTest : public TestWithIsolateAndZone {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment