[cleanup] Fix -Wshadow warnings in cctest/wasm
Drive-by clean-up to move ADD_CODE, which is defined the same way in multiple files, into wasm-run-utils.h. R=adamk@chromium.org Bug: v8:12244 Change-Id: I61d54cf2c589c3f8b69950fba097d8754bb99c5a Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3183524 Reviewed-by: Adam Klein <adamk@chromium.org> Commit-Queue: Zhi An Ng <zhin@chromium.org> Cr-Commit-Position: refs/heads/main@{#77065}
This commit is contained in:
parent
c9ddba2bf6
commit
4c8cc64ee7
@ -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();
|
||||
|
@ -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<byte>(base + i);
|
||||
byte result = r.builder().raw_mem_at<byte>(i);
|
||||
CHECK_EQ(expected, result);
|
||||
byte actual = r.builder().raw_mem_at<byte>(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
|
||||
|
@ -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
|
||||
|
@ -1648,10 +1648,10 @@ WASM_EXEC_TEST(LoadMem_offset_oob) {
|
||||
r.builder().AddMemoryElems<byte>(num_bytes);
|
||||
r.builder().RandomizeMemory(1116 + static_cast<int>(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<byte>(base + i);
|
||||
byte result = r.builder().raw_mem_at<byte>(i);
|
||||
CHECK_EQ(expected, result);
|
||||
byte actual = r.builder().raw_mem_at<byte>(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
|
||||
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user