Commit 28050fee authored by Clemens Backes's avatar Clemens Backes Committed by Commit Bot

[wasm][cleanup] Rename WASM_GROW_MEMORY to WASM_MEMORY_GROW

The text representation of that opcode is "memory.grow", so the macro
should also be called WASM_MEMORY_GROW. This is also consistent with
WASM_MEMORY_SIZE.

R=thibaudm@chromium.org

Change-Id: Ibda328e52418d04392856820d3099f2dadaaf98f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2764466Reviewed-by: 's avatarThibaud Michaud <thibaudm@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#73477}
parent be4c28eb
...@@ -83,7 +83,7 @@ TEST(Run_WasmModule_Buffer_Externalized_GrowMem) { ...@@ -83,7 +83,7 @@ TEST(Run_WasmModule_Buffer_Externalized_GrowMem) {
WasmModuleBuilder* builder = zone.New<WasmModuleBuilder>(&zone); WasmModuleBuilder* builder = zone.New<WasmModuleBuilder>(&zone);
WasmFunctionBuilder* f = builder->AddFunction(sigs.i_v()); WasmFunctionBuilder* f = builder->AddFunction(sigs.i_v());
ExportAsMain(f); ExportAsMain(f);
byte code[] = {WASM_GROW_MEMORY(WASM_I32V_1(6)), WASM_DROP, byte code[] = {WASM_MEMORY_GROW(WASM_I32V_1(6)), WASM_DROP,
WASM_MEMORY_SIZE}; WASM_MEMORY_SIZE};
EMIT_CODE_WITH_END(f, code); EMIT_CODE_WITH_END(f, code);
......
...@@ -312,14 +312,14 @@ TEST(MemoryGrow) { ...@@ -312,14 +312,14 @@ TEST(MemoryGrow) {
WasmRunner<int32_t, uint32_t> r(TestExecutionTier::kInterpreter); WasmRunner<int32_t, uint32_t> r(TestExecutionTier::kInterpreter);
r.builder().AddMemory(kWasmPageSize); r.builder().AddMemory(kWasmPageSize);
r.builder().SetMaxMemPages(10); r.builder().SetMaxMemPages(10);
BUILD(r, WASM_GROW_MEMORY(WASM_LOCAL_GET(0))); BUILD(r, WASM_MEMORY_GROW(WASM_LOCAL_GET(0)));
CHECK_EQ(1, r.Call(1)); CHECK_EQ(1, r.Call(1));
} }
{ {
WasmRunner<int32_t, uint32_t> r(TestExecutionTier::kInterpreter); WasmRunner<int32_t, uint32_t> r(TestExecutionTier::kInterpreter);
r.builder().AddMemory(kWasmPageSize); r.builder().AddMemory(kWasmPageSize);
r.builder().SetMaxMemPages(10); r.builder().SetMaxMemPages(10);
BUILD(r, WASM_GROW_MEMORY(WASM_LOCAL_GET(0))); BUILD(r, WASM_MEMORY_GROW(WASM_LOCAL_GET(0)));
CHECK_EQ(-1, r.Call(11)); CHECK_EQ(-1, r.Call(11));
} }
} }
...@@ -332,7 +332,7 @@ TEST(MemoryGrowPreservesData) { ...@@ -332,7 +332,7 @@ TEST(MemoryGrowPreservesData) {
BUILD( BUILD(
r, r,
WASM_STORE_MEM(MachineType::Int32(), WASM_I32V(index), WASM_I32V(value)), WASM_STORE_MEM(MachineType::Int32(), WASM_I32V(index), WASM_I32V(value)),
WASM_GROW_MEMORY(WASM_LOCAL_GET(0)), WASM_DROP, WASM_MEMORY_GROW(WASM_LOCAL_GET(0)), WASM_DROP,
WASM_LOAD_MEM(MachineType::Int32(), WASM_I32V(index))); WASM_LOAD_MEM(MachineType::Int32(), WASM_I32V(index)));
CHECK_EQ(value, r.Call(1)); CHECK_EQ(value, r.Call(1));
} }
...@@ -341,7 +341,7 @@ TEST(MemoryGrowInvalidSize) { ...@@ -341,7 +341,7 @@ TEST(MemoryGrowInvalidSize) {
// Grow memory by an invalid amount without initial memory. // Grow memory by an invalid amount without initial memory.
WasmRunner<int32_t, uint32_t> r(TestExecutionTier::kInterpreter); WasmRunner<int32_t, uint32_t> r(TestExecutionTier::kInterpreter);
r.builder().AddMemory(kWasmPageSize); r.builder().AddMemory(kWasmPageSize);
BUILD(r, WASM_GROW_MEMORY(WASM_LOCAL_GET(0))); BUILD(r, WASM_MEMORY_GROW(WASM_LOCAL_GET(0)));
CHECK_EQ(-1, r.Call(1048575)); CHECK_EQ(-1, r.Call(1048575));
} }
......
...@@ -471,7 +471,7 @@ TEST(Run_WasmModule_MemSize_GrowMem) { ...@@ -471,7 +471,7 @@ TEST(Run_WasmModule_MemSize_GrowMem) {
WasmModuleBuilder* builder = zone.New<WasmModuleBuilder>(&zone); WasmModuleBuilder* builder = zone.New<WasmModuleBuilder>(&zone);
WasmFunctionBuilder* f = builder->AddFunction(sigs.i_v()); WasmFunctionBuilder* f = builder->AddFunction(sigs.i_v());
ExportAsMain(f); ExportAsMain(f);
byte code[] = {WASM_GROW_MEMORY(WASM_I32V_1(10)), WASM_DROP, byte code[] = {WASM_MEMORY_GROW(WASM_I32V_1(10)), WASM_DROP,
WASM_MEMORY_SIZE}; WASM_MEMORY_SIZE};
EMIT_CODE_WITH_END(f, code); EMIT_CODE_WITH_END(f, code);
TestModule(&zone, builder, kExpectedValue); TestModule(&zone, builder, kExpectedValue);
...@@ -490,7 +490,7 @@ TEST(MemoryGrowZero) { ...@@ -490,7 +490,7 @@ TEST(MemoryGrowZero) {
WasmModuleBuilder* builder = zone.New<WasmModuleBuilder>(&zone); WasmModuleBuilder* builder = zone.New<WasmModuleBuilder>(&zone);
WasmFunctionBuilder* f = builder->AddFunction(sigs.i_v()); WasmFunctionBuilder* f = builder->AddFunction(sigs.i_v());
ExportAsMain(f); ExportAsMain(f);
byte code[] = {WASM_GROW_MEMORY(WASM_I32V(0))}; byte code[] = {WASM_MEMORY_GROW(WASM_I32V(0))};
EMIT_CODE_WITH_END(f, code); EMIT_CODE_WITH_END(f, code);
TestModule(&zone, builder, kExpectedValue); TestModule(&zone, builder, kExpectedValue);
} }
...@@ -597,7 +597,7 @@ TEST(Run_WasmModule_MemoryGrowInIf) { ...@@ -597,7 +597,7 @@ TEST(Run_WasmModule_MemoryGrowInIf) {
WasmModuleBuilder* builder = zone.New<WasmModuleBuilder>(&zone); WasmModuleBuilder* builder = zone.New<WasmModuleBuilder>(&zone);
WasmFunctionBuilder* f = builder->AddFunction(sigs.i_v()); WasmFunctionBuilder* f = builder->AddFunction(sigs.i_v());
ExportAsMain(f); ExportAsMain(f);
byte code[] = {WASM_IF_ELSE_I(WASM_I32V(0), WASM_GROW_MEMORY(WASM_I32V(1)), byte code[] = {WASM_IF_ELSE_I(WASM_I32V(0), WASM_MEMORY_GROW(WASM_I32V(1)),
WASM_I32V(12))}; WASM_I32V(12))};
EMIT_CODE_WITH_END(f, code); EMIT_CODE_WITH_END(f, code);
TestModule(&zone, builder, 12); TestModule(&zone, builder, 12);
...@@ -618,7 +618,7 @@ TEST(Run_WasmModule_GrowMemOobOffset) { ...@@ -618,7 +618,7 @@ TEST(Run_WasmModule_GrowMemOobOffset) {
WasmModuleBuilder* builder = zone.New<WasmModuleBuilder>(&zone); WasmModuleBuilder* builder = zone.New<WasmModuleBuilder>(&zone);
WasmFunctionBuilder* f = builder->AddFunction(sigs.i_v()); WasmFunctionBuilder* f = builder->AddFunction(sigs.i_v());
ExportAsMain(f); ExportAsMain(f);
byte code[] = {WASM_GROW_MEMORY(WASM_I32V_1(1)), byte code[] = {WASM_MEMORY_GROW(WASM_I32V_1(1)),
WASM_STORE_MEM(MachineType::Int32(), WASM_I32V(index), WASM_STORE_MEM(MachineType::Int32(), WASM_I32V(index),
WASM_I32V(value))}; WASM_I32V(value))};
EMIT_CODE_WITH_END(f, code); EMIT_CODE_WITH_END(f, code);
...@@ -640,7 +640,7 @@ TEST(Run_WasmModule_GrowMemOobFixedIndex) { ...@@ -640,7 +640,7 @@ TEST(Run_WasmModule_GrowMemOobFixedIndex) {
WasmModuleBuilder* builder = zone.New<WasmModuleBuilder>(&zone); WasmModuleBuilder* builder = zone.New<WasmModuleBuilder>(&zone);
WasmFunctionBuilder* f = builder->AddFunction(sigs.i_i()); WasmFunctionBuilder* f = builder->AddFunction(sigs.i_i());
ExportAsMain(f); ExportAsMain(f);
byte code[] = {WASM_GROW_MEMORY(WASM_LOCAL_GET(0)), WASM_DROP, byte code[] = {WASM_MEMORY_GROW(WASM_LOCAL_GET(0)), WASM_DROP,
WASM_STORE_MEM(MachineType::Int32(), WASM_I32V(index), WASM_STORE_MEM(MachineType::Int32(), WASM_I32V(index),
WASM_I32V(value)), WASM_I32V(value)),
WASM_LOAD_MEM(MachineType::Int32(), WASM_I32V(index))}; WASM_LOAD_MEM(MachineType::Int32(), WASM_I32V(index))};
...@@ -687,7 +687,7 @@ TEST(Run_WasmModule_GrowMemOobVariableIndex) { ...@@ -687,7 +687,7 @@ TEST(Run_WasmModule_GrowMemOobVariableIndex) {
WasmModuleBuilder* builder = zone.New<WasmModuleBuilder>(&zone); WasmModuleBuilder* builder = zone.New<WasmModuleBuilder>(&zone);
WasmFunctionBuilder* f = builder->AddFunction(sigs.i_i()); WasmFunctionBuilder* f = builder->AddFunction(sigs.i_i());
ExportAsMain(f); ExportAsMain(f);
byte code[] = {WASM_GROW_MEMORY(WASM_I32V_1(1)), WASM_DROP, byte code[] = {WASM_MEMORY_GROW(WASM_I32V_1(1)), WASM_DROP,
WASM_STORE_MEM(MachineType::Int32(), WASM_LOCAL_GET(0), WASM_STORE_MEM(MachineType::Int32(), WASM_LOCAL_GET(0),
WASM_I32V(value)), WASM_I32V(value)),
WASM_LOAD_MEM(MachineType::Int32(), WASM_LOCAL_GET(0))}; WASM_LOAD_MEM(MachineType::Int32(), WASM_LOCAL_GET(0))};
......
...@@ -807,7 +807,7 @@ inline WasmOpcode LoadStoreOpcodeOf(MachineType type, bool store) { ...@@ -807,7 +807,7 @@ inline WasmOpcode LoadStoreOpcodeOf(MachineType type, bool store) {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// Memory Operations. // Memory Operations.
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#define WASM_GROW_MEMORY(x) x, kExprMemoryGrow, 0 #define WASM_MEMORY_GROW(x) x, kExprMemoryGrow, 0
#define WASM_MEMORY_SIZE kExprMemorySize, 0 #define WASM_MEMORY_SIZE kExprMemorySize, 0
#define SIG_ENTRY_v_v kWasmFunctionTypeCode, 0, 0 #define SIG_ENTRY_v_v kWasmFunctionTypeCode, 0, 0
......
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