Commit 3505406b authored by ulan's avatar ulan Committed by Commit bot

[wasm] Fix -Wsign-compare warnings.

BUG=v8:5614

Review-Url: https://codereview.chromium.org/2487673004
Cr-Commit-Position: refs/heads/master@{#40891}
parent f15373fd
...@@ -567,7 +567,7 @@ AsmType* AsmTyper::ValidateModule(FunctionLiteral* fun) { ...@@ -567,7 +567,7 @@ AsmType* AsmTyper::ValidateModule(FunctionLiteral* fun) {
module_name_ = fun->name(); module_name_ = fun->name();
// Allowed parameters: Stdlib, FFI, Mem // Allowed parameters: Stdlib, FFI, Mem
static const uint32_t MaxModuleParameters = 3; static const int MaxModuleParameters = 3;
if (scope->num_parameters() > MaxModuleParameters) { if (scope->num_parameters() > MaxModuleParameters) {
FAIL(fun, "asm.js modules may not have more than three parameters."); FAIL(fun, "asm.js modules may not have more than three parameters.");
} }
...@@ -1017,7 +1017,7 @@ AsmType* AsmTyper::ValidateFunctionTable(Assignment* assign) { ...@@ -1017,7 +1017,7 @@ AsmType* AsmTyper::ValidateFunctionTable(Assignment* assign) {
FAIL(assign, "Identifier redefined (function table name)."); FAIL(assign, "Identifier redefined (function table name).");
} }
if (target_info_table->length() != pointers->length()) { if (static_cast<int>(target_info_table->length()) != pointers->length()) {
FAIL(assign, "Function table size mismatch."); FAIL(assign, "Function table size mismatch.");
} }
...@@ -1071,7 +1071,7 @@ AsmType* AsmTyper::ValidateFunction(FunctionDeclaration* fun_decl) { ...@@ -1071,7 +1071,7 @@ AsmType* AsmTyper::ValidateFunction(FunctionDeclaration* fun_decl) {
} }
auto* param = proxy->var(); auto* param = proxy->var();
if (param->location() != VariableLocation::PARAMETER || if (param->location() != VariableLocation::PARAMETER ||
param->index() != annotated_parameters) { param->index() != static_cast<int>(annotated_parameters)) {
// Done with parameters. // Done with parameters.
break; break;
} }
...@@ -1093,7 +1093,7 @@ AsmType* AsmTyper::ValidateFunction(FunctionDeclaration* fun_decl) { ...@@ -1093,7 +1093,7 @@ AsmType* AsmTyper::ValidateFunction(FunctionDeclaration* fun_decl) {
SetTypeOf(expr, type); SetTypeOf(expr, type);
} }
if (annotated_parameters != fun->parameter_count()) { if (static_cast<int>(annotated_parameters) != fun->parameter_count()) {
FAIL(fun_decl, "Incorrect parameter type annotations."); FAIL(fun_decl, "Incorrect parameter type annotations.");
} }
......
...@@ -800,7 +800,8 @@ class WasmFullDecoder : public WasmDecoder { ...@@ -800,7 +800,8 @@ class WasmFullDecoder : public WasmDecoder {
if (c->false_env != nullptr) { if (c->false_env != nullptr) {
// End the true branch of a one-armed if. // End the true branch of a one-armed if.
Goto(c->false_env, c->end_env); Goto(c->false_env, c->end_env);
if (ssa_env_->go() && stack_.size() != c->stack_depth) { if (ssa_env_->go() &&
static_cast<int>(stack_.size()) != c->stack_depth) {
error("end of if expected empty stack"); error("end of if expected empty stack");
stack_.resize(c->stack_depth); stack_.resize(c->stack_depth);
} }
...@@ -1435,7 +1436,7 @@ class WasmFullDecoder : public WasmDecoder { ...@@ -1435,7 +1436,7 @@ class WasmFullDecoder : public WasmDecoder {
// Unreachable code is essentially not typechecked. // Unreachable code is essentially not typechecked.
return {pc_, nullptr, kAstEnd}; return {pc_, nullptr, kAstEnd};
} }
if (stack_depth == stack_.size()) { if (stack_depth == static_cast<int>(stack_.size())) {
Value val = {pc_, nullptr, kAstStmt}; Value val = {pc_, nullptr, kAstStmt};
return val; return val;
} else { } else {
...@@ -1460,8 +1461,7 @@ class WasmFullDecoder : public WasmDecoder { ...@@ -1460,8 +1461,7 @@ class WasmFullDecoder : public WasmDecoder {
Goto(ssa_env_, c->end_env); Goto(ssa_env_, c->end_env);
} else { } else {
// Merge the value(s) into the end of the block. // Merge the value(s) into the end of the block.
if (static_cast<size_t>(c->stack_depth + c->merge.arity) > if (c->stack_depth + c->merge.arity > stack_.size()) {
stack_.size()) {
error( error(
pc_, pc_, pc_, pc_,
"expected at least %d values on the stack for br to @%d, found %d", "expected at least %d values on the stack for br to @%d, found %d",
...@@ -1477,7 +1477,7 @@ class WasmFullDecoder : public WasmDecoder { ...@@ -1477,7 +1477,7 @@ class WasmFullDecoder : public WasmDecoder {
if (!ssa_env_->go()) return; if (!ssa_env_->go()) return;
// Merge the value(s) into the end of the block. // Merge the value(s) into the end of the block.
int arity = static_cast<int>(c->merge.arity); int arity = static_cast<int>(c->merge.arity);
if (c->stack_depth + arity != stack_.size()) { if (c->stack_depth + arity != static_cast<int>(stack_.size())) {
error(pc_, pc_, "expected %d elements on the stack for fallthru to @%d", error(pc_, pc_, "expected %d elements on the stack for fallthru to @%d",
arity, startrel(c->pc)); arity, startrel(c->pc));
return; return;
...@@ -1493,7 +1493,7 @@ class WasmFullDecoder : public WasmDecoder { ...@@ -1493,7 +1493,7 @@ class WasmFullDecoder : public WasmDecoder {
if (!ssa_env_->go()) return; if (!ssa_env_->go()) return;
// Fallthru must match arity exactly. // Fallthru must match arity exactly.
int arity = static_cast<int>(c->merge.arity); int arity = static_cast<int>(c->merge.arity);
if (c->stack_depth + arity != stack_.size()) { if (c->stack_depth + arity != static_cast<int>(stack_.size())) {
error(pc_, pc_, "expected %d elements on the stack for fallthru to @%d", error(pc_, pc_, "expected %d elements on the stack for fallthru to @%d",
arity, startrel(c->pc)); arity, startrel(c->pc));
return; return;
......
...@@ -1470,7 +1470,7 @@ class WasmInstanceBuilder { ...@@ -1470,7 +1470,7 @@ class WasmInstanceBuilder {
// TODO(titzer): import table size must match exactly for now. // TODO(titzer): import table size must match exactly for now.
int table_size = table_instance.js_wrappers->length(); int table_size = table_instance.js_wrappers->length();
if (table_size != table.min_size) { if (table_size != static_cast<int>(table.min_size)) {
thrower_->TypeError( thrower_->TypeError(
"table import %d is wrong size (%d), expected %u", index, "table import %d is wrong size (%d), expected %u", index,
table_size, table.min_size); table_size, table.min_size);
......
...@@ -56,7 +56,7 @@ TEST(WasmRelocationIa32MemoryReference) { ...@@ -56,7 +56,7 @@ TEST(WasmRelocationIa32MemoryReference) {
disasm::Disassembler::Disassemble(stdout, begin, end); disasm::Disassembler::Disassemble(stdout, begin, end);
#endif #endif
size_t offset = 1234; int offset = 1234;
// Relocating references by offset // Relocating references by offset
int mode_mask = (1 << RelocInfo::WASM_MEMORY_REFERENCE); int mode_mask = (1 << RelocInfo::WASM_MEMORY_REFERENCE);
...@@ -114,7 +114,7 @@ TEST(WasmRelocationIa32MemorySizeReference) { ...@@ -114,7 +114,7 @@ TEST(WasmRelocationIa32MemorySizeReference) {
CodeRunner<int32_t> runnable(isolate, code, &csig); CodeRunner<int32_t> runnable(isolate, code, &csig);
int32_t ret_value = runnable.Call(); int32_t ret_value = runnable.Call();
CHECK_NE(ret_value, 0xdeadbeef); CHECK_NE(ret_value, bit_cast<int32_t>(0xdeadbeef));
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
OFStream os(stdout); OFStream os(stdout);
...@@ -138,7 +138,7 @@ TEST(WasmRelocationIa32MemorySizeReference) { ...@@ -138,7 +138,7 @@ TEST(WasmRelocationIa32MemorySizeReference) {
} }
ret_value = runnable.Call(); ret_value = runnable.Call();
CHECK_NE(ret_value, 0xdeadbeef); CHECK_NE(ret_value, bit_cast<int32_t>(0xdeadbeef));
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
code->Print(os); code->Print(os);
......
...@@ -107,7 +107,7 @@ TEST(WasmRelocationX64WasmMemorySizeReference) { ...@@ -107,7 +107,7 @@ TEST(WasmRelocationX64WasmMemorySizeReference) {
CSignature0<int64_t> csig; CSignature0<int64_t> csig;
CodeRunner<int64_t> runnable(isolate, code, &csig); CodeRunner<int64_t> runnable(isolate, code, &csig);
int64_t ret_value = runnable.Call(); int64_t ret_value = runnable.Call();
CHECK_NE(ret_value, 0xdeadbeef); CHECK_NE(ret_value, bit_cast<uint32_t>(0xdeadbeef));
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
OFStream os(stdout); OFStream os(stdout);
...@@ -130,7 +130,7 @@ TEST(WasmRelocationX64WasmMemorySizeReference) { ...@@ -130,7 +130,7 @@ TEST(WasmRelocationX64WasmMemorySizeReference) {
} }
ret_value = runnable.Call(); ret_value = runnable.Call();
CHECK_NE(ret_value, 0xdeadbeef); CHECK_NE(ret_value, bit_cast<uint32_t>(0xdeadbeef));
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
code->Print(os); code->Print(os);
......
...@@ -198,7 +198,7 @@ WASM_EXEC_TEST(I64ShlUseOnlyLowWord) { ...@@ -198,7 +198,7 @@ WASM_EXEC_TEST(I64ShlUseOnlyLowWord) {
WASM_I64_SHL(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)))); WASM_I64_SHL(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))));
FOR_INT64_INPUTS(i) { FOR_INT64_INPUTS(i) {
FOR_INT64_INPUTS(j) { FOR_INT64_INPUTS(j) {
uint64_t expected = static_cast<int32_t>((*i) << (*j & 0x3f)); int32_t expected = static_cast<int32_t>((*i) << (*j & 0x3f));
CHECK_EQ(expected, r.Call(*i, *j)); CHECK_EQ(expected, r.Call(*i, *j));
} }
} }
...@@ -213,7 +213,7 @@ WASM_EXEC_TEST(I64ShrUseOnlyLowWord) { ...@@ -213,7 +213,7 @@ WASM_EXEC_TEST(I64ShrUseOnlyLowWord) {
WASM_I64_SHR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)))); WASM_I64_SHR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))));
FOR_UINT64_INPUTS(i) { FOR_UINT64_INPUTS(i) {
FOR_UINT64_INPUTS(j) { FOR_UINT64_INPUTS(j) {
uint64_t expected = static_cast<int32_t>((*i) >> (*j & 0x3f)); int32_t expected = static_cast<int32_t>((*i) >> (*j & 0x3f));
CHECK_EQ(expected, r.Call(*i, *j)); CHECK_EQ(expected, r.Call(*i, *j));
} }
} }
...@@ -228,7 +228,7 @@ WASM_EXEC_TEST(I64SarUseOnlyLowWord) { ...@@ -228,7 +228,7 @@ WASM_EXEC_TEST(I64SarUseOnlyLowWord) {
WASM_I64_SAR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)))); WASM_I64_SAR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))));
FOR_INT64_INPUTS(i) { FOR_INT64_INPUTS(i) {
FOR_INT64_INPUTS(j) { FOR_INT64_INPUTS(j) {
uint64_t expected = static_cast<int32_t>((*i) >> (*j & 0x3f)); int32_t expected = static_cast<int32_t>((*i) >> (*j & 0x3f));
CHECK_EQ(expected, r.Call(*i, *j)); CHECK_EQ(expected, r.Call(*i, *j));
} }
} }
...@@ -422,22 +422,22 @@ WASM_EXEC_TEST(I64Shl) { ...@@ -422,22 +422,22 @@ WASM_EXEC_TEST(I64Shl) {
} }
} }
{ {
WasmRunner<int64_t> r(execution_mode, MachineType::Int64()); WasmRunner<uint64_t> r(execution_mode, MachineType::Int64());
BUILD(r, WASM_I64_SHL(WASM_GET_LOCAL(0), WASM_I64V_1(0))); BUILD(r, WASM_I64_SHL(WASM_GET_LOCAL(0), WASM_I64V_1(0)));
FOR_UINT64_INPUTS(i) { CHECK_EQ(*i << 0, r.Call(*i)); } FOR_UINT64_INPUTS(i) { CHECK_EQ(*i << 0, r.Call(*i)); }
} }
{ {
WasmRunner<int64_t> r(execution_mode, MachineType::Int64()); WasmRunner<uint64_t> r(execution_mode, MachineType::Int64());
BUILD(r, WASM_I64_SHL(WASM_GET_LOCAL(0), WASM_I64V_1(32))); BUILD(r, WASM_I64_SHL(WASM_GET_LOCAL(0), WASM_I64V_1(32)));
FOR_UINT64_INPUTS(i) { CHECK_EQ(*i << 32, r.Call(*i)); } FOR_UINT64_INPUTS(i) { CHECK_EQ(*i << 32, r.Call(*i)); }
} }
{ {
WasmRunner<int64_t> r(execution_mode, MachineType::Int64()); WasmRunner<uint64_t> r(execution_mode, MachineType::Int64());
BUILD(r, WASM_I64_SHL(WASM_GET_LOCAL(0), WASM_I64V_1(20))); BUILD(r, WASM_I64_SHL(WASM_GET_LOCAL(0), WASM_I64V_1(20)));
FOR_UINT64_INPUTS(i) { CHECK_EQ(*i << 20, r.Call(*i)); } FOR_UINT64_INPUTS(i) { CHECK_EQ(*i << 20, r.Call(*i)); }
} }
{ {
WasmRunner<int64_t> r(execution_mode, MachineType::Int64()); WasmRunner<uint64_t> r(execution_mode, MachineType::Int64());
BUILD(r, WASM_I64_SHL(WASM_GET_LOCAL(0), WASM_I64V_1(40))); BUILD(r, WASM_I64_SHL(WASM_GET_LOCAL(0), WASM_I64V_1(40)));
FOR_UINT64_INPUTS(i) { CHECK_EQ(*i << 40, r.Call(*i)); } FOR_UINT64_INPUTS(i) { CHECK_EQ(*i << 40, r.Call(*i)); }
} }
...@@ -458,22 +458,22 @@ WASM_EXEC_TEST(I64ShrU) { ...@@ -458,22 +458,22 @@ WASM_EXEC_TEST(I64ShrU) {
} }
} }
{ {
WasmRunner<int64_t> r(execution_mode, MachineType::Int64()); WasmRunner<uint64_t> r(execution_mode, MachineType::Int64());
BUILD(r, WASM_I64_SHR(WASM_GET_LOCAL(0), WASM_I64V_1(0))); BUILD(r, WASM_I64_SHR(WASM_GET_LOCAL(0), WASM_I64V_1(0)));
FOR_UINT64_INPUTS(i) { CHECK_EQ(*i >> 0, r.Call(*i)); } FOR_UINT64_INPUTS(i) { CHECK_EQ(*i >> 0, r.Call(*i)); }
} }
{ {
WasmRunner<int64_t> r(execution_mode, MachineType::Int64()); WasmRunner<uint64_t> r(execution_mode, MachineType::Int64());
BUILD(r, WASM_I64_SHR(WASM_GET_LOCAL(0), WASM_I64V_1(32))); BUILD(r, WASM_I64_SHR(WASM_GET_LOCAL(0), WASM_I64V_1(32)));
FOR_UINT64_INPUTS(i) { CHECK_EQ(*i >> 32, r.Call(*i)); } FOR_UINT64_INPUTS(i) { CHECK_EQ(*i >> 32, r.Call(*i)); }
} }
{ {
WasmRunner<int64_t> r(execution_mode, MachineType::Int64()); WasmRunner<uint64_t> r(execution_mode, MachineType::Int64());
BUILD(r, WASM_I64_SHR(WASM_GET_LOCAL(0), WASM_I64V_1(20))); BUILD(r, WASM_I64_SHR(WASM_GET_LOCAL(0), WASM_I64V_1(20)));
FOR_UINT64_INPUTS(i) { CHECK_EQ(*i >> 20, r.Call(*i)); } FOR_UINT64_INPUTS(i) { CHECK_EQ(*i >> 20, r.Call(*i)); }
} }
{ {
WasmRunner<int64_t> r(execution_mode, MachineType::Int64()); WasmRunner<uint64_t> r(execution_mode, MachineType::Int64());
BUILD(r, WASM_I64_SHR(WASM_GET_LOCAL(0), WASM_I64V_1(40))); BUILD(r, WASM_I64_SHR(WASM_GET_LOCAL(0), WASM_I64V_1(40)));
FOR_UINT64_INPUTS(i) { CHECK_EQ(*i >> 40, r.Call(*i)); } FOR_UINT64_INPUTS(i) { CHECK_EQ(*i >> 40, r.Call(*i)); }
} }
...@@ -635,7 +635,7 @@ WASM_EXEC_TEST(I64UConvertI32) { ...@@ -635,7 +635,7 @@ WASM_EXEC_TEST(I64UConvertI32) {
REQUIRE(I64UConvertI32); REQUIRE(I64UConvertI32);
WasmRunner<int64_t> r(execution_mode, MachineType::Uint32()); WasmRunner<int64_t> r(execution_mode, MachineType::Uint32());
BUILD(r, WASM_I64_UCONVERT_I32(WASM_GET_LOCAL(0))); BUILD(r, WASM_I64_UCONVERT_I32(WASM_GET_LOCAL(0)));
FOR_UINT32_INPUTS(i) { CHECK_EQ(static_cast<uint64_t>(*i), r.Call(*i)); } FOR_UINT32_INPUTS(i) { CHECK_EQ(static_cast<int64_t>(*i), r.Call(*i)); }
} }
WASM_EXEC_TEST(I64Popcnt) { WASM_EXEC_TEST(I64Popcnt) {
...@@ -1366,8 +1366,8 @@ WASM_EXEC_TEST(LoadMemI64) { ...@@ -1366,8 +1366,8 @@ WASM_EXEC_TEST(LoadMemI64) {
BUILD(r, WASM_LOAD_MEM(MachineType::Int64(), WASM_I8(0))); BUILD(r, WASM_LOAD_MEM(MachineType::Int64(), WASM_I8(0)));
module.WriteMemory<int64_t>(&memory[0], 0xaabbccdd00112233LL); module.WriteMemory<int64_t>(&memory[0], 0x1abbccdd00112233LL);
CHECK_EQ(0xaabbccdd00112233LL, r.Call()); CHECK_EQ(0x1abbccdd00112233LL, r.Call());
module.WriteMemory<int64_t>(&memory[0], 0x33aabbccdd001122LL); module.WriteMemory<int64_t>(&memory[0], 0x33aabbccdd001122LL);
CHECK_EQ(0x33aabbccdd001122LL, r.Call()); CHECK_EQ(0x33aabbccdd001122LL, r.Call());
...@@ -1387,8 +1387,8 @@ WASM_EXEC_TEST(LoadMemI64_alignment) { ...@@ -1387,8 +1387,8 @@ WASM_EXEC_TEST(LoadMemI64_alignment) {
BUILD(r, BUILD(r,
WASM_LOAD_MEM_ALIGNMENT(MachineType::Int64(), WASM_I8(0), alignment)); WASM_LOAD_MEM_ALIGNMENT(MachineType::Int64(), WASM_I8(0), alignment));
module.WriteMemory<int64_t>(&memory[0], 0xaabbccdd00112233LL); module.WriteMemory<int64_t>(&memory[0], 0x1abbccdd00112233LL);
CHECK_EQ(0xaabbccdd00112233LL, r.Call()); CHECK_EQ(0x1abbccdd00112233LL, r.Call());
module.WriteMemory<int64_t>(&memory[0], 0x33aabbccdd001122LL); module.WriteMemory<int64_t>(&memory[0], 0x33aabbccdd001122LL);
CHECK_EQ(0x33aabbccdd001122LL, r.Call()); CHECK_EQ(0x33aabbccdd001122LL, r.Call());
......
...@@ -202,7 +202,8 @@ TEST(Breakpoint_I32Add) { ...@@ -202,7 +202,8 @@ TEST(Breakpoint_I32Add) {
thread->Run(); // run to next breakpoint thread->Run(); // run to next breakpoint
// Check the thread stopped at the right pc. // Check the thread stopped at the right pc.
CHECK_EQ(WasmInterpreter::PAUSED, thread->state()); CHECK_EQ(WasmInterpreter::PAUSED, thread->state());
CHECK_EQ(kLocalsDeclSize + offsets[i], thread->GetBreakpointPc()); CHECK_EQ(static_cast<size_t>(kLocalsDeclSize + offsets[i]),
thread->GetBreakpointPc());
} }
thread->Run(); // run to completion thread->Run(); // run to completion
...@@ -280,7 +281,8 @@ TEST(Breakpoint_I32And_disable) { ...@@ -280,7 +281,8 @@ TEST(Breakpoint_I32And_disable) {
thread->Run(); // run to next breakpoint thread->Run(); // run to next breakpoint
// Check the thread stopped at the right pc. // Check the thread stopped at the right pc.
CHECK_EQ(WasmInterpreter::PAUSED, thread->state()); CHECK_EQ(WasmInterpreter::PAUSED, thread->state());
CHECK_EQ(kLocalsDeclSize + offsets[0], thread->GetBreakpointPc()); CHECK_EQ(static_cast<size_t>(kLocalsDeclSize + offsets[0]),
thread->GetBreakpointPc());
} }
thread->Run(); // run to completion thread->Run(); // run to completion
......
...@@ -1210,7 +1210,7 @@ WASM_EXEC_TEST(Block_empty_brif2) { ...@@ -1210,7 +1210,7 @@ WASM_EXEC_TEST(Block_empty_brif2) {
WasmRunner<uint32_t> r(execution_mode, MachineType::Uint32(), WasmRunner<uint32_t> r(execution_mode, MachineType::Uint32(),
MachineType::Uint32()); MachineType::Uint32());
BUILD(r, WASM_BLOCK(WASM_BR_IF(0, WASM_GET_LOCAL(1))), WASM_GET_LOCAL(0)); BUILD(r, WASM_BLOCK(WASM_BR_IF(0, WASM_GET_LOCAL(1))), WASM_GET_LOCAL(0));
FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i, *i + 1)); } FOR_UINT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i, *i + 1)); }
} }
WASM_EXEC_TEST(Block_i) { WASM_EXEC_TEST(Block_i) {
...@@ -1234,7 +1234,7 @@ WASM_EXEC_TEST(Block_d) { ...@@ -1234,7 +1234,7 @@ WASM_EXEC_TEST(Block_d) {
WASM_EXEC_TEST(Block_br2) { WASM_EXEC_TEST(Block_br2) {
WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); WasmRunner<int32_t> r(execution_mode, MachineType::Int32());
BUILD(r, WASM_BLOCK_I(WASM_BRV(0, WASM_GET_LOCAL(0)))); BUILD(r, WASM_BLOCK_I(WASM_BRV(0, WASM_GET_LOCAL(0))));
FOR_UINT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); } FOR_UINT32_INPUTS(i) { CHECK_EQ(*i, static_cast<uint32_t>(r.Call(*i))); }
} }
WASM_EXEC_TEST(Block_If_P) { WASM_EXEC_TEST(Block_If_P) {
...@@ -1596,7 +1596,7 @@ WASM_EXEC_TEST(LoadMemI32_const_oob_misaligned) { ...@@ -1596,7 +1596,7 @@ WASM_EXEC_TEST(LoadMemI32_const_oob_misaligned) {
BUILD(r, BUILD(r,
WASM_LOAD_MEM_OFFSET(MachineType::Int32(), offset, WASM_I8(index))); WASM_LOAD_MEM_OFFSET(MachineType::Int32(), offset, WASM_I8(index)));
if ((offset + index) <= (kMemSize - sizeof(int32_t))) { if ((offset + index) <= static_cast<int>((kMemSize - sizeof(int32_t)))) {
CHECK_EQ(module.raw_val_at<int32_t>(offset + index), r.Call()); CHECK_EQ(module.raw_val_at<int32_t>(offset + index), r.Call());
} else { } else {
CHECK_TRAP(r.Call()); CHECK_TRAP(r.Call());
...@@ -1618,7 +1618,7 @@ WASM_EXEC_TEST(LoadMemI32_const_oob) { ...@@ -1618,7 +1618,7 @@ WASM_EXEC_TEST(LoadMemI32_const_oob) {
BUILD(r, BUILD(r,
WASM_LOAD_MEM_OFFSET(MachineType::Int32(), offset, WASM_I8(index))); WASM_LOAD_MEM_OFFSET(MachineType::Int32(), offset, WASM_I8(index)));
if ((offset + index) <= (kMemSize - sizeof(int32_t))) { if ((offset + index) <= static_cast<int>((kMemSize - sizeof(int32_t)))) {
CHECK_EQ(module.raw_val_at<int32_t>(offset + index), r.Call()); CHECK_EQ(module.raw_val_at<int32_t>(offset + index), r.Call());
} else { } else {
CHECK_TRAP(r.Call()); CHECK_TRAP(r.Call());
......
...@@ -42,7 +42,7 @@ int main(int argc, char* argv[]) { ...@@ -42,7 +42,7 @@ int main(int argc, char* argv[]) {
size_t bytes_read = fread(data, 1, size, input); size_t bytes_read = fread(data, 1, size, input);
fclose(input); fclose(input);
if (bytes_read != size) { if (bytes_read != static_cast<size_t>(size)) {
free(data); free(data);
fprintf(stderr, "Failed to read %s\n", argv[1]); fprintf(stderr, "Failed to read %s\n", argv[1]);
return 1; return 1;
......
...@@ -165,7 +165,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { ...@@ -165,7 +165,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
i_isolate, instance, &compiler_thrower, "main", argc, compiled_args, i_isolate, instance, &compiler_thrower, "main", argc, compiled_args,
v8::internal::wasm::ModuleOrigin::kWasmOrigin); v8::internal::wasm::ModuleOrigin::kWasmOrigin);
} }
if (result_interpreted == 0xdeadbeef) { if (result_interpreted == bit_cast<int32_t>(0xdeadbeef)) {
CHECK(i_isolate->has_pending_exception()); CHECK(i_isolate->has_pending_exception());
i_isolate->clear_pending_exception(); i_isolate->clear_pending_exception();
} else { } else {
......
...@@ -91,7 +91,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { ...@@ -91,7 +91,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
i_isolate, instance, &compiler_thrower, "main", arraysize(arguments), i_isolate, instance, &compiler_thrower, "main", arraysize(arguments),
arguments, v8::internal::wasm::ModuleOrigin::kWasmOrigin); arguments, v8::internal::wasm::ModuleOrigin::kWasmOrigin);
} }
if (result_interpreted == 0xdeadbeef) { if (result_interpreted == bit_cast<int32_t>(0xdeadbeef)) {
CHECK(i_isolate->has_pending_exception()); CHECK(i_isolate->has_pending_exception());
i_isolate->clear_pending_exception(); i_isolate->clear_pending_exception();
} else { } else {
......
...@@ -1184,7 +1184,7 @@ TEST_F(AstDecoderTest, LoadMemAlignment) { ...@@ -1184,7 +1184,7 @@ TEST_F(AstDecoderTest, LoadMemAlignment) {
{kExprF64LoadMem, 3}, // -- {kExprF64LoadMem, 3}, // --
}; };
for (int i = 0; i < arraysize(values); i++) { for (size_t i = 0; i < arraysize(values); i++) {
for (byte alignment = 0; alignment <= 4; alignment++) { for (byte alignment = 0; alignment <= 4; alignment++) {
byte code[] = {WASM_ZERO, static_cast<byte>(values[i].instruction), byte code[] = {WASM_ZERO, static_cast<byte>(values[i].instruction),
alignment, ZERO_OFFSET, WASM_DROP}; alignment, ZERO_OFFSET, WASM_DROP};
...@@ -1697,7 +1697,7 @@ TEST_F(AstDecoderTest, AsmJsBinOpsCheckOrigin) { ...@@ -1697,7 +1697,7 @@ TEST_F(AstDecoderTest, AsmJsBinOpsCheckOrigin) {
TestModuleEnv module_env; TestModuleEnv module_env;
module = &module_env; module = &module_env;
module->origin = kAsmJsOrigin; module->origin = kAsmJsOrigin;
for (int i = 0; i < arraysize(AsmJsBinOps); i++) { for (size_t i = 0; i < arraysize(AsmJsBinOps); i++) {
TestBinop(AsmJsBinOps[i].op, AsmJsBinOps[i].sig); TestBinop(AsmJsBinOps[i].op, AsmJsBinOps[i].sig);
} }
} }
...@@ -1706,7 +1706,7 @@ TEST_F(AstDecoderTest, AsmJsBinOpsCheckOrigin) { ...@@ -1706,7 +1706,7 @@ TEST_F(AstDecoderTest, AsmJsBinOpsCheckOrigin) {
TestModuleEnv module_env; TestModuleEnv module_env;
module = &module_env; module = &module_env;
module->origin = kWasmOrigin; module->origin = kWasmOrigin;
for (int i = 0; i < arraysize(AsmJsBinOps); i++) { for (size_t i = 0; i < arraysize(AsmJsBinOps); i++) {
byte code[] = { byte code[] = {
WASM_BINOP(AsmJsBinOps[i].op, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))}; WASM_BINOP(AsmJsBinOps[i].op, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))};
EXPECT_FAILURE_SC(AsmJsBinOps[i].sig, code); EXPECT_FAILURE_SC(AsmJsBinOps[i].sig, code);
...@@ -1745,7 +1745,7 @@ TEST_F(AstDecoderTest, AsmJsUnOpsCheckOrigin) { ...@@ -1745,7 +1745,7 @@ TEST_F(AstDecoderTest, AsmJsUnOpsCheckOrigin) {
TestModuleEnv module_env; TestModuleEnv module_env;
module = &module_env; module = &module_env;
module->origin = kAsmJsOrigin; module->origin = kAsmJsOrigin;
for (int i = 0; i < arraysize(AsmJsUnOps); i++) { for (size_t i = 0; i < arraysize(AsmJsUnOps); i++) {
TestUnop(AsmJsUnOps[i].op, AsmJsUnOps[i].sig); TestUnop(AsmJsUnOps[i].op, AsmJsUnOps[i].sig);
} }
} }
...@@ -1754,7 +1754,7 @@ TEST_F(AstDecoderTest, AsmJsUnOpsCheckOrigin) { ...@@ -1754,7 +1754,7 @@ TEST_F(AstDecoderTest, AsmJsUnOpsCheckOrigin) {
TestModuleEnv module_env; TestModuleEnv module_env;
module = &module_env; module = &module_env;
module->origin = kWasmOrigin; module->origin = kWasmOrigin;
for (int i = 0; i < arraysize(AsmJsUnOps); i++) { for (size_t i = 0; i < arraysize(AsmJsUnOps); i++) {
byte code[] = {WASM_UNOP(AsmJsUnOps[i].op, WASM_GET_LOCAL(0))}; byte code[] = {WASM_UNOP(AsmJsUnOps[i].op, WASM_GET_LOCAL(0))};
EXPECT_FAILURE_SC(AsmJsUnOps[i].sig, code); EXPECT_FAILURE_SC(AsmJsUnOps[i].sig, code);
} }
......
...@@ -23,19 +23,19 @@ TEST_F(LEBHelperTest, sizeof_u32v) { ...@@ -23,19 +23,19 @@ TEST_F(LEBHelperTest, sizeof_u32v) {
EXPECT_EQ(1, LEBHelper::sizeof_u32v(i)); EXPECT_EQ(1, LEBHelper::sizeof_u32v(i));
} }
for (uint32_t i = (1 << 7); i < (1 << 9); i++) { for (uint32_t i = (1u << 7); i < (1u << 9); i++) {
EXPECT_EQ(2, LEBHelper::sizeof_u32v(i)); EXPECT_EQ(2, LEBHelper::sizeof_u32v(i));
} }
for (uint32_t i = (1 << 14); i < (1 << 16); i += 33) { for (uint32_t i = (1u << 14); i < (1u << 16); i += 33) {
EXPECT_EQ(3, LEBHelper::sizeof_u32v(i)); EXPECT_EQ(3, LEBHelper::sizeof_u32v(i));
} }
for (uint32_t i = (1 << 21); i < (1 << 24); i += 33999) { for (uint32_t i = (1u << 21); i < (1u << 24); i += 33999) {
EXPECT_EQ(4, LEBHelper::sizeof_u32v(i)); EXPECT_EQ(4, LEBHelper::sizeof_u32v(i));
} }
for (uint32_t i = (1 << 28); i < (1 << 31); i += 33997779) { for (uint32_t i = (1u << 28); i < (1u << 31); i += 33997779u) {
EXPECT_EQ(5, LEBHelper::sizeof_u32v(i)); EXPECT_EQ(5, LEBHelper::sizeof_u32v(i));
} }
......
...@@ -1298,7 +1298,7 @@ TEST_F(WasmModuleVerifyTest, ExportTableOne_off_end) { ...@@ -1298,7 +1298,7 @@ TEST_F(WasmModuleVerifyTest, ExportTableOne_off_end) {
FUNC_INDEX(0), // -- FUNC_INDEX(0), // --
}; };
for (int length = 33; length < sizeof(data); length++) { for (size_t length = 33; length < sizeof(data); length++) {
ModuleResult result = DecodeModule(data, data + length); ModuleResult result = DecodeModule(data, data + length);
EXPECT_FALSE(result.ok()); EXPECT_FALSE(result.ok());
if (result.val) delete result.val; if (result.val) delete result.val;
......
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