diff --git a/test/cctest/wasm/test-gc.cc b/test/cctest/wasm/test-gc.cc index 9e6f1a6e52..bda86a777e 100644 --- a/test/cctest/wasm/test-gc.cc +++ b/test/cctest/wasm/test-gc.cc @@ -213,7 +213,7 @@ class WasmGCTester { void CallFunctionImpl(uint32_t function_index, const FunctionSig* sig, CWasmArgumentsPacker* packer) { - WasmCodeRefScope scope; + WasmCodeRefScope code_ref_scope; NativeModule* native_module = instance_->module_object().native_module(); WasmCode* code = native_module->GetCode(function_index); Address wasm_call_target = code->instruction_start(); diff --git a/test/cctest/wasm/test-run-wasm-64.cc b/test/cctest/wasm/test-run-wasm-64.cc index 33e1b8ef60..510f446f84 100644 --- a/test/cctest/wasm/test-run-wasm-64.cc +++ b/test/cctest/wasm/test-run-wasm-64.cc @@ -1481,12 +1481,6 @@ WASM_EXEC_TEST(UnalignedInt64Store) { r.Call(); } -#define ADD_CODE(vec, ...) \ - do { \ - byte __buf[] = {__VA_ARGS__}; \ - for (size_t i = 0; i < sizeof(__buf); i++) vec.push_back(__buf[i]); \ - } while (false) - static void CompileCallIndirectMany(TestExecutionTier tier, ValueType param) { // Make sure we don't run out of registers when compiling indirect calls // with many many parameters. @@ -1545,8 +1539,8 @@ static void Run_WasmMixedCall_N(TestExecutionTier execution_tier, int start) { for (int i = 0; i < num_params; i++) { b.AddParam(ValueType::For(memtypes[i])); } - WasmFunctionCompiler& t = r.NewFunction(b.Build()); - BUILD(t, WASM_LOCAL_GET(which)); + WasmFunctionCompiler& f = r.NewFunction(b.Build()); + BUILD(f, WASM_LOCAL_GET(which)); // ========================================================================= // Build the calling function. @@ -1560,7 +1554,7 @@ static void Run_WasmMixedCall_N(TestExecutionTier execution_tier, int start) { } // Call the selector function. - ADD_CODE(code, WASM_CALL_FUNCTION0(t.function_index())); + ADD_CODE(code, WASM_CALL_FUNCTION0(f.function_index())); // Store the result in a local. byte local_index = r.AllocateLocal(ValueType::For(result)); @@ -1584,8 +1578,8 @@ static void Run_WasmMixedCall_N(TestExecutionTier execution_tier, int start) { for (int i = 0; i < size; i++) { int base = (which + 1) * kElemSize; byte expected = r.builder().raw_mem_at(base + i); - byte result = r.builder().raw_mem_at(i); - CHECK_EQ(expected, result); + byte actual = r.builder().raw_mem_at(i); + CHECK_EQ(expected, actual); } } } @@ -1619,8 +1613,6 @@ WASM_EXEC_TEST(Regression_6858) { CHECK_TRAP64(r.Call(dividend, divisor, filler, filler)); } -#undef ADD_CODE - // clang-format gets confused about these closing parentheses (wants to change // the first comment to "// namespace v8". Disable it. // clang-format off diff --git a/test/cctest/wasm/test-run-wasm-js.cc b/test/cctest/wasm/test-run-wasm-js.cc index 99b539bbc5..88bc0d70a2 100644 --- a/test/cctest/wasm/test-run-wasm-js.cc +++ b/test/cctest/wasm/test-run-wasm-js.cc @@ -21,12 +21,6 @@ namespace v8 { namespace internal { namespace wasm { -#define ADD_CODE(vec, ...) \ - do { \ - byte __buf[] = {__VA_ARGS__}; \ - for (size_t i = 0; i < sizeof(__buf); i++) vec.push_back(__buf[i]); \ - } while (false) - namespace { // A helper for generating predictable but unique argument values that // are easy to debug (e.g. with misaligned stacks). @@ -571,8 +565,6 @@ WASM_COMPILED_EXEC_TEST(Run_ReturnCallIndirectImportedFunction) { RunPickerTest(execution_tier, true); } -#undef ADD_CODE - } // namespace wasm } // namespace internal } // namespace v8 diff --git a/test/cctest/wasm/test-run-wasm.cc b/test/cctest/wasm/test-run-wasm.cc index 87fac5f11f..9e9a6d8c30 100644 --- a/test/cctest/wasm/test-run-wasm.cc +++ b/test/cctest/wasm/test-run-wasm.cc @@ -1648,10 +1648,10 @@ WASM_EXEC_TEST(LoadMem_offset_oob) { r.builder().AddMemoryElems(num_bytes); r.builder().RandomizeMemory(1116 + static_cast(m)); - constexpr byte offset = 8; - uint32_t boundary = num_bytes - offset - machineTypes[m].MemSize(); + constexpr byte kOffset = 8; + uint32_t boundary = num_bytes - kOffset - machineTypes[m].MemSize(); - BUILD(r, WASM_LOAD_MEM_OFFSET(machineTypes[m], offset, WASM_LOCAL_GET(0)), + BUILD(r, WASM_LOAD_MEM_OFFSET(machineTypes[m], kOffset, WASM_LOCAL_GET(0)), WASM_DROP, WASM_ZERO); CHECK_EQ(0, r.Call(boundary)); // in bounds. @@ -2743,12 +2743,6 @@ UNINITIALIZED_WASM_EXEC_TEST(ReturnCall_Bounce_Sum) { } } -#define ADD_CODE(vec, ...) \ - do { \ - byte __buf[] = {__VA_ARGS__}; \ - for (size_t i = 0; i < sizeof(__buf); ++i) vec.push_back(__buf[i]); \ - } while (false) - static void Run_WasmMixedCall_N(TestExecutionTier execution_tier, int start) { const int kExpected = 6333; const int kElemSize = 8; @@ -2778,8 +2772,8 @@ static void Run_WasmMixedCall_N(TestExecutionTier execution_tier, int start) { for (int i = 0; i < num_params; ++i) { b.AddParam(ValueType::For(memtypes[i])); } - WasmFunctionCompiler& t = r.NewFunction(b.Build()); - BUILD(t, WASM_LOCAL_GET(which)); + WasmFunctionCompiler& f = r.NewFunction(b.Build()); + BUILD(f, WASM_LOCAL_GET(which)); // ========================================================================= // Build the calling function. @@ -2793,7 +2787,7 @@ static void Run_WasmMixedCall_N(TestExecutionTier execution_tier, int start) { } // Call the selector function. - ADD_CODE(code, WASM_CALL_FUNCTION0(t.function_index())); + ADD_CODE(code, WASM_CALL_FUNCTION0(f.function_index())); // Store the result in a local. byte local_index = r.AllocateLocal(ValueType::For(result)); @@ -2817,8 +2811,8 @@ static void Run_WasmMixedCall_N(TestExecutionTier execution_tier, int start) { for (int i = 0; i < size; ++i) { int base = (which + 1) * kElemSize; byte expected = r.builder().raw_mem_at(base + i); - byte result = r.builder().raw_mem_at(i); - CHECK_EQ(expected, result); + byte actual = r.builder().raw_mem_at(i); + CHECK_EQ(expected, actual); } } } @@ -3990,7 +3984,6 @@ TEST(Regression_1185323_1185492) { #undef B2 #undef RET #undef RET_I8 -#undef ADD_CODE } // namespace test_run_wasm } // namespace wasm diff --git a/test/cctest/wasm/wasm-run-utils.h b/test/cctest/wasm/wasm-run-utils.h index d0a5160c0e..f5a3ce2389 100644 --- a/test/cctest/wasm/wasm-run-utils.h +++ b/test/cctest/wasm/wasm-run-utils.h @@ -84,10 +84,17 @@ using compiler::Node; #define WASM_WRAPPER_RETURN_VALUE 8754 -#define BUILD(r, ...) \ - do { \ - byte code[] = {__VA_ARGS__}; \ - r.Build(code, code + arraysize(code)); \ +#define BUILD(r, ...) \ + do { \ + byte __code[] = {__VA_ARGS__}; \ + r.Build(__code, __code + arraysize(__code)); \ + } while (false) + +#define ADD_CODE(vec, ...) \ + do { \ + byte __buf[] = {__VA_ARGS__}; \ + for (size_t __i = 0; __i < sizeof(__buf); __i++) \ + vec.push_back(__buf[__i]); \ } while (false) // For tests that must manually import a JSFunction with source code.