Commit 90c7d8ab authored by Peter Kasting's avatar Peter Kasting Committed by V8 LUCI CQ

Fix -Wc++11-narrowing in V8.

Bug: chromium:1216696
Change-Id: I0918215c2e2b845bd7b39e06128d74382a467b05
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2950262
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Auto-Submit: Peter Kasting <pkasting@chromium.org>
Reviewed-by: 's avatarManos Koukoutos <manoskouk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#75062}
parent ca0cde89
...@@ -74,7 +74,7 @@ class StreamTester { ...@@ -74,7 +74,7 @@ class StreamTester {
}; };
// Create a valid module such that the bytes depend on {n}. // Create a valid module such that the bytes depend on {n}.
ZoneBuffer GetValidModuleBytes(Zone* zone, int n) { ZoneBuffer GetValidModuleBytes(Zone* zone, uint8_t n) {
ZoneBuffer buffer(zone); ZoneBuffer buffer(zone);
TestSignatures sigs; TestSignatures sigs;
WasmModuleBuilder builder(zone); WasmModuleBuilder builder(zone);
......
...@@ -447,19 +447,19 @@ void TestTableInitElems(TestExecutionTier execution_tier, int table_index) { ...@@ -447,19 +447,19 @@ void TestTableInitElems(TestExecutionTier execution_tier, int table_index) {
// Test actual writes. // Test actual writes.
r.CheckCallViaJS(0, 0, 0, 1); r.CheckCallViaJS(0, 0, 0, 1);
CheckTableCall(isolate, table, &r, call_index, 0, null, null, null, null); CheckTableCall(isolate, table, &r, call_index, 0.0, null, null, null, null);
r.CheckCallViaJS(0, 0, 0, 2); r.CheckCallViaJS(0, 0, 0, 2);
CheckTableCall(isolate, table, &r, call_index, 0, 1, null, null, null); CheckTableCall(isolate, table, &r, call_index, 0.0, 1.0, null, null, null);
r.CheckCallViaJS(0, 0, 0, 3); r.CheckCallViaJS(0, 0, 0, 3);
CheckTableCall(isolate, table, &r, call_index, 0, 1, 2, null, null); CheckTableCall(isolate, table, &r, call_index, 0.0, 1.0, 2.0, null, null);
r.CheckCallViaJS(0, 3, 0, 2); r.CheckCallViaJS(0, 3, 0, 2);
CheckTableCall(isolate, table, &r, call_index, 0, 1, 2, 0, 1); CheckTableCall(isolate, table, &r, call_index, 0.0, 1.0, 2.0, 0.0, 1.0);
r.CheckCallViaJS(0, 3, 1, 2); r.CheckCallViaJS(0, 3, 1, 2);
CheckTableCall(isolate, table, &r, call_index, 0, 1, 2, 1, 2); CheckTableCall(isolate, table, &r, call_index, 0.0, 1.0, 2.0, 1.0, 2.0);
r.CheckCallViaJS(0, 3, 2, 2); r.CheckCallViaJS(0, 3, 2, 2);
CheckTableCall(isolate, table, &r, call_index, 0, 1, 2, 2, 3); CheckTableCall(isolate, table, &r, call_index, 0.0, 1.0, 2.0, 2.0, 3.0);
r.CheckCallViaJS(0, 3, 3, 2); r.CheckCallViaJS(0, 3, 3, 2);
CheckTableCall(isolate, table, &r, call_index, 0, 1, 2, 3, 4); CheckTableCall(isolate, table, &r, call_index, 0.0, 1.0, 2.0, 3.0, 4.0);
} }
WASM_COMPILED_EXEC_TEST(TableInitElems0) { WASM_COMPILED_EXEC_TEST(TableInitElems0) {
...@@ -670,21 +670,21 @@ void TestTableCopyCalls(TestExecutionTier execution_tier, int table_dst, ...@@ -670,21 +670,21 @@ void TestTableCopyCalls(TestExecutionTier execution_tier, int table_dst,
isolate); isolate);
if (table_dst == table_src) { if (table_dst == table_src) {
CheckTableCall(isolate, table, &r, call_index, 0, 1, 2, 3, 4); CheckTableCall(isolate, table, &r, call_index, 0.0, 1.0, 2.0, 3.0, 4.0);
r.CheckCallViaJS(0, 0, 1, 1); r.CheckCallViaJS(0, 0, 1, 1);
CheckTableCall(isolate, table, &r, call_index, 1, 1, 2, 3, 4); CheckTableCall(isolate, table, &r, call_index, 1.0, 1.0, 2.0, 3.0, 4.0);
r.CheckCallViaJS(0, 0, 1, 2); r.CheckCallViaJS(0, 0, 1, 2);
CheckTableCall(isolate, table, &r, call_index, 1, 2, 2, 3, 4); CheckTableCall(isolate, table, &r, call_index, 1.0, 2.0, 2.0, 3.0, 4.0);
r.CheckCallViaJS(0, 3, 0, 2); r.CheckCallViaJS(0, 3, 0, 2);
CheckTableCall(isolate, table, &r, call_index, 1, 2, 2, 1, 2); CheckTableCall(isolate, table, &r, call_index, 1.0, 2.0, 2.0, 1.0, 2.0);
} else { } else {
CheckTableCall(isolate, table, &r, call_index, 0, 1, 2, 3, 4); CheckTableCall(isolate, table, &r, call_index, 0.0, 1.0, 2.0, 3.0, 4.0);
r.CheckCallViaJS(0, 0, 1, 1); r.CheckCallViaJS(0, 0, 1, 1);
CheckTableCall(isolate, table, &r, call_index, 1, 1, 2, 3, 4); CheckTableCall(isolate, table, &r, call_index, 1.0, 1.0, 2.0, 3.0, 4.0);
r.CheckCallViaJS(0, 0, 1, 2); r.CheckCallViaJS(0, 0, 1, 2);
CheckTableCall(isolate, table, &r, call_index, 1, 2, 2, 3, 4); CheckTableCall(isolate, table, &r, call_index, 1.0, 2.0, 2.0, 3.0, 4.0);
r.CheckCallViaJS(0, 3, 0, 2); r.CheckCallViaJS(0, 3, 0, 2);
CheckTableCall(isolate, table, &r, call_index, 1, 2, 2, 0, 1); CheckTableCall(isolate, table, &r, call_index, 1.0, 2.0, 2.0, 0.0, 1.0);
} }
} }
......
...@@ -16,7 +16,7 @@ WASM_EXEC_TEST(TryCatchThrow) { ...@@ -16,7 +16,7 @@ WASM_EXEC_TEST(TryCatchThrow) {
TestSignatures sigs; TestSignatures sigs;
EXPERIMENTAL_FLAG_SCOPE(eh); EXPERIMENTAL_FLAG_SCOPE(eh);
WasmRunner<uint32_t, uint32_t> r(execution_tier); WasmRunner<uint32_t, uint32_t> r(execution_tier);
uint32_t except = r.builder().AddException(sigs.v_v()); byte except = r.builder().AddException(sigs.v_v());
constexpr uint32_t kResult0 = 23; constexpr uint32_t kResult0 = 23;
constexpr uint32_t kResult1 = 42; constexpr uint32_t kResult1 = 42;
...@@ -41,7 +41,7 @@ WASM_EXEC_TEST(TryCatchThrowWithValue) { ...@@ -41,7 +41,7 @@ WASM_EXEC_TEST(TryCatchThrowWithValue) {
TestSignatures sigs; TestSignatures sigs;
EXPERIMENTAL_FLAG_SCOPE(eh); EXPERIMENTAL_FLAG_SCOPE(eh);
WasmRunner<uint32_t, uint32_t> r(execution_tier); WasmRunner<uint32_t, uint32_t> r(execution_tier);
uint32_t except = r.builder().AddException(sigs.v_i()); byte except = r.builder().AddException(sigs.v_i());
constexpr uint32_t kResult0 = 23; constexpr uint32_t kResult0 = 23;
constexpr uint32_t kResult1 = 42; constexpr uint32_t kResult1 = 42;
...@@ -67,8 +67,8 @@ WASM_EXEC_TEST(TryMultiCatchThrow) { ...@@ -67,8 +67,8 @@ WASM_EXEC_TEST(TryMultiCatchThrow) {
TestSignatures sigs; TestSignatures sigs;
EXPERIMENTAL_FLAG_SCOPE(eh); EXPERIMENTAL_FLAG_SCOPE(eh);
WasmRunner<uint32_t, uint32_t> r(execution_tier); WasmRunner<uint32_t, uint32_t> r(execution_tier);
uint32_t except1 = r.builder().AddException(sigs.v_v()); byte except1 = r.builder().AddException(sigs.v_v());
uint32_t except2 = r.builder().AddException(sigs.v_v()); byte except2 = r.builder().AddException(sigs.v_v());
constexpr uint32_t kResult0 = 23; constexpr uint32_t kResult0 = 23;
constexpr uint32_t kResult1 = 42; constexpr uint32_t kResult1 = 42;
constexpr uint32_t kResult2 = 51; constexpr uint32_t kResult2 = 51;
...@@ -99,7 +99,7 @@ WASM_EXEC_TEST(TryCatchAllThrow) { ...@@ -99,7 +99,7 @@ WASM_EXEC_TEST(TryCatchAllThrow) {
TestSignatures sigs; TestSignatures sigs;
EXPERIMENTAL_FLAG_SCOPE(eh); EXPERIMENTAL_FLAG_SCOPE(eh);
WasmRunner<uint32_t, uint32_t> r(execution_tier); WasmRunner<uint32_t, uint32_t> r(execution_tier);
uint32_t except = r.builder().AddException(sigs.v_v()); byte except = r.builder().AddException(sigs.v_v());
constexpr uint32_t kResult0 = 23; constexpr uint32_t kResult0 = 23;
constexpr uint32_t kResult1 = 42; constexpr uint32_t kResult1 = 42;
...@@ -123,8 +123,8 @@ WASM_EXEC_TEST(TryCatchCatchAllThrow) { ...@@ -123,8 +123,8 @@ WASM_EXEC_TEST(TryCatchCatchAllThrow) {
TestSignatures sigs; TestSignatures sigs;
EXPERIMENTAL_FLAG_SCOPE(eh); EXPERIMENTAL_FLAG_SCOPE(eh);
WasmRunner<uint32_t, uint32_t> r(execution_tier); WasmRunner<uint32_t, uint32_t> r(execution_tier);
uint32_t except1 = r.builder().AddException(sigs.v_v()); byte except1 = r.builder().AddException(sigs.v_v());
uint32_t except2 = r.builder().AddException(sigs.v_v()); byte except2 = r.builder().AddException(sigs.v_v());
constexpr uint32_t kResult0 = 23; constexpr uint32_t kResult0 = 23;
constexpr uint32_t kResult1 = 42; constexpr uint32_t kResult1 = 42;
constexpr uint32_t kResult2 = 51; constexpr uint32_t kResult2 = 51;
...@@ -155,8 +155,8 @@ WASM_EXEC_TEST(TryImplicitRethrow) { ...@@ -155,8 +155,8 @@ WASM_EXEC_TEST(TryImplicitRethrow) {
TestSignatures sigs; TestSignatures sigs;
EXPERIMENTAL_FLAG_SCOPE(eh); EXPERIMENTAL_FLAG_SCOPE(eh);
WasmRunner<uint32_t, uint32_t> r(execution_tier); WasmRunner<uint32_t, uint32_t> r(execution_tier);
uint32_t except1 = r.builder().AddException(sigs.v_v()); byte except1 = r.builder().AddException(sigs.v_v());
uint32_t except2 = r.builder().AddException(sigs.v_v()); byte except2 = r.builder().AddException(sigs.v_v());
constexpr uint32_t kResult0 = 23; constexpr uint32_t kResult0 = 23;
constexpr uint32_t kResult1 = 42; constexpr uint32_t kResult1 = 42;
constexpr uint32_t kResult2 = 51; constexpr uint32_t kResult2 = 51;
...@@ -186,7 +186,7 @@ WASM_EXEC_TEST(TryDelegate) { ...@@ -186,7 +186,7 @@ WASM_EXEC_TEST(TryDelegate) {
TestSignatures sigs; TestSignatures sigs;
EXPERIMENTAL_FLAG_SCOPE(eh); EXPERIMENTAL_FLAG_SCOPE(eh);
WasmRunner<uint32_t, uint32_t> r(execution_tier); WasmRunner<uint32_t, uint32_t> r(execution_tier);
uint32_t except = r.builder().AddException(sigs.v_v()); byte except = r.builder().AddException(sigs.v_v());
constexpr uint32_t kResult0 = 23; constexpr uint32_t kResult0 = 23;
constexpr uint32_t kResult1 = 42; constexpr uint32_t kResult1 = 42;
...@@ -215,7 +215,7 @@ WASM_EXEC_TEST(TryUnwind) { ...@@ -215,7 +215,7 @@ WASM_EXEC_TEST(TryUnwind) {
TestSignatures sigs; TestSignatures sigs;
EXPERIMENTAL_FLAG_SCOPE(eh); EXPERIMENTAL_FLAG_SCOPE(eh);
WasmRunner<uint32_t, uint32_t> r(execution_tier); WasmRunner<uint32_t, uint32_t> r(execution_tier);
uint32_t except = r.builder().AddException(sigs.v_v()); byte except = r.builder().AddException(sigs.v_v());
constexpr uint32_t kResult0 = 23; constexpr uint32_t kResult0 = 23;
constexpr uint32_t kResult1 = 42; constexpr uint32_t kResult1 = 42;
...@@ -247,8 +247,8 @@ WASM_EXEC_TEST(TryCatchRethrow) { ...@@ -247,8 +247,8 @@ WASM_EXEC_TEST(TryCatchRethrow) {
TestSignatures sigs; TestSignatures sigs;
EXPERIMENTAL_FLAG_SCOPE(eh); EXPERIMENTAL_FLAG_SCOPE(eh);
WasmRunner<uint32_t, uint32_t> r(execution_tier); WasmRunner<uint32_t, uint32_t> r(execution_tier);
uint32_t except1 = r.builder().AddException(sigs.v_v()); byte except1 = r.builder().AddException(sigs.v_v());
uint32_t except2 = r.builder().AddException(sigs.v_v()); byte except2 = r.builder().AddException(sigs.v_v());
constexpr uint32_t kResult0 = 23; constexpr uint32_t kResult0 = 23;
constexpr uint32_t kResult1 = 42; constexpr uint32_t kResult1 = 42;
constexpr uint32_t kUnreachable = 51; constexpr uint32_t kUnreachable = 51;
...@@ -282,7 +282,7 @@ WASM_EXEC_TEST(TryDelegateToCaller) { ...@@ -282,7 +282,7 @@ WASM_EXEC_TEST(TryDelegateToCaller) {
TestSignatures sigs; TestSignatures sigs;
EXPERIMENTAL_FLAG_SCOPE(eh); EXPERIMENTAL_FLAG_SCOPE(eh);
WasmRunner<uint32_t, uint32_t> r(execution_tier); WasmRunner<uint32_t, uint32_t> r(execution_tier);
uint32_t except = r.builder().AddException(sigs.v_v()); byte except = r.builder().AddException(sigs.v_v());
constexpr uint32_t kResult0 = 23; constexpr uint32_t kResult0 = 23;
constexpr uint32_t kResult1 = 42; constexpr uint32_t kResult1 = 42;
...@@ -313,7 +313,7 @@ WASM_EXEC_TEST(TryCatchCallDirect) { ...@@ -313,7 +313,7 @@ WASM_EXEC_TEST(TryCatchCallDirect) {
TestSignatures sigs; TestSignatures sigs;
EXPERIMENTAL_FLAG_SCOPE(eh); EXPERIMENTAL_FLAG_SCOPE(eh);
WasmRunner<uint32_t, uint32_t> r(execution_tier); WasmRunner<uint32_t, uint32_t> r(execution_tier);
uint32_t except = r.builder().AddException(sigs.v_v()); byte except = r.builder().AddException(sigs.v_v());
constexpr uint32_t kResult0 = 23; constexpr uint32_t kResult0 = 23;
constexpr uint32_t kResult1 = 42; constexpr uint32_t kResult1 = 42;
...@@ -346,7 +346,7 @@ WASM_EXEC_TEST(TryCatchAllCallDirect) { ...@@ -346,7 +346,7 @@ WASM_EXEC_TEST(TryCatchAllCallDirect) {
TestSignatures sigs; TestSignatures sigs;
EXPERIMENTAL_FLAG_SCOPE(eh); EXPERIMENTAL_FLAG_SCOPE(eh);
WasmRunner<uint32_t, uint32_t> r(execution_tier); WasmRunner<uint32_t, uint32_t> r(execution_tier);
uint32_t except = r.builder().AddException(sigs.v_v()); byte except = r.builder().AddException(sigs.v_v());
constexpr uint32_t kResult0 = 23; constexpr uint32_t kResult0 = 23;
constexpr uint32_t kResult1 = 42; constexpr uint32_t kResult1 = 42;
...@@ -379,7 +379,7 @@ WASM_EXEC_TEST(TryCatchCallIndirect) { ...@@ -379,7 +379,7 @@ WASM_EXEC_TEST(TryCatchCallIndirect) {
TestSignatures sigs; TestSignatures sigs;
EXPERIMENTAL_FLAG_SCOPE(eh); EXPERIMENTAL_FLAG_SCOPE(eh);
WasmRunner<uint32_t, uint32_t> r(execution_tier); WasmRunner<uint32_t, uint32_t> r(execution_tier);
uint32_t except = r.builder().AddException(sigs.v_v()); byte except = r.builder().AddException(sigs.v_v());
constexpr uint32_t kResult0 = 23; constexpr uint32_t kResult0 = 23;
constexpr uint32_t kResult1 = 42; constexpr uint32_t kResult1 = 42;
...@@ -421,7 +421,7 @@ WASM_EXEC_TEST(TryCatchAllCallIndirect) { ...@@ -421,7 +421,7 @@ WASM_EXEC_TEST(TryCatchAllCallIndirect) {
TestSignatures sigs; TestSignatures sigs;
EXPERIMENTAL_FLAG_SCOPE(eh); EXPERIMENTAL_FLAG_SCOPE(eh);
WasmRunner<uint32_t, uint32_t> r(execution_tier); WasmRunner<uint32_t, uint32_t> r(execution_tier);
uint32_t except = r.builder().AddException(sigs.v_v()); byte except = r.builder().AddException(sigs.v_v());
constexpr uint32_t kResult0 = 23; constexpr uint32_t kResult0 = 23;
constexpr uint32_t kResult1 = 42; constexpr uint32_t kResult1 = 42;
...@@ -612,16 +612,17 @@ UNINITIALIZED_WASM_EXEC_TEST(TestStackOverflowNotCaught) { ...@@ -612,16 +612,17 @@ UNINITIALIZED_WASM_EXEC_TEST(TestStackOverflowNotCaught) {
// Build a function that calls itself until stack overflow. // Build a function that calls itself until stack overflow.
WasmFunctionCompiler& stack_overflow = r.NewFunction(sigs.v_v()); WasmFunctionCompiler& stack_overflow = r.NewFunction(sigs.v_v());
byte stack_overflow_code[] = {kExprCallFunction, byte stack_overflow_code[] = {
stack_overflow.function_index()}; kExprCallFunction, static_cast<byte>(stack_overflow.function_index())};
stack_overflow.Build(stack_overflow_code, stack_overflow.Build(stack_overflow_code,
stack_overflow_code + arraysize(stack_overflow_code)); stack_overflow_code + arraysize(stack_overflow_code));
// Build the main test function. // Build the main test function.
BUILD(r, WASM_TRY_CATCH_ALL_T(kWasmI32, BUILD(r, WASM_TRY_CATCH_ALL_T(
WASM_STMTS(WASM_I32V(1), kExprCallFunction, kWasmI32,
stack_overflow.function_index()), WASM_STMTS(WASM_I32V(1), kExprCallFunction,
WASM_STMTS(WASM_I32V(1)))); static_cast<byte>(stack_overflow.function_index())),
WASM_STMTS(WASM_I32V(1))));
if (execution_tier != TestExecutionTier::kInterpreter) { if (execution_tier != TestExecutionTier::kInterpreter) {
// Need to call through JS to allow for creation of stack traces. // Need to call through JS to allow for creation of stack traces.
...@@ -672,7 +673,7 @@ TEST(Regress1186795) { ...@@ -672,7 +673,7 @@ TEST(Regress1186795) {
TestSignatures sigs; TestSignatures sigs;
EXPERIMENTAL_FLAG_SCOPE(eh); EXPERIMENTAL_FLAG_SCOPE(eh);
WasmRunner<uint32_t> r(TestExecutionTier::kInterpreter); WasmRunner<uint32_t> r(TestExecutionTier::kInterpreter);
uint32_t except = r.builder().AddException(sigs.v_i()); byte except = r.builder().AddException(sigs.v_i());
BUILD(r, WASM_TRY_CATCH_T( BUILD(r, WASM_TRY_CATCH_T(
kWasmI32, kWasmI32,
WASM_STMTS( WASM_STMTS(
...@@ -692,7 +693,7 @@ TEST(Regress1197408) { ...@@ -692,7 +693,7 @@ TEST(Regress1197408) {
EXPERIMENTAL_FLAG_SCOPE(eh); EXPERIMENTAL_FLAG_SCOPE(eh);
WasmRunner<int32_t, int32_t, int32_t, int32_t> r( WasmRunner<int32_t, int32_t, int32_t, int32_t> r(
TestExecutionTier::kInterpreter); TestExecutionTier::kInterpreter);
int sig_id = r.builder().AddSignature(sigs.i_iii()); byte sig_id = r.builder().AddSignature(sigs.i_iii());
BUILD(r, WASM_STMTS(WASM_I32V(0), WASM_I32V(0), WASM_I32V(0), kExprTry, BUILD(r, WASM_STMTS(WASM_I32V(0), WASM_I32V(0), WASM_I32V(0), kExprTry,
sig_id, kExprTry, sig_id, kExprCallFunction, 0, sig_id, kExprTry, sig_id, kExprCallFunction, 0,
kExprDelegate, 0, kExprDelegate, 0)); kExprDelegate, 0, kExprDelegate, 0));
...@@ -703,7 +704,7 @@ TEST(Regress1212396) { ...@@ -703,7 +704,7 @@ TEST(Regress1212396) {
TestSignatures sigs; TestSignatures sigs;
EXPERIMENTAL_FLAG_SCOPE(eh); EXPERIMENTAL_FLAG_SCOPE(eh);
WasmRunner<int32_t> r(TestExecutionTier::kInterpreter); WasmRunner<int32_t> r(TestExecutionTier::kInterpreter);
uint32_t except = r.builder().AddException(sigs.v_v()); byte except = r.builder().AddException(sigs.v_v());
BUILD(r, kExprTry, kVoidCode, kExprTry, kVoidCode, kExprI32Const, 0, BUILD(r, kExprTry, kVoidCode, kExprTry, kVoidCode, kExprI32Const, 0,
kExprThrow, except, kExprDelegate, 0, kExprCatch, except, kExprEnd, kExprThrow, except, kExprDelegate, 0, kExprCatch, except, kExprEnd,
kExprI32Const, 42); kExprI32Const, 42);
......
...@@ -2976,10 +2976,10 @@ WASM_SIMD_TEST(S128Load64Zero) { ...@@ -2976,10 +2976,10 @@ WASM_SIMD_TEST(S128Load64Zero) {
template <typename T> template <typename T>
void RunLoadLaneTest(TestExecutionTier execution_tier, WasmOpcode load_op, void RunLoadLaneTest(TestExecutionTier execution_tier, WasmOpcode load_op,
WasmOpcode splat_op) { WasmOpcode splat_op) {
WasmOpcode const_op = byte const_op = static_cast<byte>(
splat_op == kExprI64x2Splat ? kExprI64Const : kExprI32Const; splat_op == kExprI64x2Splat ? kExprI64Const : kExprI32Const);
constexpr int lanes_s = kSimd128Size / sizeof(T); constexpr byte lanes_s = kSimd128Size / sizeof(T);
constexpr int mem_index = 16; // Load from mem index 16 (bytes). constexpr int mem_index = 16; // Load from mem index 16 (bytes).
constexpr int splat_value = 33; constexpr int splat_value = 33;
T sentinel = T{-1}; T sentinel = T{-1};
...@@ -2988,7 +2988,8 @@ void RunLoadLaneTest(TestExecutionTier execution_tier, WasmOpcode load_op, ...@@ -2988,7 +2988,8 @@ void RunLoadLaneTest(TestExecutionTier execution_tier, WasmOpcode load_op,
T* global; T* global;
auto build_fn = [=, &memory, &global](WasmRunner<int32_t>& r, int mem_index, auto build_fn = [=, &memory, &global](WasmRunner<int32_t>& r, int mem_index,
int lane, int alignment, int offset) { byte lane, byte alignment,
byte offset) {
memory = r.builder().AddMemoryElems<T>(kWasmPageSize / sizeof(T)); memory = r.builder().AddMemoryElems<T>(kWasmPageSize / sizeof(T));
global = r.builder().AddGlobal<T>(kWasmS128); global = r.builder().AddGlobal<T>(kWasmS128);
r.builder().WriteMemory(&memory[lanes_s], sentinel); r.builder().WriteMemory(&memory[lanes_s], sentinel);
...@@ -3001,13 +3002,13 @@ void RunLoadLaneTest(TestExecutionTier execution_tier, WasmOpcode load_op, ...@@ -3001,13 +3002,13 @@ void RunLoadLaneTest(TestExecutionTier execution_tier, WasmOpcode load_op,
auto check_results = [=](T* global, int sentinel_lane = 0) { auto check_results = [=](T* global, int sentinel_lane = 0) {
// Only one lane is loaded, the rest of the lanes are unchanged. // Only one lane is loaded, the rest of the lanes are unchanged.
for (int i = 0; i < lanes_s; i++) { for (byte i = 0; i < lanes_s; i++) {
T expected = i == sentinel_lane ? sentinel : static_cast<T>(splat_value); T expected = i == sentinel_lane ? sentinel : static_cast<T>(splat_value);
CHECK_EQ(expected, ReadLittleEndianValue<T>(&global[i])); CHECK_EQ(expected, ReadLittleEndianValue<T>(&global[i]));
} }
}; };
for (int lane_index = 0; lane_index < lanes_s; ++lane_index) { for (byte lane_index = 0; lane_index < lanes_s; ++lane_index) {
WasmRunner<int32_t> r(execution_tier); WasmRunner<int32_t> r(execution_tier);
build_fn(r, mem_index, lane_index, /*alignment=*/0, /*offset=*/0); build_fn(r, mem_index, lane_index, /*alignment=*/0, /*offset=*/0);
r.Call(); r.Call();
...@@ -3073,16 +3074,16 @@ WASM_SIMD_TEST(S128Load64Lane) { ...@@ -3073,16 +3074,16 @@ WASM_SIMD_TEST(S128Load64Lane) {
template <typename T> template <typename T>
void RunStoreLaneTest(TestExecutionTier execution_tier, WasmOpcode store_op, void RunStoreLaneTest(TestExecutionTier execution_tier, WasmOpcode store_op,
WasmOpcode splat_op) { WasmOpcode splat_op) {
constexpr int lanes = kSimd128Size / sizeof(T); constexpr byte lanes = kSimd128Size / sizeof(T);
constexpr int mem_index = 16; // Store to mem index 16 (bytes). constexpr int mem_index = 16; // Store to mem index 16 (bytes).
constexpr int splat_value = 33; constexpr int splat_value = 33;
WasmOpcode const_op = byte const_op = static_cast<byte>(
splat_op == kExprI64x2Splat ? kExprI64Const : kExprI32Const; splat_op == kExprI64x2Splat ? kExprI64Const : kExprI32Const);
T* memory; // Will be set by build_fn. T* memory; // Will be set by build_fn.
auto build_fn = [=, &memory](WasmRunner<int32_t>& r, int mem_index, auto build_fn = [=, &memory](WasmRunner<int32_t>& r, int mem_index,
int lane_index, int alignment, int offset) { byte lane_index, byte alignment, byte offset) {
memory = r.builder().AddMemoryElems<T>(kWasmPageSize / sizeof(T)); memory = r.builder().AddMemoryElems<T>(kWasmPageSize / sizeof(T));
// Splat splat_value, then only Store and replace a single lane. // Splat splat_value, then only Store and replace a single lane.
BUILD(r, WASM_I32V(mem_index), const_op, splat_value, BUILD(r, WASM_I32V(mem_index), const_op, splat_value,
...@@ -3092,18 +3093,18 @@ void RunStoreLaneTest(TestExecutionTier execution_tier, WasmOpcode store_op, ...@@ -3092,18 +3093,18 @@ void RunStoreLaneTest(TestExecutionTier execution_tier, WasmOpcode store_op,
}; };
auto check_results = [=](WasmRunner<int32_t>& r, T* memory) { auto check_results = [=](WasmRunner<int32_t>& r, T* memory) {
for (int i = 0; i < lanes; i++) { for (byte i = 0; i < lanes; i++) {
CHECK_EQ(0, r.builder().ReadMemory(&memory[i])); CHECK_EQ(0, r.builder().ReadMemory(&memory[i]));
} }
CHECK_EQ(splat_value, r.builder().ReadMemory(&memory[lanes])); CHECK_EQ(splat_value, r.builder().ReadMemory(&memory[lanes]));
for (int i = lanes + 1; i < lanes * 2; i++) { for (byte i = lanes + 1; i < lanes * 2; i++) {
CHECK_EQ(0, r.builder().ReadMemory(&memory[i])); CHECK_EQ(0, r.builder().ReadMemory(&memory[i]));
} }
}; };
for (int lane_index = 0; lane_index < lanes; lane_index++) { for (byte lane_index = 0; lane_index < lanes; lane_index++) {
WasmRunner<int32_t> r(execution_tier); WasmRunner<int32_t> r(execution_tier);
build_fn(r, mem_index, lane_index, ZERO_ALIGNMENT, ZERO_OFFSET); build_fn(r, mem_index, lane_index, ZERO_ALIGNMENT, ZERO_OFFSET);
r.Call(); r.Call();
......
...@@ -3693,9 +3693,10 @@ void BinOpOnDifferentRegisters( ...@@ -3693,9 +3693,10 @@ void BinOpOnDifferentRegisters(
// Keep this list small, the BinOpOnDifferentRegisters test is running long // Keep this list small, the BinOpOnDifferentRegisters test is running long
// enough already. // enough already.
static constexpr int32_t kSome32BitInputs[] = {0, 1, -1, 31, 0xff112233}; static constexpr int32_t kSome32BitInputs[] = {
0, 1, -1, 31, static_cast<int32_t>(0xff112233)};
static constexpr int64_t kSome64BitInputs[] = { static constexpr int64_t kSome64BitInputs[] = {
0, 1, -1, 31, 63, 0x100000000, 0xff11223344556677}; 0, 1, -1, 31, 63, 0x100000000, static_cast<int64_t>(0xff11223344556677)};
WASM_EXEC_TEST(I32AddOnDifferentRegisters) { WASM_EXEC_TEST(I32AddOnDifferentRegisters) {
BinOpOnDifferentRegisters<int32_t>( BinOpOnDifferentRegisters<int32_t>(
......
...@@ -15,7 +15,7 @@ TEST(AddressRegionTest, Contains) { ...@@ -15,7 +15,7 @@ TEST(AddressRegionTest, Contains) {
struct { struct {
Address start; Address start;
size_t size; size_t size;
} test_cases[] = {{153, 771}, {0, 227}, {-447, 447}}; } test_cases[] = {{153, 771}, {0, 227}, {static_cast<Address>(-447), 447}};
for (size_t i = 0; i < arraysize(test_cases); i++) { for (size_t i = 0; i < arraysize(test_cases); i++) {
Address start = test_cases[i].start; Address start = test_cases[i].start;
......
...@@ -4730,7 +4730,7 @@ class WasmOpcodeLengthTest : public TestWithZone { ...@@ -4730,7 +4730,7 @@ class WasmOpcodeLengthTest : public TestWithZone {
template <typename... Bytes> template <typename... Bytes>
void ExpectLength(unsigned expected, Bytes... bytes) { void ExpectLength(unsigned expected, Bytes... bytes) {
const byte code[] = {bytes..., 0, 0, 0, 0, 0, 0, 0, 0}; const byte code[] = {static_cast<byte>(bytes)..., 0, 0, 0, 0, 0, 0, 0, 0};
EXPECT_EQ(expected, OpcodeLength(code, code + sizeof(code))) EXPECT_EQ(expected, OpcodeLength(code, code + sizeof(code)))
<< PrintOpcodes{code, code + sizeof...(bytes)}; << PrintOpcodes{code, code + sizeof...(bytes)};
} }
...@@ -4751,7 +4751,7 @@ class WasmOpcodeLengthTest : public TestWithZone { ...@@ -4751,7 +4751,7 @@ class WasmOpcodeLengthTest : public TestWithZone {
template <typename... Bytes> template <typename... Bytes>
void ExpectFailure(Bytes... bytes) { void ExpectFailure(Bytes... bytes) {
const byte code[] = {bytes..., 0, 0, 0, 0, 0, 0, 0, 0}; const byte code[] = {static_cast<byte>(bytes)..., 0, 0, 0, 0, 0, 0, 0, 0};
WasmFeatures no_features = WasmFeatures::None(); WasmFeatures no_features = WasmFeatures::None();
WasmDecoder<Decoder::kFullValidation> decoder( WasmDecoder<Decoder::kFullValidation> decoder(
this->zone(), nullptr, no_features, &no_features, nullptr, code, this->zone(), nullptr, no_features, &no_features, nullptr, code,
......
...@@ -278,9 +278,9 @@ TEST_P(TrapHandlerTest, TestTrapHandlerRecovery) { ...@@ -278,9 +278,9 @@ TEST_P(TrapHandlerTest, TestTrapHandlerRecovery) {
__ Push(scratch); __ Push(scratch);
GenerateSetThreadInWasmFlagCode(&masm); GenerateSetThreadInWasmFlagCode(&masm);
__ Move(scratch, crash_address_, RelocInfo::NONE); __ Move(scratch, crash_address_, RelocInfo::NONE);
int crash_offset = __ pc_offset(); uint32_t crash_offset = __ pc_offset();
__ testl(MemOperand(scratch, 0), Immediate(1)); __ testl(MemOperand(scratch, 0), Immediate(1));
int recovery_offset = __ pc_offset(); uint32_t recovery_offset = __ pc_offset();
GenerateResetThreadInWasmFlagCode(&masm); GenerateResetThreadInWasmFlagCode(&masm);
__ Pop(scratch); __ Pop(scratch);
__ Ret(); __ Ret();
...@@ -303,9 +303,9 @@ TEST_P(TrapHandlerTest, TestReleaseHandlerData) { ...@@ -303,9 +303,9 @@ TEST_P(TrapHandlerTest, TestReleaseHandlerData) {
__ Push(scratch); __ Push(scratch);
GenerateSetThreadInWasmFlagCode(&masm); GenerateSetThreadInWasmFlagCode(&masm);
__ Move(scratch, crash_address_, RelocInfo::NONE); __ Move(scratch, crash_address_, RelocInfo::NONE);
int crash_offset = __ pc_offset(); uint32_t crash_offset = __ pc_offset();
__ testl(MemOperand(scratch, 0), Immediate(1)); __ testl(MemOperand(scratch, 0), Immediate(1));
int recovery_offset = __ pc_offset(); uint32_t recovery_offset = __ pc_offset();
GenerateResetThreadInWasmFlagCode(&masm); GenerateResetThreadInWasmFlagCode(&masm);
__ Pop(scratch); __ Pop(scratch);
__ Ret(); __ Ret();
...@@ -334,9 +334,9 @@ TEST_P(TrapHandlerTest, TestNoThreadInWasmFlag) { ...@@ -334,9 +334,9 @@ TEST_P(TrapHandlerTest, TestNoThreadInWasmFlag) {
buffer_->CreateView()); buffer_->CreateView());
__ Push(scratch); __ Push(scratch);
__ Move(scratch, crash_address_, RelocInfo::NONE); __ Move(scratch, crash_address_, RelocInfo::NONE);
int crash_offset = __ pc_offset(); uint32_t crash_offset = __ pc_offset();
__ testl(MemOperand(scratch, 0), Immediate(1)); __ testl(MemOperand(scratch, 0), Immediate(1));
int recovery_offset = __ pc_offset(); uint32_t recovery_offset = __ pc_offset();
__ Pop(scratch); __ Pop(scratch);
__ Ret(); __ Ret();
CodeDesc desc; CodeDesc desc;
...@@ -357,11 +357,11 @@ TEST_P(TrapHandlerTest, TestCrashInWasmNoProtectedInstruction) { ...@@ -357,11 +357,11 @@ TEST_P(TrapHandlerTest, TestCrashInWasmNoProtectedInstruction) {
buffer_->CreateView()); buffer_->CreateView());
__ Push(scratch); __ Push(scratch);
GenerateSetThreadInWasmFlagCode(&masm); GenerateSetThreadInWasmFlagCode(&masm);
int no_crash_offset = __ pc_offset(); uint32_t no_crash_offset = __ pc_offset();
__ Move(scratch, crash_address_, RelocInfo::NONE); __ Move(scratch, crash_address_, RelocInfo::NONE);
__ testl(MemOperand(scratch, 0), Immediate(1)); __ testl(MemOperand(scratch, 0), Immediate(1));
// Offset where the crash is not happening. // Offset where the crash is not happening.
int recovery_offset = __ pc_offset(); uint32_t recovery_offset = __ pc_offset();
GenerateResetThreadInWasmFlagCode(&masm); GenerateResetThreadInWasmFlagCode(&masm);
__ Pop(scratch); __ Pop(scratch);
__ Ret(); __ Ret();
...@@ -384,10 +384,10 @@ TEST_P(TrapHandlerTest, TestCrashInWasmWrongCrashType) { ...@@ -384,10 +384,10 @@ TEST_P(TrapHandlerTest, TestCrashInWasmWrongCrashType) {
__ Push(scratch); __ Push(scratch);
GenerateSetThreadInWasmFlagCode(&masm); GenerateSetThreadInWasmFlagCode(&masm);
__ xorq(scratch, scratch); __ xorq(scratch, scratch);
int crash_offset = __ pc_offset(); uint32_t crash_offset = __ pc_offset();
__ divq(scratch); __ divq(scratch);
// Offset where the crash is not happening. // Offset where the crash is not happening.
int recovery_offset = __ pc_offset(); uint32_t recovery_offset = __ pc_offset();
GenerateResetThreadInWasmFlagCode(&masm); GenerateResetThreadInWasmFlagCode(&masm);
__ Pop(scratch); __ Pop(scratch);
__ Ret(); __ Ret();
...@@ -445,9 +445,9 @@ TEST_P(TrapHandlerTest, TestCrashInOtherThread) { ...@@ -445,9 +445,9 @@ TEST_P(TrapHandlerTest, TestCrashInOtherThread) {
buffer_->CreateView()); buffer_->CreateView());
__ Push(scratch); __ Push(scratch);
__ Move(scratch, crash_address_, RelocInfo::NONE); __ Move(scratch, crash_address_, RelocInfo::NONE);
int crash_offset = __ pc_offset(); uint32_t crash_offset = __ pc_offset();
__ testl(MemOperand(scratch, 0), Immediate(1)); __ testl(MemOperand(scratch, 0), Immediate(1));
int recovery_offset = __ pc_offset(); uint32_t recovery_offset = __ pc_offset();
__ Pop(scratch); __ Pop(scratch);
__ Ret(); __ Ret();
CodeDesc desc; CodeDesc desc;
......
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