Commit 91b102c7 authored by Clemens Backes's avatar Clemens Backes Committed by Commit Bot

[test][cleanup] Rename WASM_*_LOCAL to WASM_LOCAL_*

The opcodes were renamed long ago, but the macros were still using the
old syntax.

This CL was created using the following command (for WASM_GET_LOCAL,
    WASM_SET_LOCAL, and WASM_TEE_LOCAL):
ag -l WASM_GET_LOCAL | xargs -L 1 sed -i 's/\bWASM_SET_LOCAL\b/WASM_LOCAL_SET/g'

R=ahaas@chromium.org

Bug: v8:11074
Change-Id: I0018bea185030be29344e66e59706fed183cc2f1
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2595446Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#71835}
parent a8f877bf
...@@ -26680,9 +26680,9 @@ TEST(WasmI32AtomicWaitCallback) { ...@@ -26680,9 +26680,9 @@ TEST(WasmI32AtomicWaitCallback) {
WasmRunner<int32_t, int32_t, int32_t, double> r(TestExecutionTier::kTurbofan); WasmRunner<int32_t, int32_t, int32_t, double> r(TestExecutionTier::kTurbofan);
r.builder().AddMemory(kWasmPageSize, SharedFlag::kShared); r.builder().AddMemory(kWasmPageSize, SharedFlag::kShared);
r.builder().SetHasSharedMemory(); r.builder().SetHasSharedMemory();
BUILD(r, WASM_ATOMICS_WAIT(kExprI32AtomicWait, WASM_GET_LOCAL(0), BUILD(r, WASM_ATOMICS_WAIT(kExprI32AtomicWait, WASM_LOCAL_GET(0),
WASM_GET_LOCAL(1), WASM_LOCAL_GET(1),
WASM_I64_SCONVERT_F64(WASM_GET_LOCAL(2)), 4)); WASM_I64_SCONVERT_F64(WASM_LOCAL_GET(2)), 4));
LocalContext env; LocalContext env;
v8::Isolate* isolate = env->GetIsolate(); v8::Isolate* isolate = env->GetIsolate();
v8::HandleScope scope(isolate); v8::HandleScope scope(isolate);
...@@ -26716,9 +26716,9 @@ TEST(WasmI64AtomicWaitCallback) { ...@@ -26716,9 +26716,9 @@ TEST(WasmI64AtomicWaitCallback) {
WasmRunner<int32_t, int32_t, double, double> r(TestExecutionTier::kTurbofan); WasmRunner<int32_t, int32_t, double, double> r(TestExecutionTier::kTurbofan);
r.builder().AddMemory(kWasmPageSize, SharedFlag::kShared); r.builder().AddMemory(kWasmPageSize, SharedFlag::kShared);
r.builder().SetHasSharedMemory(); r.builder().SetHasSharedMemory();
BUILD(r, WASM_ATOMICS_WAIT(kExprI64AtomicWait, WASM_GET_LOCAL(0), BUILD(r, WASM_ATOMICS_WAIT(kExprI64AtomicWait, WASM_LOCAL_GET(0),
WASM_I64_SCONVERT_F64(WASM_GET_LOCAL(1)), WASM_I64_SCONVERT_F64(WASM_LOCAL_GET(1)),
WASM_I64_SCONVERT_F64(WASM_GET_LOCAL(2)), 8)); WASM_I64_SCONVERT_F64(WASM_LOCAL_GET(2)), 8));
LocalContext env; LocalContext env;
v8::Isolate* isolate = env->GetIsolate(); v8::Isolate* isolate = env->GetIsolate();
v8::HandleScope scope(isolate); v8::HandleScope scope(isolate);
...@@ -91,7 +91,7 @@ class CWasmEntryArgTester { ...@@ -91,7 +91,7 @@ class CWasmEntryArgTester {
TEST(TestCWasmEntryArgPassing_int32) { TEST(TestCWasmEntryArgPassing_int32) {
CWasmEntryArgTester<int32_t, int32_t> tester( CWasmEntryArgTester<int32_t, int32_t> tester(
{// Return 2*<0> + 1. {// Return 2*<0> + 1.
WASM_I32_ADD(WASM_I32_MUL(WASM_I32V_1(2), WASM_GET_LOCAL(0)), WASM_ONE)}, WASM_I32_ADD(WASM_I32_MUL(WASM_I32V_1(2), WASM_LOCAL_GET(0)), WASM_ONE)},
[](int32_t a) { [](int32_t a) {
return base::AddWithWraparound(base::MulWithWraparound(2, a), 1); return base::AddWithWraparound(base::MulWithWraparound(2, a), 1);
}); });
...@@ -103,7 +103,7 @@ TEST(TestCWasmEntryArgPassing_int32) { ...@@ -103,7 +103,7 @@ TEST(TestCWasmEntryArgPassing_int32) {
TEST(TestCWasmEntryArgPassing_double_int64) { TEST(TestCWasmEntryArgPassing_double_int64) {
CWasmEntryArgTester<double, int64_t> tester( CWasmEntryArgTester<double, int64_t> tester(
{// Return (double)<0>. {// Return (double)<0>.
WASM_F64_SCONVERT_I64(WASM_GET_LOCAL(0))}, WASM_F64_SCONVERT_I64(WASM_LOCAL_GET(0))},
[](int64_t a) { return static_cast<double>(a); }); [](int64_t a) { return static_cast<double>(a); });
FOR_INT64_INPUTS(v) { tester.CheckCall(v); } FOR_INT64_INPUTS(v) { tester.CheckCall(v); }
...@@ -113,7 +113,7 @@ TEST(TestCWasmEntryArgPassing_double_int64) { ...@@ -113,7 +113,7 @@ TEST(TestCWasmEntryArgPassing_double_int64) {
TEST(TestCWasmEntryArgPassing_int64_double) { TEST(TestCWasmEntryArgPassing_int64_double) {
CWasmEntryArgTester<int64_t, double> tester( CWasmEntryArgTester<int64_t, double> tester(
{// Return (int64_t)<0>. {// Return (int64_t)<0>.
WASM_I64_SCONVERT_F64(WASM_GET_LOCAL(0))}, WASM_I64_SCONVERT_F64(WASM_LOCAL_GET(0))},
[](double d) { return static_cast<int64_t>(d); }); [](double d) { return static_cast<int64_t>(d); });
FOR_FLOAT64_INPUTS(d) { FOR_FLOAT64_INPUTS(d) {
...@@ -128,7 +128,7 @@ TEST(TestCWasmEntryArgPassing_float_double) { ...@@ -128,7 +128,7 @@ TEST(TestCWasmEntryArgPassing_float_double) {
CWasmEntryArgTester<double, float> tester( CWasmEntryArgTester<double, float> tester(
{// Return 2*(double)<0> + 1. {// Return 2*(double)<0> + 1.
WASM_F64_ADD( WASM_F64_ADD(
WASM_F64_MUL(WASM_F64(2), WASM_F64_CONVERT_F32(WASM_GET_LOCAL(0))), WASM_F64_MUL(WASM_F64(2), WASM_F64_CONVERT_F32(WASM_LOCAL_GET(0))),
WASM_F64(1))}, WASM_F64(1))},
[](float f) { return 2. * static_cast<double>(f) + 1.; }); [](float f) { return 2. * static_cast<double>(f) + 1.; });
...@@ -139,7 +139,7 @@ TEST(TestCWasmEntryArgPassing_float_double) { ...@@ -139,7 +139,7 @@ TEST(TestCWasmEntryArgPassing_float_double) {
TEST(TestCWasmEntryArgPassing_double_double) { TEST(TestCWasmEntryArgPassing_double_double) {
CWasmEntryArgTester<double, double, double> tester( CWasmEntryArgTester<double, double, double> tester(
{// Return <0> + <1>. {// Return <0> + <1>.
WASM_F64_ADD(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))}, WASM_F64_ADD(WASM_LOCAL_GET(0), WASM_LOCAL_GET(1))},
[](double a, double b) { return a + b; }); [](double a, double b) { return a + b; });
FOR_FLOAT64_INPUTS(d1) { FOR_FLOAT64_INPUTS(d1) {
...@@ -156,11 +156,11 @@ TEST(TestCWasmEntryArgPassing_AllTypes) { ...@@ -156,11 +156,11 @@ TEST(TestCWasmEntryArgPassing_AllTypes) {
WASM_F64_ADD( // <0+1> + <2> WASM_F64_ADD( // <0+1> + <2>
WASM_F64_ADD( // <0> + <1> WASM_F64_ADD( // <0> + <1>
WASM_F64_SCONVERT_I32( WASM_F64_SCONVERT_I32(
WASM_GET_LOCAL(0)), // <0> to double WASM_LOCAL_GET(0)), // <0> to double
WASM_F64_SCONVERT_I64( WASM_F64_SCONVERT_I64(
WASM_GET_LOCAL(1))), // <1> to double WASM_LOCAL_GET(1))), // <1> to double
WASM_F64_CONVERT_F32(WASM_GET_LOCAL(2))), // <2> to double WASM_F64_CONVERT_F32(WASM_LOCAL_GET(2))), // <2> to double
WASM_GET_LOCAL(3)) // <3> WASM_LOCAL_GET(3)) // <3>
}, },
[](int32_t a, int64_t b, float c, double d) { [](int32_t a, int64_t b, float c, double d) {
return 0. + a + b + c + d; return 0. + a + b + c + d;
......
This diff is collapsed.
...@@ -267,44 +267,44 @@ TEST(Liftoff_deterministic_simple) { ...@@ -267,44 +267,44 @@ TEST(Liftoff_deterministic_simple) {
LiftoffCompileEnvironment env; LiftoffCompileEnvironment env;
env.CheckDeterministicCompilation( env.CheckDeterministicCompilation(
{kWasmI32}, {kWasmI32, kWasmI32}, {kWasmI32}, {kWasmI32, kWasmI32},
{WASM_I32_ADD(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))}); {WASM_I32_ADD(WASM_LOCAL_GET(0), WASM_LOCAL_GET(1))});
} }
TEST(Liftoff_deterministic_call) { TEST(Liftoff_deterministic_call) {
LiftoffCompileEnvironment env; LiftoffCompileEnvironment env;
env.CheckDeterministicCompilation( env.CheckDeterministicCompilation(
{kWasmI32}, {kWasmI32}, {kWasmI32}, {kWasmI32},
{WASM_I32_ADD(WASM_CALL_FUNCTION(0, WASM_GET_LOCAL(0)), {WASM_I32_ADD(WASM_CALL_FUNCTION(0, WASM_LOCAL_GET(0)),
WASM_GET_LOCAL(0))}); WASM_LOCAL_GET(0))});
} }
TEST(Liftoff_deterministic_indirect_call) { TEST(Liftoff_deterministic_indirect_call) {
LiftoffCompileEnvironment env; LiftoffCompileEnvironment env;
env.CheckDeterministicCompilation( env.CheckDeterministicCompilation(
{kWasmI32}, {kWasmI32}, {kWasmI32}, {kWasmI32},
{WASM_I32_ADD(WASM_CALL_INDIRECT(0, WASM_GET_LOCAL(0), WASM_I32V_1(47)), {WASM_I32_ADD(WASM_CALL_INDIRECT(0, WASM_LOCAL_GET(0), WASM_I32V_1(47)),
WASM_GET_LOCAL(0))}); WASM_LOCAL_GET(0))});
} }
TEST(Liftoff_deterministic_loop) { TEST(Liftoff_deterministic_loop) {
LiftoffCompileEnvironment env; LiftoffCompileEnvironment env;
env.CheckDeterministicCompilation( env.CheckDeterministicCompilation(
{kWasmI32}, {kWasmI32}, {kWasmI32}, {kWasmI32},
{WASM_LOOP(WASM_BR_IF(0, WASM_GET_LOCAL(0))), WASM_GET_LOCAL(0)}); {WASM_LOOP(WASM_BR_IF(0, WASM_LOCAL_GET(0))), WASM_LOCAL_GET(0)});
} }
TEST(Liftoff_deterministic_trap) { TEST(Liftoff_deterministic_trap) {
LiftoffCompileEnvironment env; LiftoffCompileEnvironment env;
env.CheckDeterministicCompilation( env.CheckDeterministicCompilation(
{kWasmI32}, {kWasmI32, kWasmI32}, {kWasmI32}, {kWasmI32, kWasmI32},
{WASM_I32_DIVS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))}); {WASM_I32_DIVS(WASM_LOCAL_GET(0), WASM_LOCAL_GET(1))});
} }
TEST(Liftoff_debug_side_table_simple) { TEST(Liftoff_debug_side_table_simple) {
LiftoffCompileEnvironment env; LiftoffCompileEnvironment env;
auto debug_side_table = env.GenerateDebugSideTable( auto debug_side_table = env.GenerateDebugSideTable(
{kWasmI32}, {kWasmI32, kWasmI32}, {kWasmI32}, {kWasmI32, kWasmI32},
{WASM_I32_ADD(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))}); {WASM_I32_ADD(WASM_LOCAL_GET(0), WASM_LOCAL_GET(1))});
CheckDebugSideTable( CheckDebugSideTable(
{ {
// function entry, locals in registers. // function entry, locals in registers.
...@@ -319,8 +319,8 @@ TEST(Liftoff_debug_side_table_call) { ...@@ -319,8 +319,8 @@ TEST(Liftoff_debug_side_table_call) {
LiftoffCompileEnvironment env; LiftoffCompileEnvironment env;
auto debug_side_table = env.GenerateDebugSideTable( auto debug_side_table = env.GenerateDebugSideTable(
{kWasmI32}, {kWasmI32}, {kWasmI32}, {kWasmI32},
{WASM_I32_ADD(WASM_CALL_FUNCTION(0, WASM_GET_LOCAL(0)), {WASM_I32_ADD(WASM_CALL_FUNCTION(0, WASM_LOCAL_GET(0)),
WASM_GET_LOCAL(0))}); WASM_LOCAL_GET(0))});
CheckDebugSideTable( CheckDebugSideTable(
{ {
// function entry, local in register. // function entry, local in register.
...@@ -338,9 +338,9 @@ TEST(Liftoff_debug_side_table_call_const) { ...@@ -338,9 +338,9 @@ TEST(Liftoff_debug_side_table_call_const) {
constexpr int kConst = 13; constexpr int kConst = 13;
auto debug_side_table = env.GenerateDebugSideTable( auto debug_side_table = env.GenerateDebugSideTable(
{kWasmI32}, {kWasmI32}, {kWasmI32}, {kWasmI32},
{WASM_SET_LOCAL(0, WASM_I32V_1(kConst)), {WASM_LOCAL_SET(0, WASM_I32V_1(kConst)),
WASM_I32_ADD(WASM_CALL_FUNCTION(0, WASM_GET_LOCAL(0)), WASM_I32_ADD(WASM_CALL_FUNCTION(0, WASM_LOCAL_GET(0)),
WASM_GET_LOCAL(0))}); WASM_LOCAL_GET(0))});
CheckDebugSideTable( CheckDebugSideTable(
{ {
// function entry, local in register. // function entry, local in register.
...@@ -358,8 +358,8 @@ TEST(Liftoff_debug_side_table_indirect_call) { ...@@ -358,8 +358,8 @@ TEST(Liftoff_debug_side_table_indirect_call) {
constexpr int kConst = 47; constexpr int kConst = 47;
auto debug_side_table = env.GenerateDebugSideTable( auto debug_side_table = env.GenerateDebugSideTable(
{kWasmI32}, {kWasmI32}, {kWasmI32}, {kWasmI32},
{WASM_I32_ADD(WASM_CALL_INDIRECT(0, WASM_I32V_1(47), WASM_GET_LOCAL(0)), {WASM_I32_ADD(WASM_CALL_INDIRECT(0, WASM_I32V_1(47), WASM_LOCAL_GET(0)),
WASM_GET_LOCAL(0))}); WASM_LOCAL_GET(0))});
CheckDebugSideTable( CheckDebugSideTable(
{ {
// function entry, local in register. // function entry, local in register.
...@@ -381,7 +381,7 @@ TEST(Liftoff_debug_side_table_loop) { ...@@ -381,7 +381,7 @@ TEST(Liftoff_debug_side_table_loop) {
constexpr int kConst = 42; constexpr int kConst = 42;
auto debug_side_table = env.GenerateDebugSideTable( auto debug_side_table = env.GenerateDebugSideTable(
{kWasmI32}, {kWasmI32}, {kWasmI32}, {kWasmI32},
{WASM_I32V_1(kConst), WASM_LOOP(WASM_BR_IF(0, WASM_GET_LOCAL(0)))}); {WASM_I32V_1(kConst), WASM_LOOP(WASM_BR_IF(0, WASM_LOCAL_GET(0)))});
CheckDebugSideTable( CheckDebugSideTable(
{ {
// function entry, local in register. // function entry, local in register.
...@@ -398,7 +398,7 @@ TEST(Liftoff_debug_side_table_trap) { ...@@ -398,7 +398,7 @@ TEST(Liftoff_debug_side_table_trap) {
LiftoffCompileEnvironment env; LiftoffCompileEnvironment env;
auto debug_side_table = env.GenerateDebugSideTable( auto debug_side_table = env.GenerateDebugSideTable(
{kWasmI32}, {kWasmI32, kWasmI32}, {kWasmI32}, {kWasmI32, kWasmI32},
{WASM_I32_DIVS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))}); {WASM_I32_DIVS(WASM_LOCAL_GET(0), WASM_LOCAL_GET(1))});
CheckDebugSideTable( CheckDebugSideTable(
{ {
// function entry, locals in registers. // function entry, locals in registers.
...@@ -418,7 +418,7 @@ TEST(Liftoff_breakpoint_simple) { ...@@ -418,7 +418,7 @@ TEST(Liftoff_breakpoint_simple) {
// Set two breakpoints. At both locations, values are live in registers. // Set two breakpoints. At both locations, values are live in registers.
auto debug_side_table = env.GenerateDebugSideTable( auto debug_side_table = env.GenerateDebugSideTable(
{kWasmI32}, {kWasmI32, kWasmI32}, {kWasmI32}, {kWasmI32, kWasmI32},
{WASM_I32_ADD(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))}, {WASM_I32_ADD(WASM_LOCAL_GET(0), WASM_LOCAL_GET(1))},
{ {
1, // break at beginning of function (first local.get) 1, // break at beginning of function (first local.get)
5 // break at i32.add 5 // break at i32.add
......
This diff is collapsed.
...@@ -34,7 +34,7 @@ namespace wasm { ...@@ -34,7 +34,7 @@ namespace wasm {
ASMJS_EXEC_TEST(Int32AsmjsDivS) { ASMJS_EXEC_TEST(Int32AsmjsDivS) {
WasmRunner<int32_t, int32_t, int32_t> r(execution_tier); WasmRunner<int32_t, int32_t, int32_t> r(execution_tier);
r.builder().ChangeOriginToAsmjs(); r.builder().ChangeOriginToAsmjs();
BUILD(r, WASM_BINOP(kExprI32AsmjsDivS, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); BUILD(r, WASM_BINOP(kExprI32AsmjsDivS, WASM_LOCAL_GET(0), WASM_LOCAL_GET(1)));
const int32_t kMin = std::numeric_limits<int32_t>::min(); const int32_t kMin = std::numeric_limits<int32_t>::min();
CHECK_EQ(0, r.Call(0, 100)); CHECK_EQ(0, r.Call(0, 100));
CHECK_EQ(0, r.Call(100, 0)); CHECK_EQ(0, r.Call(100, 0));
...@@ -46,7 +46,7 @@ ASMJS_EXEC_TEST(Int32AsmjsDivS) { ...@@ -46,7 +46,7 @@ ASMJS_EXEC_TEST(Int32AsmjsDivS) {
ASMJS_EXEC_TEST(Int32AsmjsRemS) { ASMJS_EXEC_TEST(Int32AsmjsRemS) {
WasmRunner<int32_t, int32_t, int32_t> r(execution_tier); WasmRunner<int32_t, int32_t, int32_t> r(execution_tier);
r.builder().ChangeOriginToAsmjs(); r.builder().ChangeOriginToAsmjs();
BUILD(r, WASM_BINOP(kExprI32AsmjsRemS, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); BUILD(r, WASM_BINOP(kExprI32AsmjsRemS, WASM_LOCAL_GET(0), WASM_LOCAL_GET(1)));
const int32_t kMin = std::numeric_limits<int32_t>::min(); const int32_t kMin = std::numeric_limits<int32_t>::min();
CHECK_EQ(33, r.Call(133, 100)); CHECK_EQ(33, r.Call(133, 100));
CHECK_EQ(0, r.Call(kMin, -1)); CHECK_EQ(0, r.Call(kMin, -1));
...@@ -58,7 +58,7 @@ ASMJS_EXEC_TEST(Int32AsmjsRemS) { ...@@ -58,7 +58,7 @@ ASMJS_EXEC_TEST(Int32AsmjsRemS) {
ASMJS_EXEC_TEST(Int32AsmjsDivU) { ASMJS_EXEC_TEST(Int32AsmjsDivU) {
WasmRunner<int32_t, int32_t, int32_t> r(execution_tier); WasmRunner<int32_t, int32_t, int32_t> r(execution_tier);
r.builder().ChangeOriginToAsmjs(); r.builder().ChangeOriginToAsmjs();
BUILD(r, WASM_BINOP(kExprI32AsmjsDivU, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); BUILD(r, WASM_BINOP(kExprI32AsmjsDivU, WASM_LOCAL_GET(0), WASM_LOCAL_GET(1)));
const int32_t kMin = std::numeric_limits<int32_t>::min(); const int32_t kMin = std::numeric_limits<int32_t>::min();
CHECK_EQ(0, r.Call(0, 100)); CHECK_EQ(0, r.Call(0, 100));
CHECK_EQ(0, r.Call(kMin, -1)); CHECK_EQ(0, r.Call(kMin, -1));
...@@ -70,7 +70,7 @@ ASMJS_EXEC_TEST(Int32AsmjsDivU) { ...@@ -70,7 +70,7 @@ ASMJS_EXEC_TEST(Int32AsmjsDivU) {
ASMJS_EXEC_TEST(Int32AsmjsRemU) { ASMJS_EXEC_TEST(Int32AsmjsRemU) {
WasmRunner<int32_t, int32_t, int32_t> r(execution_tier); WasmRunner<int32_t, int32_t, int32_t> r(execution_tier);
r.builder().ChangeOriginToAsmjs(); r.builder().ChangeOriginToAsmjs();
BUILD(r, WASM_BINOP(kExprI32AsmjsRemU, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); BUILD(r, WASM_BINOP(kExprI32AsmjsRemU, WASM_LOCAL_GET(0), WASM_LOCAL_GET(1)));
const int32_t kMin = std::numeric_limits<int32_t>::min(); const int32_t kMin = std::numeric_limits<int32_t>::min();
CHECK_EQ(17, r.Call(217, 100)); CHECK_EQ(17, r.Call(217, 100));
CHECK_EQ(0, r.Call(100, 0)); CHECK_EQ(0, r.Call(100, 0));
...@@ -82,7 +82,7 @@ ASMJS_EXEC_TEST(Int32AsmjsRemU) { ...@@ -82,7 +82,7 @@ ASMJS_EXEC_TEST(Int32AsmjsRemU) {
ASMJS_EXEC_TEST(I32AsmjsSConvertF32) { ASMJS_EXEC_TEST(I32AsmjsSConvertF32) {
WasmRunner<int32_t, float> r(execution_tier); WasmRunner<int32_t, float> r(execution_tier);
r.builder().ChangeOriginToAsmjs(); r.builder().ChangeOriginToAsmjs();
BUILD(r, WASM_UNOP(kExprI32AsmjsSConvertF32, WASM_GET_LOCAL(0))); BUILD(r, WASM_UNOP(kExprI32AsmjsSConvertF32, WASM_LOCAL_GET(0)));
FOR_FLOAT32_INPUTS(i) { FOR_FLOAT32_INPUTS(i) {
int32_t expected = DoubleToInt32(i); int32_t expected = DoubleToInt32(i);
...@@ -93,7 +93,7 @@ ASMJS_EXEC_TEST(I32AsmjsSConvertF32) { ...@@ -93,7 +93,7 @@ ASMJS_EXEC_TEST(I32AsmjsSConvertF32) {
ASMJS_EXEC_TEST(I32AsmjsSConvertF64) { ASMJS_EXEC_TEST(I32AsmjsSConvertF64) {
WasmRunner<int32_t, double> r(execution_tier); WasmRunner<int32_t, double> r(execution_tier);
r.builder().ChangeOriginToAsmjs(); r.builder().ChangeOriginToAsmjs();
BUILD(r, WASM_UNOP(kExprI32AsmjsSConvertF64, WASM_GET_LOCAL(0))); BUILD(r, WASM_UNOP(kExprI32AsmjsSConvertF64, WASM_LOCAL_GET(0)));
FOR_FLOAT64_INPUTS(i) { FOR_FLOAT64_INPUTS(i) {
int32_t expected = DoubleToInt32(i); int32_t expected = DoubleToInt32(i);
...@@ -104,7 +104,7 @@ ASMJS_EXEC_TEST(I32AsmjsSConvertF64) { ...@@ -104,7 +104,7 @@ ASMJS_EXEC_TEST(I32AsmjsSConvertF64) {
ASMJS_EXEC_TEST(I32AsmjsUConvertF32) { ASMJS_EXEC_TEST(I32AsmjsUConvertF32) {
WasmRunner<uint32_t, float> r(execution_tier); WasmRunner<uint32_t, float> r(execution_tier);
r.builder().ChangeOriginToAsmjs(); r.builder().ChangeOriginToAsmjs();
BUILD(r, WASM_UNOP(kExprI32AsmjsUConvertF32, WASM_GET_LOCAL(0))); BUILD(r, WASM_UNOP(kExprI32AsmjsUConvertF32, WASM_LOCAL_GET(0)));
FOR_FLOAT32_INPUTS(i) { FOR_FLOAT32_INPUTS(i) {
uint32_t expected = DoubleToUint32(i); uint32_t expected = DoubleToUint32(i);
...@@ -115,7 +115,7 @@ ASMJS_EXEC_TEST(I32AsmjsUConvertF32) { ...@@ -115,7 +115,7 @@ ASMJS_EXEC_TEST(I32AsmjsUConvertF32) {
ASMJS_EXEC_TEST(I32AsmjsUConvertF64) { ASMJS_EXEC_TEST(I32AsmjsUConvertF64) {
WasmRunner<uint32_t, double> r(execution_tier); WasmRunner<uint32_t, double> r(execution_tier);
r.builder().ChangeOriginToAsmjs(); r.builder().ChangeOriginToAsmjs();
BUILD(r, WASM_UNOP(kExprI32AsmjsUConvertF64, WASM_GET_LOCAL(0))); BUILD(r, WASM_UNOP(kExprI32AsmjsUConvertF64, WASM_LOCAL_GET(0)));
FOR_FLOAT64_INPUTS(i) { FOR_FLOAT64_INPUTS(i) {
uint32_t expected = DoubleToUint32(i); uint32_t expected = DoubleToUint32(i);
...@@ -129,7 +129,7 @@ ASMJS_EXEC_TEST(LoadMemI32_oob_asm) { ...@@ -129,7 +129,7 @@ ASMJS_EXEC_TEST(LoadMemI32_oob_asm) {
int32_t* memory = r.builder().AddMemoryElems<int32_t>(8); int32_t* memory = r.builder().AddMemoryElems<int32_t>(8);
r.builder().RandomizeMemory(1112); r.builder().RandomizeMemory(1112);
BUILD(r, WASM_UNOP(kExprI32AsmjsLoadMem, WASM_GET_LOCAL(0))); BUILD(r, WASM_UNOP(kExprI32AsmjsLoadMem, WASM_LOCAL_GET(0)));
memory[0] = 999999; memory[0] = 999999;
CHECK_EQ(999999, r.Call(0u)); CHECK_EQ(999999, r.Call(0u));
...@@ -149,7 +149,7 @@ ASMJS_EXEC_TEST(LoadMemF32_oob_asm) { ...@@ -149,7 +149,7 @@ ASMJS_EXEC_TEST(LoadMemF32_oob_asm) {
float* memory = r.builder().AddMemoryElems<float>(8); float* memory = r.builder().AddMemoryElems<float>(8);
r.builder().RandomizeMemory(1112); r.builder().RandomizeMemory(1112);
BUILD(r, WASM_UNOP(kExprF32AsmjsLoadMem, WASM_GET_LOCAL(0))); BUILD(r, WASM_UNOP(kExprF32AsmjsLoadMem, WASM_LOCAL_GET(0)));
memory[0] = 9999.5f; memory[0] = 9999.5f;
CHECK_EQ(9999.5f, r.Call(0u)); CHECK_EQ(9999.5f, r.Call(0u));
...@@ -169,7 +169,7 @@ ASMJS_EXEC_TEST(LoadMemF64_oob_asm) { ...@@ -169,7 +169,7 @@ ASMJS_EXEC_TEST(LoadMemF64_oob_asm) {
double* memory = r.builder().AddMemoryElems<double>(8); double* memory = r.builder().AddMemoryElems<double>(8);
r.builder().RandomizeMemory(1112); r.builder().RandomizeMemory(1112);
BUILD(r, WASM_UNOP(kExprF64AsmjsLoadMem, WASM_GET_LOCAL(0))); BUILD(r, WASM_UNOP(kExprF64AsmjsLoadMem, WASM_LOCAL_GET(0)));
memory[0] = 9799.5; memory[0] = 9799.5;
CHECK_EQ(9799.5, r.Call(0u)); CHECK_EQ(9799.5, r.Call(0u));
...@@ -191,8 +191,8 @@ ASMJS_EXEC_TEST(StoreMemI32_oob_asm) { ...@@ -191,8 +191,8 @@ ASMJS_EXEC_TEST(StoreMemI32_oob_asm) {
int32_t* memory = r.builder().AddMemoryElems<int32_t>(8); int32_t* memory = r.builder().AddMemoryElems<int32_t>(8);
r.builder().RandomizeMemory(1112); r.builder().RandomizeMemory(1112);
BUILD(r, WASM_BINOP(kExprI32AsmjsStoreMem, WASM_GET_LOCAL(0), BUILD(r, WASM_BINOP(kExprI32AsmjsStoreMem, WASM_LOCAL_GET(0),
WASM_GET_LOCAL(1))); WASM_LOCAL_GET(1)));
memory[0] = 7777; memory[0] = 7777;
CHECK_EQ(999999, r.Call(0u, 999999)); CHECK_EQ(999999, r.Call(0u, 999999));
...@@ -211,7 +211,7 @@ ASMJS_EXEC_TEST(Int32AsmjsDivS_byzero_const) { ...@@ -211,7 +211,7 @@ ASMJS_EXEC_TEST(Int32AsmjsDivS_byzero_const) {
for (int8_t denom = -2; denom < 8; ++denom) { for (int8_t denom = -2; denom < 8; ++denom) {
WasmRunner<int32_t, int32_t> r(execution_tier); WasmRunner<int32_t, int32_t> r(execution_tier);
r.builder().ChangeOriginToAsmjs(); r.builder().ChangeOriginToAsmjs();
BUILD(r, WASM_I32_ASMJS_DIVS(WASM_GET_LOCAL(0), WASM_I32V_1(denom))); BUILD(r, WASM_I32_ASMJS_DIVS(WASM_LOCAL_GET(0), WASM_I32V_1(denom)));
FOR_INT32_INPUTS(i) { FOR_INT32_INPUTS(i) {
if (denom == 0) { if (denom == 0) {
CHECK_EQ(0, r.Call(i)); CHECK_EQ(0, r.Call(i));
...@@ -228,7 +228,7 @@ ASMJS_EXEC_TEST(Int32AsmjsRemS_byzero_const) { ...@@ -228,7 +228,7 @@ ASMJS_EXEC_TEST(Int32AsmjsRemS_byzero_const) {
for (int8_t denom = -2; denom < 8; ++denom) { for (int8_t denom = -2; denom < 8; ++denom) {
WasmRunner<int32_t, int32_t> r(execution_tier); WasmRunner<int32_t, int32_t> r(execution_tier);
r.builder().ChangeOriginToAsmjs(); r.builder().ChangeOriginToAsmjs();
BUILD(r, WASM_I32_ASMJS_REMS(WASM_GET_LOCAL(0), WASM_I32V_1(denom))); BUILD(r, WASM_I32_ASMJS_REMS(WASM_LOCAL_GET(0), WASM_I32V_1(denom)));
FOR_INT32_INPUTS(i) { FOR_INT32_INPUTS(i) {
if (denom == 0) { if (denom == 0) {
CHECK_EQ(0, r.Call(i)); CHECK_EQ(0, r.Call(i));
......
...@@ -18,7 +18,7 @@ void RunU32BinOp(TestExecutionTier execution_tier, WasmOpcode wasm_op, ...@@ -18,7 +18,7 @@ void RunU32BinOp(TestExecutionTier execution_tier, WasmOpcode wasm_op,
r.builder().AddMemoryElems<uint32_t>(kWasmPageSize / sizeof(uint32_t)); r.builder().AddMemoryElems<uint32_t>(kWasmPageSize / sizeof(uint32_t));
r.builder().SetHasSharedMemory(); r.builder().SetHasSharedMemory();
BUILD(r, WASM_ATOMICS_BINOP(wasm_op, WASM_I32V_1(0), WASM_GET_LOCAL(0), BUILD(r, WASM_ATOMICS_BINOP(wasm_op, WASM_I32V_1(0), WASM_LOCAL_GET(0),
MachineRepresentation::kWord32)); MachineRepresentation::kWord32));
FOR_UINT32_INPUTS(i) { FOR_UINT32_INPUTS(i) {
...@@ -47,7 +47,7 @@ void RunU16BinOp(TestExecutionTier tier, WasmOpcode wasm_op, ...@@ -47,7 +47,7 @@ void RunU16BinOp(TestExecutionTier tier, WasmOpcode wasm_op,
uint16_t* memory = uint16_t* memory =
r.builder().AddMemoryElems<uint16_t>(kWasmPageSize / sizeof(uint16_t)); r.builder().AddMemoryElems<uint16_t>(kWasmPageSize / sizeof(uint16_t));
BUILD(r, WASM_ATOMICS_BINOP(wasm_op, WASM_I32V_1(0), WASM_GET_LOCAL(0), BUILD(r, WASM_ATOMICS_BINOP(wasm_op, WASM_I32V_1(0), WASM_LOCAL_GET(0),
MachineRepresentation::kWord16)); MachineRepresentation::kWord16));
FOR_UINT16_INPUTS(i) { FOR_UINT16_INPUTS(i) {
...@@ -75,7 +75,7 @@ void RunU8BinOp(TestExecutionTier execution_tier, WasmOpcode wasm_op, ...@@ -75,7 +75,7 @@ void RunU8BinOp(TestExecutionTier execution_tier, WasmOpcode wasm_op,
r.builder().SetHasSharedMemory(); r.builder().SetHasSharedMemory();
uint8_t* memory = r.builder().AddMemoryElems<uint8_t>(kWasmPageSize); uint8_t* memory = r.builder().AddMemoryElems<uint8_t>(kWasmPageSize);
BUILD(r, WASM_ATOMICS_BINOP(wasm_op, WASM_I32V_1(0), WASM_GET_LOCAL(0), BUILD(r, WASM_ATOMICS_BINOP(wasm_op, WASM_I32V_1(0), WASM_LOCAL_GET(0),
MachineRepresentation::kWord8)); MachineRepresentation::kWord8));
FOR_UINT8_INPUTS(i) { FOR_UINT8_INPUTS(i) {
...@@ -103,8 +103,8 @@ WASM_EXEC_TEST(I32AtomicCompareExchange) { ...@@ -103,8 +103,8 @@ WASM_EXEC_TEST(I32AtomicCompareExchange) {
uint32_t* memory = uint32_t* memory =
r.builder().AddMemoryElems<uint32_t>(kWasmPageSize / sizeof(uint32_t)); r.builder().AddMemoryElems<uint32_t>(kWasmPageSize / sizeof(uint32_t));
BUILD(r, WASM_ATOMICS_TERNARY_OP( BUILD(r, WASM_ATOMICS_TERNARY_OP(
kExprI32AtomicCompareExchange, WASM_I32V_1(0), WASM_GET_LOCAL(0), kExprI32AtomicCompareExchange, WASM_I32V_1(0), WASM_LOCAL_GET(0),
WASM_GET_LOCAL(1), MachineRepresentation::kWord32)); WASM_LOCAL_GET(1), MachineRepresentation::kWord32));
FOR_UINT32_INPUTS(i) { FOR_UINT32_INPUTS(i) {
uint32_t initial = i; uint32_t initial = i;
...@@ -124,8 +124,8 @@ WASM_EXEC_TEST(I32AtomicCompareExchange16U) { ...@@ -124,8 +124,8 @@ WASM_EXEC_TEST(I32AtomicCompareExchange16U) {
uint16_t* memory = uint16_t* memory =
r.builder().AddMemoryElems<uint16_t>(kWasmPageSize / sizeof(uint16_t)); r.builder().AddMemoryElems<uint16_t>(kWasmPageSize / sizeof(uint16_t));
BUILD(r, WASM_ATOMICS_TERNARY_OP(kExprI32AtomicCompareExchange16U, BUILD(r, WASM_ATOMICS_TERNARY_OP(kExprI32AtomicCompareExchange16U,
WASM_I32V_1(0), WASM_GET_LOCAL(0), WASM_I32V_1(0), WASM_LOCAL_GET(0),
WASM_GET_LOCAL(1), WASM_LOCAL_GET(1),
MachineRepresentation::kWord16)); MachineRepresentation::kWord16));
FOR_UINT16_INPUTS(i) { FOR_UINT16_INPUTS(i) {
...@@ -146,7 +146,7 @@ WASM_EXEC_TEST(I32AtomicCompareExchange8U) { ...@@ -146,7 +146,7 @@ WASM_EXEC_TEST(I32AtomicCompareExchange8U) {
uint8_t* memory = r.builder().AddMemoryElems<uint8_t>(kWasmPageSize); uint8_t* memory = r.builder().AddMemoryElems<uint8_t>(kWasmPageSize);
BUILD(r, BUILD(r,
WASM_ATOMICS_TERNARY_OP(kExprI32AtomicCompareExchange8U, WASM_I32V_1(0), WASM_ATOMICS_TERNARY_OP(kExprI32AtomicCompareExchange8U, WASM_I32V_1(0),
WASM_GET_LOCAL(0), WASM_GET_LOCAL(1), WASM_LOCAL_GET(0), WASM_LOCAL_GET(1),
MachineRepresentation::kWord8)); MachineRepresentation::kWord8));
FOR_UINT8_INPUTS(i) { FOR_UINT8_INPUTS(i) {
...@@ -167,8 +167,8 @@ WASM_EXEC_TEST(I32AtomicCompareExchange_fail) { ...@@ -167,8 +167,8 @@ WASM_EXEC_TEST(I32AtomicCompareExchange_fail) {
uint32_t* memory = uint32_t* memory =
r.builder().AddMemoryElems<uint32_t>(kWasmPageSize / sizeof(uint32_t)); r.builder().AddMemoryElems<uint32_t>(kWasmPageSize / sizeof(uint32_t));
BUILD(r, WASM_ATOMICS_TERNARY_OP( BUILD(r, WASM_ATOMICS_TERNARY_OP(
kExprI32AtomicCompareExchange, WASM_I32V_1(0), WASM_GET_LOCAL(0), kExprI32AtomicCompareExchange, WASM_I32V_1(0), WASM_LOCAL_GET(0),
WASM_GET_LOCAL(1), MachineRepresentation::kWord32)); WASM_LOCAL_GET(1), MachineRepresentation::kWord32));
// The original value at the memory location. // The original value at the memory location.
uint32_t old_val = 4; uint32_t old_val = 4;
...@@ -237,7 +237,7 @@ WASM_EXEC_TEST(I32AtomicStoreLoad) { ...@@ -237,7 +237,7 @@ WASM_EXEC_TEST(I32AtomicStoreLoad) {
r.builder().AddMemoryElems<uint32_t>(kWasmPageSize / sizeof(uint32_t)); r.builder().AddMemoryElems<uint32_t>(kWasmPageSize / sizeof(uint32_t));
BUILD(r, BUILD(r,
WASM_ATOMICS_STORE_OP(kExprI32AtomicStore, WASM_ZERO, WASM_GET_LOCAL(0), WASM_ATOMICS_STORE_OP(kExprI32AtomicStore, WASM_ZERO, WASM_LOCAL_GET(0),
MachineRepresentation::kWord32), MachineRepresentation::kWord32),
WASM_ATOMICS_LOAD_OP(kExprI32AtomicLoad, WASM_ZERO, WASM_ATOMICS_LOAD_OP(kExprI32AtomicLoad, WASM_ZERO,
MachineRepresentation::kWord32)); MachineRepresentation::kWord32));
...@@ -259,7 +259,7 @@ WASM_EXEC_TEST(I32AtomicStoreLoad16U) { ...@@ -259,7 +259,7 @@ WASM_EXEC_TEST(I32AtomicStoreLoad16U) {
BUILD( BUILD(
r, r,
WASM_ATOMICS_STORE_OP(kExprI32AtomicStore16U, WASM_ZERO, WASM_ATOMICS_STORE_OP(kExprI32AtomicStore16U, WASM_ZERO,
WASM_GET_LOCAL(0), MachineRepresentation::kWord16), WASM_LOCAL_GET(0), MachineRepresentation::kWord16),
WASM_ATOMICS_LOAD_OP(kExprI32AtomicLoad16U, WASM_ZERO, WASM_ATOMICS_LOAD_OP(kExprI32AtomicLoad16U, WASM_ZERO,
MachineRepresentation::kWord16)); MachineRepresentation::kWord16));
...@@ -278,7 +278,7 @@ WASM_EXEC_TEST(I32AtomicStoreLoad8U) { ...@@ -278,7 +278,7 @@ WASM_EXEC_TEST(I32AtomicStoreLoad8U) {
BUILD(r, BUILD(r,
WASM_ATOMICS_STORE_OP(kExprI32AtomicStore8U, WASM_ZERO, WASM_ATOMICS_STORE_OP(kExprI32AtomicStore8U, WASM_ZERO,
WASM_GET_LOCAL(0), MachineRepresentation::kWord8), WASM_LOCAL_GET(0), MachineRepresentation::kWord8),
WASM_ATOMICS_LOAD_OP(kExprI32AtomicLoad8U, WASM_ZERO, WASM_ATOMICS_LOAD_OP(kExprI32AtomicLoad8U, WASM_ZERO,
MachineRepresentation::kWord8)); MachineRepresentation::kWord8));
...@@ -297,9 +297,9 @@ WASM_EXEC_TEST(I32AtomicStoreParameter) { ...@@ -297,9 +297,9 @@ WASM_EXEC_TEST(I32AtomicStoreParameter) {
r.builder().SetHasSharedMemory(); r.builder().SetHasSharedMemory();
BUILD(r, BUILD(r,
WASM_ATOMICS_STORE_OP(kExprI32AtomicStore, WASM_ZERO, WASM_GET_LOCAL(0), WASM_ATOMICS_STORE_OP(kExprI32AtomicStore, WASM_ZERO, WASM_LOCAL_GET(0),
MachineRepresentation::kWord8), MachineRepresentation::kWord8),
WASM_ATOMICS_BINOP(kExprI32AtomicAdd, WASM_I32V_1(0), WASM_GET_LOCAL(0), WASM_ATOMICS_BINOP(kExprI32AtomicAdd, WASM_I32V_1(0), WASM_LOCAL_GET(0),
MachineRepresentation::kWord32)); MachineRepresentation::kWord32));
CHECK_EQ(10, r.Call(10)); CHECK_EQ(10, r.Call(10));
CHECK_EQ(20, r.builder().ReadMemory(&memory[0])); CHECK_EQ(20, r.builder().ReadMemory(&memory[0]));
......
This diff is collapsed.
...@@ -52,8 +52,8 @@ WASM_EXEC_TEST(MemoryInit) { ...@@ -52,8 +52,8 @@ WASM_EXEC_TEST(MemoryInit) {
const byte data[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; const byte data[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
r.builder().AddPassiveDataSegment(ArrayVector(data)); r.builder().AddPassiveDataSegment(ArrayVector(data));
BUILD(r, BUILD(r,
WASM_MEMORY_INIT(0, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1), WASM_MEMORY_INIT(0, WASM_LOCAL_GET(0), WASM_LOCAL_GET(1),
WASM_GET_LOCAL(2)), WASM_LOCAL_GET(2)),
kExprI32Const, 0); kExprI32Const, 0);
// All zeroes. // All zeroes.
...@@ -89,8 +89,8 @@ WASM_EXEC_TEST(MemoryInitOutOfBoundsData) { ...@@ -89,8 +89,8 @@ WASM_EXEC_TEST(MemoryInitOutOfBoundsData) {
const byte data[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; const byte data[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
r.builder().AddPassiveDataSegment(ArrayVector(data)); r.builder().AddPassiveDataSegment(ArrayVector(data));
BUILD(r, BUILD(r,
WASM_MEMORY_INIT(0, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1), WASM_MEMORY_INIT(0, WASM_LOCAL_GET(0), WASM_LOCAL_GET(1),
WASM_GET_LOCAL(2)), WASM_LOCAL_GET(2)),
kExprI32Const, 0); kExprI32Const, 0);
const uint32_t last_5_bytes = kWasmPageSize - 5; const uint32_t last_5_bytes = kWasmPageSize - 5;
...@@ -111,8 +111,8 @@ WASM_EXEC_TEST(MemoryInitOutOfBounds) { ...@@ -111,8 +111,8 @@ WASM_EXEC_TEST(MemoryInitOutOfBounds) {
const byte data[kWasmPageSize] = {}; const byte data[kWasmPageSize] = {};
r.builder().AddPassiveDataSegment(ArrayVector(data)); r.builder().AddPassiveDataSegment(ArrayVector(data));
BUILD(r, BUILD(r,
WASM_MEMORY_INIT(0, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1), WASM_MEMORY_INIT(0, WASM_LOCAL_GET(0), WASM_LOCAL_GET(1),
WASM_GET_LOCAL(2)), WASM_LOCAL_GET(2)),
kExprI32Const, 0); kExprI32Const, 0);
// OK, copy the full data segment to memory. // OK, copy the full data segment to memory.
...@@ -142,7 +142,7 @@ WASM_EXEC_TEST(MemoryCopy) { ...@@ -142,7 +142,7 @@ WASM_EXEC_TEST(MemoryCopy) {
byte* mem = r.builder().AddMemory(kWasmPageSize); byte* mem = r.builder().AddMemory(kWasmPageSize);
BUILD( BUILD(
r, r,
WASM_MEMORY_COPY(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1), WASM_GET_LOCAL(2)), WASM_MEMORY_COPY(WASM_LOCAL_GET(0), WASM_LOCAL_GET(1), WASM_LOCAL_GET(2)),
kExprI32Const, 0); kExprI32Const, 0);
const byte initial[] = {0, 11, 22, 33, 44, 55, 66, 77}; const byte initial[] = {0, 11, 22, 33, 44, 55, 66, 77};
...@@ -171,7 +171,7 @@ WASM_EXEC_TEST(MemoryCopyOverlapping) { ...@@ -171,7 +171,7 @@ WASM_EXEC_TEST(MemoryCopyOverlapping) {
byte* mem = r.builder().AddMemory(kWasmPageSize); byte* mem = r.builder().AddMemory(kWasmPageSize);
BUILD( BUILD(
r, r,
WASM_MEMORY_COPY(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1), WASM_GET_LOCAL(2)), WASM_MEMORY_COPY(WASM_LOCAL_GET(0), WASM_LOCAL_GET(1), WASM_LOCAL_GET(2)),
kExprI32Const, 0); kExprI32Const, 0);
const byte initial[] = {10, 20, 30}; const byte initial[] = {10, 20, 30};
...@@ -194,7 +194,7 @@ WASM_EXEC_TEST(MemoryCopyOutOfBoundsData) { ...@@ -194,7 +194,7 @@ WASM_EXEC_TEST(MemoryCopyOutOfBoundsData) {
byte* mem = r.builder().AddMemory(kWasmPageSize); byte* mem = r.builder().AddMemory(kWasmPageSize);
BUILD( BUILD(
r, r,
WASM_MEMORY_COPY(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1), WASM_GET_LOCAL(2)), WASM_MEMORY_COPY(WASM_LOCAL_GET(0), WASM_LOCAL_GET(1), WASM_LOCAL_GET(2)),
kExprI32Const, 0); kExprI32Const, 0);
const byte data[] = {11, 22, 33, 44, 55, 66, 77, 88}; const byte data[] = {11, 22, 33, 44, 55, 66, 77, 88};
...@@ -223,7 +223,7 @@ WASM_EXEC_TEST(MemoryCopyOutOfBounds) { ...@@ -223,7 +223,7 @@ WASM_EXEC_TEST(MemoryCopyOutOfBounds) {
r.builder().AddMemory(kWasmPageSize); r.builder().AddMemory(kWasmPageSize);
BUILD( BUILD(
r, r,
WASM_MEMORY_COPY(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1), WASM_GET_LOCAL(2)), WASM_MEMORY_COPY(WASM_LOCAL_GET(0), WASM_LOCAL_GET(1), WASM_LOCAL_GET(2)),
kExprI32Const, 0); kExprI32Const, 0);
// Copy full range is OK. // Copy full range is OK.
...@@ -253,7 +253,7 @@ WASM_EXEC_TEST(MemoryFill) { ...@@ -253,7 +253,7 @@ WASM_EXEC_TEST(MemoryFill) {
r.builder().AddMemory(kWasmPageSize); r.builder().AddMemory(kWasmPageSize);
BUILD( BUILD(
r, r,
WASM_MEMORY_FILL(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1), WASM_GET_LOCAL(2)), WASM_MEMORY_FILL(WASM_LOCAL_GET(0), WASM_LOCAL_GET(1), WASM_LOCAL_GET(2)),
kExprI32Const, 0); kExprI32Const, 0);
CHECK_EQ(0, r.Call(1, 33, 5)); CHECK_EQ(0, r.Call(1, 33, 5));
CheckMemoryEqualsFollowedByZeroes(&r.builder(), {0, 33, 33, 33, 33, 33}); CheckMemoryEqualsFollowedByZeroes(&r.builder(), {0, 33, 33, 33, 33, 33});
...@@ -277,7 +277,7 @@ WASM_EXEC_TEST(MemoryFillValueWrapsToByte) { ...@@ -277,7 +277,7 @@ WASM_EXEC_TEST(MemoryFillValueWrapsToByte) {
r.builder().AddMemory(kWasmPageSize); r.builder().AddMemory(kWasmPageSize);
BUILD( BUILD(
r, r,
WASM_MEMORY_FILL(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1), WASM_GET_LOCAL(2)), WASM_MEMORY_FILL(WASM_LOCAL_GET(0), WASM_LOCAL_GET(1), WASM_LOCAL_GET(2)),
kExprI32Const, 0); kExprI32Const, 0);
CHECK_EQ(0, r.Call(0, 1000, 3)); CHECK_EQ(0, r.Call(0, 1000, 3));
const byte expected = 1000 & 255; const byte expected = 1000 & 255;
...@@ -291,7 +291,7 @@ WASM_EXEC_TEST(MemoryFillOutOfBoundsData) { ...@@ -291,7 +291,7 @@ WASM_EXEC_TEST(MemoryFillOutOfBoundsData) {
r.builder().AddMemory(kWasmPageSize); r.builder().AddMemory(kWasmPageSize);
BUILD( BUILD(
r, r,
WASM_MEMORY_FILL(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1), WASM_GET_LOCAL(2)), WASM_MEMORY_FILL(WASM_LOCAL_GET(0), WASM_LOCAL_GET(1), WASM_LOCAL_GET(2)),
kExprI32Const, 0); kExprI32Const, 0);
const byte v = 123; const byte v = 123;
CHECK_EQ(0xDEADBEEF, r.Call(kWasmPageSize - 5, v, 999)); CHECK_EQ(0xDEADBEEF, r.Call(kWasmPageSize - 5, v, 999));
...@@ -304,7 +304,7 @@ WASM_EXEC_TEST(MemoryFillOutOfBounds) { ...@@ -304,7 +304,7 @@ WASM_EXEC_TEST(MemoryFillOutOfBounds) {
r.builder().AddMemory(kWasmPageSize); r.builder().AddMemory(kWasmPageSize);
BUILD( BUILD(
r, r,
WASM_MEMORY_FILL(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1), WASM_GET_LOCAL(2)), WASM_MEMORY_FILL(WASM_LOCAL_GET(0), WASM_LOCAL_GET(1), WASM_LOCAL_GET(2)),
kExprI32Const, 0); kExprI32Const, 0);
const byte v = 123; const byte v = 123;
...@@ -356,8 +356,8 @@ void TestTableCopyInbounds(TestExecutionTier execution_tier, int table_dst, ...@@ -356,8 +356,8 @@ void TestTableCopyInbounds(TestExecutionTier execution_tier, int table_dst,
r.builder().AddIndirectFunctionTable(nullptr, kTableSize); r.builder().AddIndirectFunctionTable(nullptr, kTableSize);
} }
BUILD(r, BUILD(r,
WASM_TABLE_COPY(table_dst, table_src, WASM_GET_LOCAL(0), WASM_TABLE_COPY(table_dst, table_src, WASM_LOCAL_GET(0),
WASM_GET_LOCAL(1), WASM_GET_LOCAL(2)), WASM_LOCAL_GET(1), WASM_LOCAL_GET(2)),
kExprI32Const, 0); kExprI32Const, 0);
for (uint32_t i = 0; i <= kTableSize; ++i) { for (uint32_t i = 0; i <= kTableSize; ++i) {
...@@ -438,12 +438,12 @@ void TestTableInitElems(TestExecutionTier execution_tier, int table_index) { ...@@ -438,12 +438,12 @@ void TestTableInitElems(TestExecutionTier execution_tier, int table_index) {
WasmFunctionCompiler& call = r.NewFunction(sigs.i_i(), "call"); WasmFunctionCompiler& call = r.NewFunction(sigs.i_i(), "call");
BUILD(call, BUILD(call,
WASM_CALL_INDIRECT_TABLE(table_index, sig_index, WASM_GET_LOCAL(0))); WASM_CALL_INDIRECT_TABLE(table_index, sig_index, WASM_LOCAL_GET(0)));
const uint32_t call_index = call.function_index(); const uint32_t call_index = call.function_index();
BUILD(r, BUILD(r,
WASM_TABLE_INIT(table_index, 0, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1), WASM_TABLE_INIT(table_index, 0, WASM_LOCAL_GET(0), WASM_LOCAL_GET(1),
WASM_GET_LOCAL(2)), WASM_LOCAL_GET(2)),
kExprI32Const, 0); kExprI32Const, 0);
auto table = auto table =
...@@ -512,12 +512,12 @@ void TestTableInitOob(TestExecutionTier execution_tier, int table_index) { ...@@ -512,12 +512,12 @@ void TestTableInitOob(TestExecutionTier execution_tier, int table_index) {
WasmFunctionCompiler& call = r.NewFunction(sigs.i_i(), "call"); WasmFunctionCompiler& call = r.NewFunction(sigs.i_i(), "call");
BUILD(call, BUILD(call,
WASM_CALL_INDIRECT_TABLE(table_index, sig_index, WASM_GET_LOCAL(0))); WASM_CALL_INDIRECT_TABLE(table_index, sig_index, WASM_LOCAL_GET(0)));
const uint32_t call_index = call.function_index(); const uint32_t call_index = call.function_index();
BUILD(r, BUILD(r,
WASM_TABLE_INIT(table_index, 0, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1), WASM_TABLE_INIT(table_index, 0, WASM_LOCAL_GET(0), WASM_LOCAL_GET(1),
WASM_GET_LOCAL(2)), WASM_LOCAL_GET(2)),
kExprI32Const, 0); kExprI32Const, 0);
auto table = auto table =
...@@ -590,8 +590,8 @@ void TestTableCopyElems(TestExecutionTier execution_tier, int table_dst, ...@@ -590,8 +590,8 @@ void TestTableCopyElems(TestExecutionTier execution_tier, int table_dst,
} }
BUILD(r, BUILD(r,
WASM_TABLE_COPY(table_dst, table_src, WASM_GET_LOCAL(0), WASM_TABLE_COPY(table_dst, table_src, WASM_LOCAL_GET(0),
WASM_GET_LOCAL(1), WASM_GET_LOCAL(2)), WASM_LOCAL_GET(1), WASM_LOCAL_GET(2)),
kExprI32Const, 0); kExprI32Const, 0);
r.builder().FreezeSignatureMapAndInitializeWrapperCache(); r.builder().FreezeSignatureMapAndInitializeWrapperCache();
...@@ -673,12 +673,12 @@ void TestTableCopyCalls(TestExecutionTier execution_tier, int table_dst, ...@@ -673,12 +673,12 @@ void TestTableCopyCalls(TestExecutionTier execution_tier, int table_dst,
WasmFunctionCompiler& call = r.NewFunction(sigs.i_i(), "call"); WasmFunctionCompiler& call = r.NewFunction(sigs.i_i(), "call");
BUILD(call, BUILD(call,
WASM_CALL_INDIRECT_TABLE(table_dst, sig_index, WASM_GET_LOCAL(0))); WASM_CALL_INDIRECT_TABLE(table_dst, sig_index, WASM_LOCAL_GET(0)));
const uint32_t call_index = call.function_index(); const uint32_t call_index = call.function_index();
BUILD(r, BUILD(r,
WASM_TABLE_COPY(table_dst, table_src, WASM_GET_LOCAL(0), WASM_TABLE_COPY(table_dst, table_src, WASM_LOCAL_GET(0),
WASM_GET_LOCAL(1), WASM_GET_LOCAL(2)), WASM_LOCAL_GET(1), WASM_LOCAL_GET(2)),
kExprI32Const, 0); kExprI32Const, 0);
auto table = auto table =
...@@ -747,8 +747,8 @@ void TestTableCopyOobWrites(TestExecutionTier execution_tier, int table_dst, ...@@ -747,8 +747,8 @@ void TestTableCopyOobWrites(TestExecutionTier execution_tier, int table_dst,
} }
BUILD(r, BUILD(r,
WASM_TABLE_COPY(table_dst, table_src, WASM_GET_LOCAL(0), WASM_TABLE_COPY(table_dst, table_src, WASM_LOCAL_GET(0),
WASM_GET_LOCAL(1), WASM_GET_LOCAL(2)), WASM_LOCAL_GET(1), WASM_LOCAL_GET(2)),
kExprI32Const, 0); kExprI32Const, 0);
r.builder().FreezeSignatureMapAndInitializeWrapperCache(); r.builder().FreezeSignatureMapAndInitializeWrapperCache();
...@@ -811,8 +811,8 @@ void TestTableCopyOob1(TestExecutionTier execution_tier, int table_dst, ...@@ -811,8 +811,8 @@ void TestTableCopyOob1(TestExecutionTier execution_tier, int table_dst,
} }
BUILD(r, BUILD(r,
WASM_TABLE_COPY(table_dst, table_src, WASM_GET_LOCAL(0), WASM_TABLE_COPY(table_dst, table_src, WASM_LOCAL_GET(0),
WASM_GET_LOCAL(1), WASM_GET_LOCAL(2)), WASM_LOCAL_GET(1), WASM_LOCAL_GET(2)),
kExprI32Const, 0); kExprI32Const, 0);
r.CheckCallViaJS(0, 0, 0, 1); // nop r.CheckCallViaJS(0, 0, 0, 1); // nop
...@@ -877,7 +877,7 @@ WASM_COMPILED_EXEC_TEST(ElemDropThenTableInit) { ...@@ -877,7 +877,7 @@ WASM_COMPILED_EXEC_TEST(ElemDropThenTableInit) {
r.builder().AddPassiveElementSegment({}); r.builder().AddPassiveElementSegment({});
BUILD( BUILD(
r, WASM_ELEM_DROP(0), r, WASM_ELEM_DROP(0),
WASM_TABLE_INIT(0, 0, WASM_I32V_1(0), WASM_I32V_1(0), WASM_GET_LOCAL(0)), WASM_TABLE_INIT(0, 0, WASM_I32V_1(0), WASM_I32V_1(0), WASM_LOCAL_GET(0)),
kExprI32Const, 0); kExprI32Const, 0);
r.CheckCallViaJS(0, 0); r.CheckCallViaJS(0, 0);
......
...@@ -23,7 +23,7 @@ WASM_COMPILED_EXEC_TEST(TryCatchThrow) { ...@@ -23,7 +23,7 @@ WASM_COMPILED_EXEC_TEST(TryCatchThrow) {
// Build the main test function. // Build the main test function.
BUILD(r, WASM_TRY_CATCH_T(kWasmI32, BUILD(r, WASM_TRY_CATCH_T(kWasmI32,
WASM_STMTS(WASM_I32V(kResult1), WASM_STMTS(WASM_I32V(kResult1),
WASM_IF(WASM_I32_EQZ(WASM_GET_LOCAL(0)), WASM_IF(WASM_I32_EQZ(WASM_LOCAL_GET(0)),
WASM_THROW(except))), WASM_THROW(except))),
WASM_STMTS(WASM_I32V(kResult0)), except)); WASM_STMTS(WASM_I32V(kResult0)), except));
...@@ -48,7 +48,7 @@ WASM_COMPILED_EXEC_TEST(TryCatchCallDirect) { ...@@ -48,7 +48,7 @@ WASM_COMPILED_EXEC_TEST(TryCatchCallDirect) {
BUILD(r, WASM_TRY_CATCH_T( BUILD(r, WASM_TRY_CATCH_T(
kWasmI32, kWasmI32,
WASM_STMTS(WASM_I32V(kResult1), WASM_STMTS(WASM_I32V(kResult1),
WASM_IF(WASM_I32_EQZ(WASM_GET_LOCAL(0)), WASM_IF(WASM_I32_EQZ(WASM_LOCAL_GET(0)),
WASM_STMTS(WASM_CALL_FUNCTION( WASM_STMTS(WASM_CALL_FUNCTION(
throw_func.function_index(), throw_func.function_index(),
WASM_I32V(7), WASM_I32V(9)), WASM_I32V(7), WASM_I32V(9)),
...@@ -85,10 +85,10 @@ WASM_COMPILED_EXEC_TEST(TryCatchCallIndirect) { ...@@ -85,10 +85,10 @@ WASM_COMPILED_EXEC_TEST(TryCatchCallIndirect) {
WASM_TRY_CATCH_T( WASM_TRY_CATCH_T(
kWasmI32, kWasmI32,
WASM_STMTS(WASM_I32V(kResult1), WASM_STMTS(WASM_I32V(kResult1),
WASM_IF(WASM_I32_EQZ(WASM_GET_LOCAL(0)), WASM_IF(WASM_I32_EQZ(WASM_LOCAL_GET(0)),
WASM_STMTS(WASM_CALL_INDIRECT( WASM_STMTS(WASM_CALL_INDIRECT(
sig_index, WASM_I32V(7), sig_index, WASM_I32V(7),
WASM_I32V(9), WASM_GET_LOCAL(0)), WASM_I32V(9), WASM_LOCAL_GET(0)),
WASM_DROP))), WASM_DROP))),
WASM_STMTS(WASM_I32V(kResult0)), except)); WASM_STMTS(WASM_I32V(kResult0)), except));
...@@ -116,7 +116,7 @@ WASM_COMPILED_EXEC_TEST(TryCatchCallExternal) { ...@@ -116,7 +116,7 @@ WASM_COMPILED_EXEC_TEST(TryCatchCallExternal) {
kWasmI32, kWasmI32,
WASM_STMTS( WASM_STMTS(
WASM_I32V(kResult1), WASM_I32V(kResult1),
WASM_IF(WASM_I32_EQZ(WASM_GET_LOCAL(0)), WASM_IF(WASM_I32_EQZ(WASM_LOCAL_GET(0)),
WASM_STMTS(WASM_CALL_FUNCTION(kJSFunc, WASM_I32V(7), WASM_STMTS(WASM_CALL_FUNCTION(kJSFunc, WASM_I32V(7),
WASM_I32V(9)), WASM_I32V(9)),
WASM_DROP))), WASM_DROP))),
...@@ -169,12 +169,12 @@ WASM_COMPILED_EXEC_TEST(TryCatchTrapMemOutOfBounds) { ...@@ -169,12 +169,12 @@ WASM_COMPILED_EXEC_TEST(TryCatchTrapMemOutOfBounds) {
} }
WASM_COMPILED_EXEC_TEST(TryCatchTrapDivByZero) { WASM_COMPILED_EXEC_TEST(TryCatchTrapDivByZero) {
byte code[] = {WASM_I32_DIVS(WASM_GET_LOCAL(0), WASM_I32V_1(0))}; byte code[] = {WASM_I32_DIVS(WASM_LOCAL_GET(0), WASM_I32V_1(0))};
TestTrapNotCaught(code, arraysize(code), execution_tier); TestTrapNotCaught(code, arraysize(code), execution_tier);
} }
WASM_COMPILED_EXEC_TEST(TryCatchTrapRemByZero) { WASM_COMPILED_EXEC_TEST(TryCatchTrapRemByZero) {
byte code[] = {WASM_I32_REMS(WASM_GET_LOCAL(0), WASM_I32V_1(0))}; byte code[] = {WASM_I32_REMS(WASM_LOCAL_GET(0), WASM_I32V_1(0))};
TestTrapNotCaught(code, arraysize(code), execution_tier); TestTrapNotCaught(code, arraysize(code), execution_tier);
} }
......
...@@ -73,7 +73,7 @@ ManuallyImportedJSFunction CreateJSSelector(FunctionSig* sig, int which) { ...@@ -73,7 +73,7 @@ ManuallyImportedJSFunction CreateJSSelector(FunctionSig* sig, int which) {
WASM_COMPILED_EXEC_TEST(Run_Int32Sub_jswrapped) { WASM_COMPILED_EXEC_TEST(Run_Int32Sub_jswrapped) {
WasmRunner<int, int, int> r(execution_tier); WasmRunner<int, int, int> r(execution_tier);
BUILD(r, WASM_I32_SUB(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); BUILD(r, WASM_I32_SUB(WASM_LOCAL_GET(0), WASM_LOCAL_GET(1)));
r.CheckCallViaJS(33, 44, 11); r.CheckCallViaJS(33, 44, 11);
r.CheckCallViaJS(-8723487, -8000000, 723487); r.CheckCallViaJS(-8723487, -8000000, 723487);
...@@ -81,7 +81,7 @@ WASM_COMPILED_EXEC_TEST(Run_Int32Sub_jswrapped) { ...@@ -81,7 +81,7 @@ WASM_COMPILED_EXEC_TEST(Run_Int32Sub_jswrapped) {
WASM_COMPILED_EXEC_TEST(Run_Float32Div_jswrapped) { WASM_COMPILED_EXEC_TEST(Run_Float32Div_jswrapped) {
WasmRunner<float, float, float> r(execution_tier); WasmRunner<float, float, float> r(execution_tier);
BUILD(r, WASM_F32_DIV(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); BUILD(r, WASM_F32_DIV(WASM_LOCAL_GET(0), WASM_LOCAL_GET(1)));
r.CheckCallViaJS(92, 46, 0.5); r.CheckCallViaJS(92, 46, 0.5);
r.CheckCallViaJS(64, -16, -0.25); r.CheckCallViaJS(64, -16, -0.25);
...@@ -89,7 +89,7 @@ WASM_COMPILED_EXEC_TEST(Run_Float32Div_jswrapped) { ...@@ -89,7 +89,7 @@ WASM_COMPILED_EXEC_TEST(Run_Float32Div_jswrapped) {
WASM_COMPILED_EXEC_TEST(Run_Float64Add_jswrapped) { WASM_COMPILED_EXEC_TEST(Run_Float64Add_jswrapped) {
WasmRunner<double, double, double> r(execution_tier); WasmRunner<double, double, double> r(execution_tier);
BUILD(r, WASM_F64_ADD(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); BUILD(r, WASM_F64_ADD(WASM_LOCAL_GET(0), WASM_LOCAL_GET(1)));
r.CheckCallViaJS(3, 2, 1); r.CheckCallViaJS(3, 2, 1);
r.CheckCallViaJS(-5.5, -5.25, -0.25); r.CheckCallViaJS(-5.5, -5.25, -0.25);
...@@ -97,7 +97,7 @@ WASM_COMPILED_EXEC_TEST(Run_Float64Add_jswrapped) { ...@@ -97,7 +97,7 @@ WASM_COMPILED_EXEC_TEST(Run_Float64Add_jswrapped) {
WASM_COMPILED_EXEC_TEST(Run_I32Popcount_jswrapped) { WASM_COMPILED_EXEC_TEST(Run_I32Popcount_jswrapped) {
WasmRunner<int, int> r(execution_tier); WasmRunner<int, int> r(execution_tier);
BUILD(r, WASM_I32_POPCNT(WASM_GET_LOCAL(0))); BUILD(r, WASM_I32_POPCNT(WASM_LOCAL_GET(0)));
r.CheckCallViaJS(2, 9); r.CheckCallViaJS(2, 9);
r.CheckCallViaJS(3, 11); r.CheckCallViaJS(3, 11);
...@@ -114,7 +114,7 @@ WASM_COMPILED_EXEC_TEST(Run_CallJS_Add_jswrapped) { ...@@ -114,7 +114,7 @@ WASM_COMPILED_EXEC_TEST(Run_CallJS_Add_jswrapped) {
ManuallyImportedJSFunction import = {sigs.i_i(), js_function}; ManuallyImportedJSFunction import = {sigs.i_i(), js_function};
WasmRunner<int, int> r(execution_tier, &import); WasmRunner<int, int> r(execution_tier, &import);
uint32_t js_index = 0; uint32_t js_index = 0;
BUILD(r, WASM_CALL_FUNCTION(js_index, WASM_GET_LOCAL(0))); BUILD(r, WASM_CALL_FUNCTION(js_index, WASM_LOCAL_GET(0)));
r.CheckCallViaJS(101, 2); r.CheckCallViaJS(101, 2);
r.CheckCallViaJS(199, 100); r.CheckCallViaJS(199, 100);
...@@ -148,7 +148,7 @@ WASM_COMPILED_EXEC_TEST(Run_IndirectCallJSFunction) { ...@@ -148,7 +148,7 @@ WASM_COMPILED_EXEC_TEST(Run_IndirectCallJSFunction) {
arraysize(indirect_function_table)); arraysize(indirect_function_table));
BUILD(rc_fn, WASM_CALL_INDIRECT(sig_index, WASM_I32V(left), WASM_I32V(right), BUILD(rc_fn, WASM_CALL_INDIRECT(sig_index, WASM_I32V(left), WASM_I32V(right),
WASM_GET_LOCAL(0), WASM_I32V(js_index))); WASM_LOCAL_GET(0), WASM_I32V(js_index)));
Handle<Object> args_left[] = {isolate->factory()->NewNumber(1)}; Handle<Object> args_left[] = {isolate->factory()->NewNumber(1)};
r.CheckCallApplyViaJS(left, rc_fn.function_index(), args_left, 1); r.CheckCallApplyViaJS(left, rc_fn.function_index(), args_left, 1);
...@@ -244,7 +244,7 @@ void RunWASMSelectTest(TestExecutionTier tier, int which) { ...@@ -244,7 +244,7 @@ void RunWASMSelectTest(TestExecutionTier tier, int which) {
WasmRunner<void> r(tier); WasmRunner<void> r(tier);
WasmFunctionCompiler& t = r.NewFunction(&sig); WasmFunctionCompiler& t = r.NewFunction(&sig);
BUILD(t, WASM_GET_LOCAL(which)); BUILD(t, WASM_LOCAL_GET(which));
Handle<Object> args[] = { Handle<Object> args[] = {
isolate->factory()->NewNumber(inputs.arg_d(0)), isolate->factory()->NewNumber(inputs.arg_d(0)),
...@@ -316,7 +316,7 @@ void RunWASMSelectAlignTest(TestExecutionTier tier, int num_args, ...@@ -316,7 +316,7 @@ void RunWASMSelectAlignTest(TestExecutionTier tier, int num_args,
for (int which = 0; which < num_params; which++) { for (int which = 0; which < num_params; which++) {
WasmRunner<void> r(tier); WasmRunner<void> r(tier);
WasmFunctionCompiler& t = r.NewFunction(&sig); WasmFunctionCompiler& t = r.NewFunction(&sig);
BUILD(t, WASM_GET_LOCAL(which)); BUILD(t, WASM_LOCAL_GET(which));
Handle<Object> args[] = {isolate->factory()->NewNumber(inputs.arg_d(0)), Handle<Object> args[] = {isolate->factory()->NewNumber(inputs.arg_d(0)),
isolate->factory()->NewNumber(inputs.arg_d(1)), isolate->factory()->NewNumber(inputs.arg_d(1)),
...@@ -415,7 +415,7 @@ void RunJSSelectAlignTest(TestExecutionTier tier, int num_args, ...@@ -415,7 +415,7 @@ void RunJSSelectAlignTest(TestExecutionTier tier, int num_args,
std::vector<byte> code; std::vector<byte> code;
for (int i = 0; i < num_params; i++) { for (int i = 0; i < num_params; i++) {
ADD_CODE(code, WASM_GET_LOCAL(i)); ADD_CODE(code, WASM_LOCAL_GET(i));
} }
uint8_t imported_js_index = 0; uint8_t imported_js_index = 0;
...@@ -547,12 +547,12 @@ void RunPickerTest(TestExecutionTier tier, bool indirect) { ...@@ -547,12 +547,12 @@ void RunPickerTest(TestExecutionTier tier, bool indirect) {
arraysize(indirect_function_table)); arraysize(indirect_function_table));
BUILD(rc_fn, WASM_RETURN_CALL_INDIRECT(sig_index, WASM_I32V(left), BUILD(rc_fn, WASM_RETURN_CALL_INDIRECT(sig_index, WASM_I32V(left),
WASM_I32V(right), WASM_GET_LOCAL(0), WASM_I32V(right), WASM_LOCAL_GET(0),
WASM_I32V(js_index))); WASM_I32V(js_index)));
} else { } else {
BUILD(rc_fn, BUILD(rc_fn,
WASM_RETURN_CALL_FUNCTION(js_index, WASM_I32V(left), WASM_I32V(right), WASM_RETURN_CALL_FUNCTION(js_index, WASM_I32V(left), WASM_I32V(right),
WASM_GET_LOCAL(0))); WASM_LOCAL_GET(0)));
} }
Handle<Object> args_left[] = {isolate->factory()->NewNumber(1)}; Handle<Object> args_left[] = {isolate->factory()->NewNumber(1)};
......
...@@ -332,7 +332,7 @@ TEST(Run_WasmModule_CallAdd) { ...@@ -332,7 +332,7 @@ TEST(Run_WasmModule_CallAdd) {
uint16_t param1 = 0; uint16_t param1 = 0;
uint16_t param2 = 1; uint16_t param2 = 1;
byte code1[] = { byte code1[] = {
WASM_I32_ADD(WASM_GET_LOCAL(param1), WASM_GET_LOCAL(param2))}; WASM_I32_ADD(WASM_LOCAL_GET(param1), WASM_LOCAL_GET(param2))};
EMIT_CODE_WITH_END(f1, code1); EMIT_CODE_WITH_END(f1, code1);
WasmFunctionBuilder* f2 = builder->AddFunction(sigs.i_v()); WasmFunctionBuilder* f2 = builder->AddFunction(sigs.i_v());
...@@ -381,9 +381,9 @@ TEST(Run_WasmModule_CheckMemoryIsZero) { ...@@ -381,9 +381,9 @@ TEST(Run_WasmModule_CheckMemoryIsZero) {
ExportAsMain(f); ExportAsMain(f);
byte code[] = {WASM_BLOCK_I( byte code[] = {WASM_BLOCK_I(
WASM_WHILE( WASM_WHILE(
WASM_I32_LTS(WASM_GET_LOCAL(localIndex), WASM_I32V_3(kCheckSize)), WASM_I32_LTS(WASM_LOCAL_GET(localIndex), WASM_I32V_3(kCheckSize)),
WASM_IF_ELSE( WASM_IF_ELSE(
WASM_LOAD_MEM(MachineType::Int32(), WASM_GET_LOCAL(localIndex)), WASM_LOAD_MEM(MachineType::Int32(), WASM_LOCAL_GET(localIndex)),
WASM_BRV(3, WASM_I32V_1(-1)), WASM_BRV(3, WASM_I32V_1(-1)),
WASM_INC_LOCAL_BY(localIndex, 4))), WASM_INC_LOCAL_BY(localIndex, 4))),
WASM_I32V_1(11))}; WASM_I32V_1(11))};
...@@ -405,9 +405,9 @@ TEST(Run_WasmModule_CallMain_recursive) { ...@@ -405,9 +405,9 @@ TEST(Run_WasmModule_CallMain_recursive) {
uint16_t localIndex = f->AddLocal(kWasmI32); uint16_t localIndex = f->AddLocal(kWasmI32);
ExportAsMain(f); ExportAsMain(f);
byte code[] = { byte code[] = {
WASM_SET_LOCAL(localIndex, WASM_LOCAL_SET(localIndex,
WASM_LOAD_MEM(MachineType::Int32(), WASM_ZERO)), WASM_LOAD_MEM(MachineType::Int32(), WASM_ZERO)),
WASM_IF_ELSE_I(WASM_I32_LTS(WASM_GET_LOCAL(localIndex), WASM_I32V_1(5)), WASM_IF_ELSE_I(WASM_I32_LTS(WASM_LOCAL_GET(localIndex), WASM_I32V_1(5)),
WASM_SEQ(WASM_STORE_MEM(MachineType::Int32(), WASM_ZERO, WASM_SEQ(WASM_STORE_MEM(MachineType::Int32(), WASM_ZERO,
WASM_INC_LOCAL(localIndex)), WASM_INC_LOCAL(localIndex)),
WASM_CALL_FUNCTION0(0)), WASM_CALL_FUNCTION0(0)),
...@@ -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_GET_LOCAL(0)), WASM_DROP, byte code[] = {WASM_GROW_MEMORY(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))};
...@@ -688,9 +688,9 @@ TEST(Run_WasmModule_GrowMemOobVariableIndex) { ...@@ -688,9 +688,9 @@ TEST(Run_WasmModule_GrowMemOobVariableIndex) {
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_GROW_MEMORY(WASM_I32V_1(1)), WASM_DROP,
WASM_STORE_MEM(MachineType::Int32(), WASM_GET_LOCAL(0), WASM_STORE_MEM(MachineType::Int32(), WASM_LOCAL_GET(0),
WASM_I32V(value)), WASM_I32V(value)),
WASM_LOAD_MEM(MachineType::Int32(), WASM_GET_LOCAL(0))}; WASM_LOAD_MEM(MachineType::Int32(), WASM_LOCAL_GET(0))};
EMIT_CODE_WITH_END(f, code); EMIT_CODE_WITH_END(f, code);
HandleScope scope(isolate); HandleScope scope(isolate);
......
...@@ -12,7 +12,7 @@ namespace wasm { ...@@ -12,7 +12,7 @@ namespace wasm {
WASM_EXEC_TEST(I32SExtendI8) { WASM_EXEC_TEST(I32SExtendI8) {
WasmRunner<int32_t, int32_t> r(execution_tier); WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_I32_SIGN_EXT_I8(WASM_GET_LOCAL(0))); BUILD(r, WASM_I32_SIGN_EXT_I8(WASM_LOCAL_GET(0)));
CHECK_EQ(0, r.Call(0)); CHECK_EQ(0, r.Call(0));
CHECK_EQ(1, r.Call(1)); CHECK_EQ(1, r.Call(1));
CHECK_EQ(-1, r.Call(-1)); CHECK_EQ(-1, r.Call(-1));
...@@ -22,7 +22,7 @@ WASM_EXEC_TEST(I32SExtendI8) { ...@@ -22,7 +22,7 @@ WASM_EXEC_TEST(I32SExtendI8) {
WASM_EXEC_TEST(I32SExtendI16) { WASM_EXEC_TEST(I32SExtendI16) {
WasmRunner<int32_t, int32_t> r(execution_tier); WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_I32_SIGN_EXT_I16(WASM_GET_LOCAL(0))); BUILD(r, WASM_I32_SIGN_EXT_I16(WASM_LOCAL_GET(0)));
CHECK_EQ(0, r.Call(0)); CHECK_EQ(0, r.Call(0));
CHECK_EQ(1, r.Call(1)); CHECK_EQ(1, r.Call(1));
CHECK_EQ(-1, r.Call(-1)); CHECK_EQ(-1, r.Call(-1));
...@@ -32,7 +32,7 @@ WASM_EXEC_TEST(I32SExtendI16) { ...@@ -32,7 +32,7 @@ WASM_EXEC_TEST(I32SExtendI16) {
WASM_EXEC_TEST(I64SExtendI8) { WASM_EXEC_TEST(I64SExtendI8) {
WasmRunner<int64_t, int64_t> r(execution_tier); WasmRunner<int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_SIGN_EXT_I8(WASM_GET_LOCAL(0))); BUILD(r, WASM_I64_SIGN_EXT_I8(WASM_LOCAL_GET(0)));
CHECK_EQ(0, r.Call(0)); CHECK_EQ(0, r.Call(0));
CHECK_EQ(1, r.Call(1)); CHECK_EQ(1, r.Call(1));
CHECK_EQ(-1, r.Call(-1)); CHECK_EQ(-1, r.Call(-1));
...@@ -42,7 +42,7 @@ WASM_EXEC_TEST(I64SExtendI8) { ...@@ -42,7 +42,7 @@ WASM_EXEC_TEST(I64SExtendI8) {
WASM_EXEC_TEST(I64SExtendI16) { WASM_EXEC_TEST(I64SExtendI16) {
WasmRunner<int64_t, int64_t> r(execution_tier); WasmRunner<int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_SIGN_EXT_I16(WASM_GET_LOCAL(0))); BUILD(r, WASM_I64_SIGN_EXT_I16(WASM_LOCAL_GET(0)));
CHECK_EQ(0, r.Call(0)); CHECK_EQ(0, r.Call(0));
CHECK_EQ(1, r.Call(1)); CHECK_EQ(1, r.Call(1));
CHECK_EQ(-1, r.Call(-1)); CHECK_EQ(-1, r.Call(-1));
...@@ -52,7 +52,7 @@ WASM_EXEC_TEST(I64SExtendI16) { ...@@ -52,7 +52,7 @@ WASM_EXEC_TEST(I64SExtendI16) {
WASM_EXEC_TEST(I64SExtendI32) { WASM_EXEC_TEST(I64SExtendI32) {
WasmRunner<int64_t, int64_t> r(execution_tier); WasmRunner<int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_SIGN_EXT_I32(WASM_GET_LOCAL(0))); BUILD(r, WASM_I64_SIGN_EXT_I32(WASM_LOCAL_GET(0)));
CHECK_EQ(0, r.Call(0)); CHECK_EQ(0, r.Call(0));
CHECK_EQ(1, r.Call(1)); CHECK_EQ(1, r.Call(1));
CHECK_EQ(-1, r.Call(-1)); CHECK_EQ(-1, r.Call(-1));
......
...@@ -32,7 +32,7 @@ namespace test_run_wasm_simd_liftoff { ...@@ -32,7 +32,7 @@ namespace test_run_wasm_simd_liftoff {
WASM_SIMD_LIFTOFF_TEST(S128Local) { WASM_SIMD_LIFTOFF_TEST(S128Local) {
WasmRunner<int32_t> r(TestExecutionTier::kLiftoff, kNoLowerSimd); WasmRunner<int32_t> r(TestExecutionTier::kLiftoff, kNoLowerSimd);
byte temp1 = r.AllocateLocal(kWasmS128); byte temp1 = r.AllocateLocal(kWasmS128);
BUILD(r, WASM_SET_LOCAL(temp1, WASM_GET_LOCAL(temp1)), WASM_ONE); BUILD(r, WASM_LOCAL_SET(temp1, WASM_LOCAL_GET(temp1)), WASM_ONE);
CHECK_EQ(1, r.Call()); CHECK_EQ(1, r.Call());
} }
...@@ -67,7 +67,7 @@ WASM_SIMD_LIFTOFF_TEST(S128Param) { ...@@ -67,7 +67,7 @@ WASM_SIMD_LIFTOFF_TEST(S128Param) {
BUILD(simd_func, WASM_ONE); BUILD(simd_func, WASM_ONE);
BUILD(r, BUILD(r,
WASM_CALL_FUNCTION(simd_func.function_index(), WASM_GET_LOCAL(temp1))); WASM_CALL_FUNCTION(simd_func.function_index(), WASM_LOCAL_GET(temp1)));
CHECK_EQ(1, r.Call()); CHECK_EQ(1, r.Call());
} }
...@@ -78,7 +78,7 @@ WASM_SIMD_LIFTOFF_TEST(S128Return) { ...@@ -78,7 +78,7 @@ WASM_SIMD_LIFTOFF_TEST(S128Return) {
TestSignatures sigs; TestSignatures sigs;
WasmFunctionCompiler& simd_func = r.NewFunction(sigs.s_i()); WasmFunctionCompiler& simd_func = r.NewFunction(sigs.s_i());
byte temp1 = simd_func.AllocateLocal(kWasmS128); byte temp1 = simd_func.AllocateLocal(kWasmS128);
BUILD(simd_func, WASM_GET_LOCAL(temp1)); BUILD(simd_func, WASM_LOCAL_GET(temp1));
BUILD(r, WASM_CALL_FUNCTION(simd_func.function_index(), WASM_ONE), kExprDrop, BUILD(r, WASM_CALL_FUNCTION(simd_func.function_index(), WASM_ONE), kExprDrop,
WASM_ONE); WASM_ONE);
...@@ -97,7 +97,7 @@ WASM_SIMD_LIFTOFF_TEST(REGRESS_1088273) { ...@@ -97,7 +97,7 @@ WASM_SIMD_LIFTOFF_TEST(REGRESS_1088273) {
TestSignatures sigs; TestSignatures sigs;
WasmFunctionCompiler& simd_func = r.NewFunction(sigs.s_i()); WasmFunctionCompiler& simd_func = r.NewFunction(sigs.s_i());
byte temp1 = simd_func.AllocateLocal(kWasmS128); byte temp1 = simd_func.AllocateLocal(kWasmS128);
BUILD(simd_func, WASM_GET_LOCAL(temp1)); BUILD(simd_func, WASM_LOCAL_GET(temp1));
BUILD(r, WASM_SIMD_SPLAT(I8x16, WASM_I32V(0x80)), BUILD(r, WASM_SIMD_SPLAT(I8x16, WASM_I32V(0x80)),
WASM_SIMD_SPLAT(I8x16, WASM_I32V(0x92)), WASM_SIMD_SPLAT(I8x16, WASM_I32V(0x92)),
...@@ -133,10 +133,10 @@ WASM_SIMD_LIFTOFF_TEST(I8x16Shuffle) { ...@@ -133,10 +133,10 @@ WASM_SIMD_LIFTOFF_TEST(I8x16Shuffle) {
{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 31}}; {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 31}};
// Set up locals so shuffle is called with non-adjacent registers v2 and v0. // Set up locals so shuffle is called with non-adjacent registers v2 and v0.
BUILD(r, WASM_SET_LOCAL(local0, WASM_GET_GLOBAL(1)), // local0 is in v0 BUILD(r, WASM_LOCAL_SET(local0, WASM_GET_GLOBAL(1)), // local0 is in v0
WASM_SET_LOCAL(local1, WASM_GET_GLOBAL(0)), // local1 is in v1 WASM_LOCAL_SET(local1, WASM_GET_GLOBAL(0)), // local1 is in v1
WASM_GET_GLOBAL(0), // global0 is in v2 WASM_GET_GLOBAL(0), // global0 is in v2
WASM_GET_LOCAL(local0), // local0 is in v0 WASM_LOCAL_GET(local0), // local0 is in v0
WASM_SET_GLOBAL(2, WASM_SIMD_I8x16_SHUFFLE_OP( WASM_SET_GLOBAL(2, WASM_SIMD_I8x16_SHUFFLE_OP(
kExprI8x16Shuffle, pattern, WASM_NOP, WASM_NOP)), kExprI8x16Shuffle, pattern, WASM_NOP, WASM_NOP)),
WASM_ONE); WASM_ONE);
...@@ -171,8 +171,8 @@ WASM_SIMD_LIFTOFF_TEST(I8x16Shuffle_SingleOperand) { ...@@ -171,8 +171,8 @@ WASM_SIMD_LIFTOFF_TEST(I8x16Shuffle_SingleOperand) {
{31, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0}}; {31, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0}};
// Set up locals so shuffle is called with non-adjacent registers v2 and v0. // Set up locals so shuffle is called with non-adjacent registers v2 and v0.
BUILD(r, WASM_SET_LOCAL(local0, WASM_GET_GLOBAL(0)), WASM_GET_LOCAL(local0), BUILD(r, WASM_LOCAL_SET(local0, WASM_GET_GLOBAL(0)), WASM_LOCAL_GET(local0),
WASM_GET_LOCAL(local0), WASM_LOCAL_GET(local0),
WASM_SET_GLOBAL(1, WASM_SIMD_I8x16_SHUFFLE_OP( WASM_SET_GLOBAL(1, WASM_SIMD_I8x16_SHUFFLE_OP(
kExprI8x16Shuffle, pattern, WASM_NOP, WASM_NOP)), kExprI8x16Shuffle, pattern, WASM_NOP, WASM_NOP)),
WASM_ONE); WASM_ONE);
......
...@@ -32,7 +32,7 @@ WASM_SIMD_TEST(I8x16ToF32x4) { ...@@ -32,7 +32,7 @@ WASM_SIMD_TEST(I8x16ToF32x4) {
BUILD(r, BUILD(r,
WASM_SET_GLOBAL( WASM_SET_GLOBAL(
0, WASM_SIMD_UNOP(kExprF32x4Sqrt, 0, WASM_SIMD_UNOP(kExprF32x4Sqrt,
WASM_SIMD_I8x16_SPLAT(WASM_GET_LOCAL(param1)))), WASM_SIMD_I8x16_SPLAT(WASM_LOCAL_GET(param1)))),
WASM_ONE); WASM_ONE);
// Arbitrary pattern that doesn't end up creating a NaN. // Arbitrary pattern that doesn't end up creating a NaN.
...@@ -52,7 +52,7 @@ WASM_SIMD_TEST(F64x2_Call_Return) { ...@@ -52,7 +52,7 @@ WASM_SIMD_TEST(F64x2_Call_Return) {
WasmFunctionCompiler& fn = r.NewFunction(sigs.s_ss()); WasmFunctionCompiler& fn = r.NewFunction(sigs.s_ss());
BUILD(fn, BUILD(fn,
WASM_SIMD_BINOP(kExprF64x2Min, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); WASM_SIMD_BINOP(kExprF64x2Min, WASM_LOCAL_GET(0), WASM_LOCAL_GET(1)));
byte c1[16] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, byte c1[16] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
...@@ -76,7 +76,7 @@ WASM_SIMD_TEST(F32x4_Call_Return) { ...@@ -76,7 +76,7 @@ WASM_SIMD_TEST(F32x4_Call_Return) {
// A simple function that just calls f32x4.neg on the param. // A simple function that just calls f32x4.neg on the param.
WasmFunctionCompiler& fn = r.NewFunction(sigs.s_s()); WasmFunctionCompiler& fn = r.NewFunction(sigs.s_s());
BUILD(fn, WASM_SIMD_UNOP(kExprF32x4Neg, WASM_GET_LOCAL(0))); BUILD(fn, WASM_SIMD_UNOP(kExprF32x4Neg, WASM_LOCAL_GET(0)));
// TODO(v8:10507) // TODO(v8:10507)
// Use i32x4 splat since scalar lowering has a problem with f32x4 as a param // Use i32x4 splat since scalar lowering has a problem with f32x4 as a param
...@@ -84,7 +84,7 @@ WASM_SIMD_TEST(F32x4_Call_Return) { ...@@ -84,7 +84,7 @@ WASM_SIMD_TEST(F32x4_Call_Return) {
BUILD(r, BUILD(r,
WASM_SIMD_F32x4_EXTRACT_LANE( WASM_SIMD_F32x4_EXTRACT_LANE(
0, WASM_CALL_FUNCTION(fn.function_index(), 0, WASM_CALL_FUNCTION(fn.function_index(),
WASM_SIMD_F32x4_SPLAT(WASM_GET_LOCAL(0))))); WASM_SIMD_F32x4_SPLAT(WASM_LOCAL_GET(0)))));
CHECK_EQ(-1.0, r.Call(1)); CHECK_EQ(-1.0, r.Call(1));
} }
...@@ -97,13 +97,13 @@ WASM_SIMD_TEST(I8x16_Call_Return) { ...@@ -97,13 +97,13 @@ WASM_SIMD_TEST(I8x16_Call_Return) {
WasmFunctionCompiler& fn = r.NewFunction(sigs.s_ss()); WasmFunctionCompiler& fn = r.NewFunction(sigs.s_ss());
BUILD(fn, BUILD(fn,
WASM_SIMD_BINOP(kExprI8x16Add, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); WASM_SIMD_BINOP(kExprI8x16Add, WASM_LOCAL_GET(0), WASM_LOCAL_GET(1)));
BUILD(r, BUILD(r,
WASM_SIMD_I8x16_EXTRACT_LANE( WASM_SIMD_I8x16_EXTRACT_LANE(
0, WASM_CALL_FUNCTION(fn.function_index(), 0, WASM_CALL_FUNCTION(fn.function_index(),
WASM_SIMD_I8x16_SPLAT(WASM_GET_LOCAL(0)), WASM_SIMD_I8x16_SPLAT(WASM_LOCAL_GET(0)),
WASM_SIMD_I8x16_SPLAT(WASM_GET_LOCAL(0))))); WASM_SIMD_I8x16_SPLAT(WASM_LOCAL_GET(0)))));
CHECK_EQ(2, r.Call(1)); CHECK_EQ(2, r.Call(1));
} }
...@@ -116,13 +116,13 @@ WASM_SIMD_TEST(I16x8_Call_Return) { ...@@ -116,13 +116,13 @@ WASM_SIMD_TEST(I16x8_Call_Return) {
WasmFunctionCompiler& fn = r.NewFunction(sigs.s_ss()); WasmFunctionCompiler& fn = r.NewFunction(sigs.s_ss());
BUILD(fn, BUILD(fn,
WASM_SIMD_BINOP(kExprI16x8Add, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); WASM_SIMD_BINOP(kExprI16x8Add, WASM_LOCAL_GET(0), WASM_LOCAL_GET(1)));
BUILD(r, BUILD(r,
WASM_SIMD_I16x8_EXTRACT_LANE( WASM_SIMD_I16x8_EXTRACT_LANE(
0, WASM_CALL_FUNCTION(fn.function_index(), 0, WASM_CALL_FUNCTION(fn.function_index(),
WASM_SIMD_I16x8_SPLAT(WASM_GET_LOCAL(0)), WASM_SIMD_I16x8_SPLAT(WASM_LOCAL_GET(0)),
WASM_SIMD_I16x8_SPLAT(WASM_GET_LOCAL(0))))); WASM_SIMD_I16x8_SPLAT(WASM_LOCAL_GET(0)))));
CHECK_EQ(2, r.Call(1)); CHECK_EQ(2, r.Call(1));
} }
...@@ -135,13 +135,13 @@ WASM_SIMD_TEST(I64x2_Call_Return) { ...@@ -135,13 +135,13 @@ WASM_SIMD_TEST(I64x2_Call_Return) {
WasmFunctionCompiler& fn = r.NewFunction(sigs.s_ss()); WasmFunctionCompiler& fn = r.NewFunction(sigs.s_ss());
BUILD(fn, BUILD(fn,
WASM_SIMD_BINOP(kExprI64x2Add, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); WASM_SIMD_BINOP(kExprI64x2Add, WASM_LOCAL_GET(0), WASM_LOCAL_GET(1)));
BUILD(r, BUILD(r,
WASM_SIMD_I64x2_EXTRACT_LANE( WASM_SIMD_I64x2_EXTRACT_LANE(
0, WASM_CALL_FUNCTION(fn.function_index(), 0, WASM_CALL_FUNCTION(fn.function_index(),
WASM_SIMD_I64x2_SPLAT(WASM_GET_LOCAL(0)), WASM_SIMD_I64x2_SPLAT(WASM_LOCAL_GET(0)),
WASM_SIMD_I64x2_SPLAT(WASM_GET_LOCAL(0))))); WASM_SIMD_I64x2_SPLAT(WASM_LOCAL_GET(0)))));
CHECK_EQ(2, r.Call(1)); CHECK_EQ(2, r.Call(1));
} }
...@@ -192,7 +192,7 @@ WASM_SIMD_TEST(AllTrue_DifferentShapes) { ...@@ -192,7 +192,7 @@ WASM_SIMD_TEST(AllTrue_DifferentShapes) {
{ {
WasmRunner<int32_t, int32_t> r(execution_tier, lower_simd); WasmRunner<int32_t, int32_t> r(execution_tier, lower_simd);
BUILD(r, WASM_SIMD_I32x4_SPLAT(WASM_GET_LOCAL(0)), BUILD(r, WASM_SIMD_I32x4_SPLAT(WASM_LOCAL_GET(0)),
WASM_SIMD_OP(kExprV8x16AllTrue)); WASM_SIMD_OP(kExprV8x16AllTrue));
CHECK_EQ(0, r.Call(0x00FF00FF)); CHECK_EQ(0, r.Call(0x00FF00FF));
...@@ -201,7 +201,7 @@ WASM_SIMD_TEST(AllTrue_DifferentShapes) { ...@@ -201,7 +201,7 @@ WASM_SIMD_TEST(AllTrue_DifferentShapes) {
{ {
WasmRunner<int32_t, int32_t> r(execution_tier, lower_simd); WasmRunner<int32_t, int32_t> r(execution_tier, lower_simd);
BUILD(r, WASM_SIMD_I32x4_SPLAT(WASM_GET_LOCAL(0)), BUILD(r, WASM_SIMD_I32x4_SPLAT(WASM_LOCAL_GET(0)),
WASM_SIMD_OP(kExprV16x8AllTrue)); WASM_SIMD_OP(kExprV16x8AllTrue));
CHECK_EQ(0, r.Call(0x000000FF)); CHECK_EQ(0, r.Call(0x000000FF));
...@@ -211,7 +211,7 @@ WASM_SIMD_TEST(AllTrue_DifferentShapes) { ...@@ -211,7 +211,7 @@ WASM_SIMD_TEST(AllTrue_DifferentShapes) {
{ {
WasmRunner<int32_t, float> r(execution_tier, lower_simd); WasmRunner<int32_t, float> r(execution_tier, lower_simd);
BUILD(r, WASM_SIMD_F32x4_SPLAT(WASM_GET_LOCAL(0)), BUILD(r, WASM_SIMD_F32x4_SPLAT(WASM_LOCAL_GET(0)),
WASM_SIMD_OP(kExprV16x8AllTrue)); WASM_SIMD_OP(kExprV16x8AllTrue));
CHECK_EQ(1, r.Call(0x000F000F)); CHECK_EQ(1, r.Call(0x000F000F));
...@@ -223,7 +223,7 @@ WASM_SIMD_TEST(AnyTrue_DifferentShapes) { ...@@ -223,7 +223,7 @@ WASM_SIMD_TEST(AnyTrue_DifferentShapes) {
{ {
WasmRunner<int32_t, int32_t> r(execution_tier, lower_simd); WasmRunner<int32_t, int32_t> r(execution_tier, lower_simd);
BUILD(r, WASM_SIMD_I32x4_SPLAT(WASM_GET_LOCAL(0)), BUILD(r, WASM_SIMD_I32x4_SPLAT(WASM_LOCAL_GET(0)),
WASM_SIMD_OP(kExprV8x16AnyTrue)); WASM_SIMD_OP(kExprV8x16AnyTrue));
CHECK_EQ(0, r.Call(0x00000000)); CHECK_EQ(0, r.Call(0x00000000));
...@@ -232,7 +232,7 @@ WASM_SIMD_TEST(AnyTrue_DifferentShapes) { ...@@ -232,7 +232,7 @@ WASM_SIMD_TEST(AnyTrue_DifferentShapes) {
{ {
WasmRunner<int32_t, int32_t> r(execution_tier, lower_simd); WasmRunner<int32_t, int32_t> r(execution_tier, lower_simd);
BUILD(r, WASM_SIMD_I32x4_SPLAT(WASM_GET_LOCAL(0)), BUILD(r, WASM_SIMD_I32x4_SPLAT(WASM_LOCAL_GET(0)),
WASM_SIMD_OP(kExprV16x8AnyTrue)); WASM_SIMD_OP(kExprV16x8AnyTrue));
CHECK_EQ(1, r.Call(0x000000FF)); CHECK_EQ(1, r.Call(0x000000FF));
...@@ -242,7 +242,7 @@ WASM_SIMD_TEST(AnyTrue_DifferentShapes) { ...@@ -242,7 +242,7 @@ WASM_SIMD_TEST(AnyTrue_DifferentShapes) {
{ {
WasmRunner<int32_t, float> r(execution_tier, lower_simd); WasmRunner<int32_t, float> r(execution_tier, lower_simd);
BUILD(r, WASM_SIMD_F32x4_SPLAT(WASM_GET_LOCAL(0)), BUILD(r, WASM_SIMD_F32x4_SPLAT(WASM_LOCAL_GET(0)),
WASM_SIMD_OP(kExprV8x16AnyTrue)); WASM_SIMD_OP(kExprV8x16AnyTrue));
CHECK_EQ(0, r.Call(0x00000000)); CHECK_EQ(0, r.Call(0x00000000));
...@@ -265,10 +265,10 @@ WASM_SIMD_TEST(V128_I64_PARAMS) { ...@@ -265,10 +265,10 @@ WASM_SIMD_TEST(V128_I64_PARAMS) {
// Build a function that has both V128 and I64 arguments. // Build a function that has both V128 and I64 arguments.
BUILD(fn, BUILD(fn,
WASM_SIMD_I64x2_REPLACE_LANE(0, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); WASM_SIMD_I64x2_REPLACE_LANE(0, WASM_LOCAL_GET(0), WASM_LOCAL_GET(1)));
BUILD(r, WASM_SIMD_I64x2_EXTRACT_LANE( BUILD(r, WASM_SIMD_I64x2_EXTRACT_LANE(
0, WASM_SIMD_I64x2_SPLAT(WASM_GET_LOCAL(0)))); 0, WASM_SIMD_I64x2_SPLAT(WASM_LOCAL_GET(0))));
CHECK_EQ(0, r.Call(0)); CHECK_EQ(0, r.Call(0));
} }
...@@ -278,8 +278,8 @@ WASM_SIMD_TEST(I8x16WidenS_I16x8NarrowU) { ...@@ -278,8 +278,8 @@ WASM_SIMD_TEST(I8x16WidenS_I16x8NarrowU) {
{ {
WasmRunner<int32_t, int16_t> r(execution_tier, lower_simd); WasmRunner<int32_t, int16_t> r(execution_tier, lower_simd);
BUILD(r, WASM_SIMD_I16x8_SPLAT(WASM_GET_LOCAL(0)), BUILD(r, WASM_SIMD_I16x8_SPLAT(WASM_LOCAL_GET(0)),
WASM_SIMD_I16x8_SPLAT(WASM_GET_LOCAL(0)), WASM_SIMD_I16x8_SPLAT(WASM_LOCAL_GET(0)),
WASM_SIMD_OP(kExprI8x16UConvertI16x8), WASM_SIMD_OP(kExprI8x16UConvertI16x8),
WASM_SIMD_OP(kExprI16x8SConvertI8x16Low), WASM_SIMD_OP(kExprI16x8SConvertI8x16Low),
WASM_SIMD_OP(kExprI32x4ExtractLane), TO_BYTE(0)); WASM_SIMD_OP(kExprI32x4ExtractLane), TO_BYTE(0));
...@@ -290,8 +290,8 @@ WASM_SIMD_TEST(I8x16WidenS_I16x8NarrowU) { ...@@ -290,8 +290,8 @@ WASM_SIMD_TEST(I8x16WidenS_I16x8NarrowU) {
WASM_SIMD_TEST(S128SelectWithF32x4) { WASM_SIMD_TEST(S128SelectWithF32x4) {
WasmRunner<float, int32_t, float, int32_t> r(execution_tier, lower_simd); WasmRunner<float, int32_t, float, int32_t> r(execution_tier, lower_simd);
BUILD(r, WASM_GET_LOCAL(0), WASM_SIMD_OP(kExprI32x4Splat), WASM_GET_LOCAL(1), BUILD(r, WASM_LOCAL_GET(0), WASM_SIMD_OP(kExprI32x4Splat), WASM_LOCAL_GET(1),
WASM_SIMD_OP(kExprF32x4Splat), WASM_GET_LOCAL(2), WASM_SIMD_OP(kExprF32x4Splat), WASM_LOCAL_GET(2),
WASM_SIMD_OP(kExprI32x4Splat), WASM_SIMD_OP(kExprS128Select), WASM_SIMD_OP(kExprI32x4Splat), WASM_SIMD_OP(kExprS128Select),
WASM_SIMD_OP(kExprF32x4ExtractLane), 0); WASM_SIMD_OP(kExprF32x4ExtractLane), 0);
// Selection mask is all 0, so always select 2.0. // Selection mask is all 0, so always select 2.0.
...@@ -300,7 +300,7 @@ WASM_SIMD_TEST(S128SelectWithF32x4) { ...@@ -300,7 +300,7 @@ WASM_SIMD_TEST(S128SelectWithF32x4) {
WASM_SIMD_TEST(S128AndNotWithF32x4) { WASM_SIMD_TEST(S128AndNotWithF32x4) {
WasmRunner<float, int32_t, float> r(execution_tier, lower_simd); WasmRunner<float, int32_t, float> r(execution_tier, lower_simd);
BUILD(r, WASM_GET_LOCAL(0), WASM_SIMD_OP(kExprI32x4Splat), WASM_GET_LOCAL(1), BUILD(r, WASM_LOCAL_GET(0), WASM_SIMD_OP(kExprI32x4Splat), WASM_LOCAL_GET(1),
WASM_SIMD_OP(kExprF32x4Splat), WASM_SIMD_OP(kExprS128AndNot), WASM_SIMD_OP(kExprF32x4Splat), WASM_SIMD_OP(kExprS128AndNot),
WASM_SIMD_OP(kExprF32x4ExtractLane), 0); WASM_SIMD_OP(kExprF32x4ExtractLane), 0);
// 0x00700000 & !0x40800000 = 0x00700000 // 0x00700000 & !0x40800000 = 0x00700000
...@@ -316,11 +316,11 @@ WASM_SIMD_TEST(FunctionCallWithExtractLaneOutputAsArgument) { ...@@ -316,11 +316,11 @@ WASM_SIMD_TEST(FunctionCallWithExtractLaneOutputAsArgument) {
WasmRunner<int32_t, int32_t> r(execution_tier, lower_simd); WasmRunner<int32_t, int32_t> r(execution_tier, lower_simd);
WasmFunctionCompiler& fn = r.NewFunction(sigs.f_f()); WasmFunctionCompiler& fn = r.NewFunction(sigs.f_f());
BUILD(fn, WASM_GET_LOCAL(0), WASM_GET_LOCAL(0), kExprF32Add); BUILD(fn, WASM_LOCAL_GET(0), WASM_LOCAL_GET(0), kExprF32Add);
BUILD(r, WASM_GET_LOCAL(0), WASM_SIMD_OP(kExprI32x4Splat), BUILD(r, WASM_LOCAL_GET(0), WASM_SIMD_OP(kExprI32x4Splat),
WASM_SIMD_OP(kExprF32x4ExtractLane), 0, kExprCallFunction, WASM_SIMD_OP(kExprF32x4ExtractLane), 0, kExprCallFunction,
fn.function_index(), WASM_SIMD_OP(kExprF32x4Splat), WASM_GET_LOCAL(0), fn.function_index(), WASM_SIMD_OP(kExprF32x4Splat), WASM_LOCAL_GET(0),
WASM_SIMD_OP(kExprI32x4Splat), WASM_SIMD_OP(kExprI32x4Add), WASM_SIMD_OP(kExprI32x4Splat), WASM_SIMD_OP(kExprI32x4Add),
WASM_SIMD_OP(kExprI32x4ExtractLane), 0); WASM_SIMD_OP(kExprI32x4ExtractLane), 0);
CHECK_EQ(15, r.Call(5)); CHECK_EQ(15, r.Call(5));
......
This diff is collapsed.
...@@ -79,7 +79,7 @@ TEST(WrapperBudget) { ...@@ -79,7 +79,7 @@ TEST(WrapperBudget) {
TestSignatures sigs; TestSignatures sigs;
WasmFunctionBuilder* f = builder->AddFunction(sigs.i_ii()); WasmFunctionBuilder* f = builder->AddFunction(sigs.i_ii());
f->builder()->AddExport(CStrVector("main"), f); f->builder()->AddExport(CStrVector("main"), f);
byte code[] = {WASM_I32_MUL(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)), byte code[] = {WASM_I32_MUL(WASM_LOCAL_GET(0), WASM_LOCAL_GET(1)),
WASM_END}; WASM_END};
f->EmitCode(code, sizeof(code)); f->EmitCode(code, sizeof(code));
...@@ -125,7 +125,7 @@ TEST(WrapperReplacement) { ...@@ -125,7 +125,7 @@ TEST(WrapperReplacement) {
TestSignatures sigs; TestSignatures sigs;
WasmFunctionBuilder* f = builder->AddFunction(sigs.i_i()); WasmFunctionBuilder* f = builder->AddFunction(sigs.i_i());
f->builder()->AddExport(CStrVector("main"), f); f->builder()->AddExport(CStrVector("main"), f);
byte code[] = {WASM_GET_LOCAL(0), WASM_END}; byte code[] = {WASM_LOCAL_GET(0), WASM_END};
f->EmitCode(code, sizeof(code)); f->EmitCode(code, sizeof(code));
// Compile the module. // Compile the module.
...@@ -196,17 +196,17 @@ TEST(EagerWrapperReplacement) { ...@@ -196,17 +196,17 @@ TEST(EagerWrapperReplacement) {
TestSignatures sigs; TestSignatures sigs;
WasmFunctionBuilder* add = builder->AddFunction(sigs.i_ii()); WasmFunctionBuilder* add = builder->AddFunction(sigs.i_ii());
add->builder()->AddExport(CStrVector("add"), add); add->builder()->AddExport(CStrVector("add"), add);
byte add_code[] = {WASM_I32_ADD(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)), byte add_code[] = {WASM_I32_ADD(WASM_LOCAL_GET(0), WASM_LOCAL_GET(1)),
WASM_END}; WASM_END};
add->EmitCode(add_code, sizeof(add_code)); add->EmitCode(add_code, sizeof(add_code));
WasmFunctionBuilder* mult = builder->AddFunction(sigs.i_ii()); WasmFunctionBuilder* mult = builder->AddFunction(sigs.i_ii());
mult->builder()->AddExport(CStrVector("mult"), mult); mult->builder()->AddExport(CStrVector("mult"), mult);
byte mult_code[] = {WASM_I32_MUL(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)), byte mult_code[] = {WASM_I32_MUL(WASM_LOCAL_GET(0), WASM_LOCAL_GET(1)),
WASM_END}; WASM_END};
mult->EmitCode(mult_code, sizeof(mult_code)); mult->EmitCode(mult_code, sizeof(mult_code));
WasmFunctionBuilder* id = builder->AddFunction(sigs.i_i()); WasmFunctionBuilder* id = builder->AddFunction(sigs.i_i());
id->builder()->AddExport(CStrVector("id"), id); id->builder()->AddExport(CStrVector("id"), id);
byte id_code[] = {WASM_GET_LOCAL(0), WASM_END}; byte id_code[] = {WASM_LOCAL_GET(0), WASM_END};
id->EmitCode(id_code, sizeof(id_code)); id->EmitCode(id_code, sizeof(id_code));
// Compile the module. // Compile the module.
...@@ -297,7 +297,7 @@ TEST(WrapperReplacement_IndirectExport) { ...@@ -297,7 +297,7 @@ TEST(WrapperReplacement_IndirectExport) {
// Define a Wasm function, but do not add it to the exports. // Define a Wasm function, but do not add it to the exports.
TestSignatures sigs; TestSignatures sigs;
WasmFunctionBuilder* f = builder->AddFunction(sigs.i_i()); WasmFunctionBuilder* f = builder->AddFunction(sigs.i_i());
byte code[] = {WASM_GET_LOCAL(0), WASM_END}; byte code[] = {WASM_LOCAL_GET(0), WASM_END};
f->EmitCode(code, sizeof(code)); f->EmitCode(code, sizeof(code));
uint32_t function_index = f->func_index(); uint32_t function_index = f->func_index();
......
This diff is collapsed.
...@@ -377,14 +377,14 @@ WASM_COMPILED_EXEC_TEST(WasmStepInAndOut) { ...@@ -377,14 +377,14 @@ WASM_COMPILED_EXEC_TEST(WasmStepInAndOut) {
// functions in the code section matches the function indexes. // functions in the code section matches the function indexes.
// return arg0 // return arg0
BUILD(runner, WASM_RETURN1(WASM_GET_LOCAL(0))); BUILD(runner, WASM_RETURN1(WASM_LOCAL_GET(0)));
// for (int i = 0; i < 10; ++i) { f2(i); } // for (int i = 0; i < 10; ++i) { f2(i); }
BUILD(f2, WASM_LOOP( BUILD(f2, WASM_LOOP(
WASM_BR_IF(0, WASM_BINOP(kExprI32GeU, WASM_GET_LOCAL(0), WASM_BR_IF(0, WASM_BINOP(kExprI32GeU, WASM_LOCAL_GET(0),
WASM_I32V_1(10))), WASM_I32V_1(10))),
WASM_SET_LOCAL( WASM_LOCAL_SET(
0, WASM_BINOP(kExprI32Sub, WASM_GET_LOCAL(0), WASM_ONE)), 0, WASM_BINOP(kExprI32Sub, WASM_LOCAL_GET(0), WASM_ONE)),
WASM_CALL_FUNCTION(runner.function_index(), WASM_GET_LOCAL(0)), WASM_CALL_FUNCTION(runner.function_index(), WASM_LOCAL_GET(0)),
WASM_DROP, WASM_BR(1))); WASM_DROP, WASM_BR(1)));
Isolate* isolate = runner.main_isolate(); Isolate* isolate = runner.main_isolate();
...@@ -415,11 +415,11 @@ WASM_COMPILED_EXEC_TEST(WasmGetLocalsAndStack) { ...@@ -415,11 +415,11 @@ WASM_COMPILED_EXEC_TEST(WasmGetLocalsAndStack) {
BUILD(runner, BUILD(runner,
// set [1] to 17 // set [1] to 17
WASM_SET_LOCAL(1, WASM_I64V_1(17)), WASM_LOCAL_SET(1, WASM_I64V_1(17)),
// set [2] to <arg0> = 7 // set [2] to <arg0> = 7
WASM_SET_LOCAL(2, WASM_F32_SCONVERT_I32(WASM_GET_LOCAL(0))), WASM_LOCAL_SET(2, WASM_F32_SCONVERT_I32(WASM_LOCAL_GET(0))),
// set [3] to <arg1>/2 = 8.5 // set [3] to <arg1>/2 = 8.5
WASM_SET_LOCAL(3, WASM_F64_DIV(WASM_F64_SCONVERT_I64(WASM_GET_LOCAL(1)), WASM_LOCAL_SET(3, WASM_F64_DIV(WASM_F64_SCONVERT_I64(WASM_LOCAL_GET(1)),
WASM_F64(2)))); WASM_F64(2))));
Isolate* isolate = runner.main_isolate(); Isolate* isolate = runner.main_isolate();
......
...@@ -450,7 +450,7 @@ WASM_COMPILED_EXEC_TEST(WasmDebugEvaluate_Locals) { ...@@ -450,7 +450,7 @@ WASM_COMPILED_EXEC_TEST(WasmDebugEvaluate_Locals) {
TestCode<int> code( TestCode<int> code(
&runner, &runner,
{WASM_SET_LOCAL(0, WASM_I32V_2('A')), WASM_RETURN1(WASM_GET_LOCAL(0))}, {WASM_LOCAL_SET(0, WASM_I32V_2('A')), WASM_RETURN1(WASM_LOCAL_GET(0))},
{ValueType::kI32}); {ValueType::kI32});
code.BreakOnReturn(&runner); code.BreakOnReturn(&runner);
...@@ -500,7 +500,7 @@ WASM_COMPILED_EXEC_TEST(WasmDebugEvaluate_Operands) { ...@@ -500,7 +500,7 @@ WASM_COMPILED_EXEC_TEST(WasmDebugEvaluate_Operands) {
runner.builder().AddMemoryElems<int32_t>(64); runner.builder().AddMemoryElems<int32_t>(64);
TestCode<int> code(&runner, TestCode<int> code(&runner,
{WASM_SET_LOCAL(0, WASM_I32V_1('4')), WASM_GET_LOCAL(0), {WASM_LOCAL_SET(0, WASM_I32V_1('4')), WASM_LOCAL_GET(0),
WASM_RETURN1(WASM_I32V_1('5'))}, WASM_RETURN1(WASM_I32V_1('5'))},
{ValueType::kI32}); {ValueType::kI32});
code.BreakOnReturn(&runner); code.BreakOnReturn(&runner);
...@@ -530,7 +530,7 @@ WASM_COMPILED_EXEC_TEST(WasmDebugEvaluate_JavaScript) { ...@@ -530,7 +530,7 @@ WASM_COMPILED_EXEC_TEST(WasmDebugEvaluate_JavaScript) {
TestCode<int64_t> code( TestCode<int64_t> code(
&runner, &runner,
{WASM_SET_GLOBAL(0, WASM_I32V_2('B')), {WASM_SET_GLOBAL(0, WASM_I32V_2('B')),
WASM_SET_LOCAL(0, WASM_I64V_2('A')), WASM_RETURN1(WASM_GET_LOCAL(0))}, WASM_LOCAL_SET(0, WASM_I64V_2('A')), WASM_RETURN1(WASM_LOCAL_GET(0))},
{ValueType::kI64}); {ValueType::kI64});
code.BreakOnReturn(&runner); code.BreakOnReturn(&runner);
......
...@@ -41,7 +41,7 @@ class WasmSerializationTest { ...@@ -41,7 +41,7 @@ class WasmSerializationTest {
TestSignatures sigs; TestSignatures sigs;
WasmFunctionBuilder* f = builder->AddFunction(sigs.i_i()); WasmFunctionBuilder* f = builder->AddFunction(sigs.i_i());
byte code[] = {WASM_GET_LOCAL(0), kExprI32Const, 1, kExprI32Add, kExprEnd}; byte code[] = {WASM_LOCAL_GET(0), kExprI32Const, 1, kExprI32Add, kExprEnd};
f->EmitCode(code, sizeof(code)); f->EmitCode(code, sizeof(code));
builder->AddExport(CStrVector(kFunctionName), f); builder->AddExport(CStrVector(kFunctionName), f);
......
...@@ -429,9 +429,9 @@ inline WasmOpcode LoadStoreOpcodeOf(MachineType type, bool store) { ...@@ -429,9 +429,9 @@ inline WasmOpcode LoadStoreOpcodeOf(MachineType type, bool store) {
static_cast<byte>(bit_cast<uint64_t>(static_cast<double>(val)) >> 48), \ static_cast<byte>(bit_cast<uint64_t>(static_cast<double>(val)) >> 48), \
static_cast<byte>(bit_cast<uint64_t>(static_cast<double>(val)) >> 56) static_cast<byte>(bit_cast<uint64_t>(static_cast<double>(val)) >> 56)
#define WASM_GET_LOCAL(index) kExprLocalGet, static_cast<byte>(index) #define WASM_LOCAL_GET(index) kExprLocalGet, static_cast<byte>(index)
#define WASM_SET_LOCAL(index, val) val, kExprLocalSet, static_cast<byte>(index) #define WASM_LOCAL_SET(index, val) val, kExprLocalSet, static_cast<byte>(index)
#define WASM_TEE_LOCAL(index, val) val, kExprLocalTee, static_cast<byte>(index) #define WASM_LOCAL_TEE(index, val) val, kExprLocalTee, static_cast<byte>(index)
#define WASM_DROP kExprDrop #define WASM_DROP kExprDrop
#define WASM_GET_GLOBAL(index) kExprGlobalGet, static_cast<byte>(index) #define WASM_GET_GLOBAL(index) kExprGlobalGet, static_cast<byte>(index)
#define WASM_SET_GLOBAL(index, val) \ #define WASM_SET_GLOBAL(index, val) \
......
...@@ -18,7 +18,7 @@ namespace v8 { ...@@ -18,7 +18,7 @@ namespace v8 {
namespace internal { namespace internal {
namespace wasm { namespace wasm {
#define WASM_SET_ZERO(i) WASM_SET_LOCAL(i, WASM_ZERO) #define WASM_SET_ZERO(i) WASM_LOCAL_SET(i, WASM_ZERO)
class WasmLoopAssignmentAnalyzerTest : public TestWithZone { class WasmLoopAssignmentAnalyzerTest : public TestWithZone {
public: public:
...@@ -62,7 +62,7 @@ TEST_F(WasmLoopAssignmentAnalyzerTest, One) { ...@@ -62,7 +62,7 @@ TEST_F(WasmLoopAssignmentAnalyzerTest, One) {
TEST_F(WasmLoopAssignmentAnalyzerTest, TeeOne) { TEST_F(WasmLoopAssignmentAnalyzerTest, TeeOne) {
num_locals = 5; num_locals = 5;
for (int i = 0; i < 5; i++) { for (int i = 0; i < 5; i++) {
byte code[] = {WASM_LOOP(WASM_TEE_LOCAL(i, WASM_ZERO))}; byte code[] = {WASM_LOOP(WASM_LOCAL_TEE(i, WASM_ZERO))};
BitVector* assigned = Analyze(code, code + arraysize(code)); BitVector* assigned = Analyze(code, code + arraysize(code));
for (int j = 0; j < assigned->length(); j++) { for (int j = 0; j < assigned->length(); j++) {
EXPECT_EQ(j == i, assigned->Contains(j)); EXPECT_EQ(j == i, assigned->Contains(j));
...@@ -124,7 +124,7 @@ TEST_F(WasmLoopAssignmentAnalyzerTest, BigLocal) { ...@@ -124,7 +124,7 @@ TEST_F(WasmLoopAssignmentAnalyzerTest, BigLocal) {
TEST_F(WasmLoopAssignmentAnalyzerTest, Break) { TEST_F(WasmLoopAssignmentAnalyzerTest, Break) {
num_locals = 3; num_locals = 3;
byte code[] = { byte code[] = {
WASM_LOOP(WASM_IF(WASM_GET_LOCAL(0), WASM_BRV(1, WASM_SET_ZERO(1)))), WASM_LOOP(WASM_IF(WASM_LOCAL_GET(0), WASM_BRV(1, WASM_SET_ZERO(1)))),
WASM_SET_ZERO(0)}; WASM_SET_ZERO(0)};
BitVector* assigned = Analyze(code, code + arraysize(code)); BitVector* assigned = Analyze(code, code + arraysize(code));
...@@ -138,10 +138,10 @@ TEST_F(WasmLoopAssignmentAnalyzerTest, Loop1) { ...@@ -138,10 +138,10 @@ TEST_F(WasmLoopAssignmentAnalyzerTest, Loop1) {
num_locals = 5; num_locals = 5;
byte code[] = { byte code[] = {
WASM_LOOP(WASM_IF( WASM_LOOP(WASM_IF(
WASM_GET_LOCAL(0), WASM_LOCAL_GET(0),
WASM_BRV(0, WASM_SET_LOCAL(3, WASM_I32_SUB(WASM_GET_LOCAL(0), WASM_BRV(0, WASM_LOCAL_SET(3, WASM_I32_SUB(WASM_LOCAL_GET(0),
WASM_I32V_1(1)))))), WASM_I32V_1(1)))))),
WASM_GET_LOCAL(0)}; WASM_LOCAL_GET(0)};
BitVector* assigned = Analyze(code, code + arraysize(code)); BitVector* assigned = Analyze(code, code + arraysize(code));
for (int j = 0; j < assigned->length(); j++) { for (int j = 0; j < assigned->length(); j++) {
...@@ -157,16 +157,16 @@ TEST_F(WasmLoopAssignmentAnalyzerTest, Loop2) { ...@@ -157,16 +157,16 @@ TEST_F(WasmLoopAssignmentAnalyzerTest, Loop2) {
byte code[] = {WASM_BLOCK( byte code[] = {WASM_BLOCK(
WASM_WHILE( WASM_WHILE(
WASM_GET_LOCAL(kIter), WASM_LOCAL_GET(kIter),
WASM_BLOCK( WASM_BLOCK(
WASM_SET_LOCAL( WASM_LOCAL_SET(
kSum, WASM_F32_ADD(WASM_GET_LOCAL(kSum), kSum, WASM_F32_ADD(WASM_LOCAL_GET(kSum),
WASM_LOAD_MEM(MachineType::Float32(), WASM_LOAD_MEM(MachineType::Float32(),
WASM_GET_LOCAL(kIter)))), WASM_LOCAL_GET(kIter)))),
WASM_SET_LOCAL( WASM_LOCAL_SET(
kIter, WASM_I32_SUB(WASM_GET_LOCAL(kIter), WASM_I32V_1(4))))), kIter, WASM_I32_SUB(WASM_LOCAL_GET(kIter), WASM_I32V_1(4))))),
WASM_STORE_MEM(MachineType::Float32(), WASM_ZERO, WASM_GET_LOCAL(kSum)), WASM_STORE_MEM(MachineType::Float32(), WASM_ZERO, WASM_LOCAL_GET(kSum)),
WASM_GET_LOCAL(kIter))}; WASM_LOCAL_GET(kIter))};
BitVector* assigned = Analyze(code + 2, code + arraysize(code)); BitVector* assigned = Analyze(code + 2, code + arraysize(code));
for (int j = 0; j < assigned->length(); j++) { for (int j = 0; j < assigned->length(); j++) {
......
...@@ -2872,8 +2872,8 @@ TEST_F(WasmInitExprDecodeTest, InitExpr_ExternRef) { ...@@ -2872,8 +2872,8 @@ TEST_F(WasmInitExprDecodeTest, InitExpr_ExternRef) {
TEST_F(WasmInitExprDecodeTest, InitExpr_illegal) { TEST_F(WasmInitExprDecodeTest, InitExpr_illegal) {
EXPECT_INIT_EXPR_FAIL(WASM_I32V_1(0), WASM_I32V_1(0)); EXPECT_INIT_EXPR_FAIL(WASM_I32V_1(0), WASM_I32V_1(0));
EXPECT_INIT_EXPR_FAIL(WASM_GET_LOCAL(0)); EXPECT_INIT_EXPR_FAIL(WASM_LOCAL_GET(0));
EXPECT_INIT_EXPR_FAIL(WASM_SET_LOCAL(0, WASM_I32V_1(0))); EXPECT_INIT_EXPR_FAIL(WASM_LOCAL_SET(0, WASM_I32V_1(0)));
EXPECT_INIT_EXPR_FAIL(WASM_I32_ADD(WASM_I32V_1(0), WASM_I32V_1(0))); EXPECT_INIT_EXPR_FAIL(WASM_I32_ADD(WASM_I32V_1(0), WASM_I32V_1(0)));
EXPECT_INIT_EXPR_FAIL(WASM_IF_ELSE(WASM_ZERO, WASM_ZERO, WASM_ZERO)); EXPECT_INIT_EXPR_FAIL(WASM_IF_ELSE(WASM_ZERO, WASM_ZERO, WASM_ZERO));
} }
......
...@@ -52,7 +52,7 @@ TEST_F(WasmMacroGenTest, Statements) { ...@@ -52,7 +52,7 @@ TEST_F(WasmMacroGenTest, Statements) {
EXPECT_SIZE(1, WASM_NOP); EXPECT_SIZE(1, WASM_NOP);
EXPECT_SIZE(1, WASM_END); EXPECT_SIZE(1, WASM_END);
EXPECT_SIZE(4, WASM_SET_LOCAL(0, WASM_ZERO)); EXPECT_SIZE(4, WASM_LOCAL_SET(0, WASM_ZERO));
EXPECT_SIZE(4, WASM_SET_GLOBAL(0, WASM_ZERO)); EXPECT_SIZE(4, WASM_SET_GLOBAL(0, WASM_ZERO));
...@@ -99,9 +99,9 @@ TEST_F(WasmMacroGenTest, BrTable) { ...@@ -99,9 +99,9 @@ TEST_F(WasmMacroGenTest, BrTable) {
} }
TEST_F(WasmMacroGenTest, Expressions) { TEST_F(WasmMacroGenTest, Expressions) {
EXPECT_SIZE(2, WASM_GET_LOCAL(0)); EXPECT_SIZE(2, WASM_LOCAL_GET(0));
EXPECT_SIZE(2, WASM_GET_LOCAL(1)); EXPECT_SIZE(2, WASM_LOCAL_GET(1));
EXPECT_SIZE(2, WASM_GET_LOCAL(12)); EXPECT_SIZE(2, WASM_LOCAL_GET(12));
EXPECT_SIZE(2, WASM_GET_GLOBAL(0)); EXPECT_SIZE(2, WASM_GET_GLOBAL(0));
EXPECT_SIZE(2, WASM_GET_GLOBAL(1)); EXPECT_SIZE(2, WASM_GET_GLOBAL(1));
EXPECT_SIZE(2, WASM_GET_GLOBAL(12)); EXPECT_SIZE(2, WASM_GET_GLOBAL(12));
...@@ -296,7 +296,7 @@ TEST_F(WasmMacroGenTest, LoadsAndStores) { ...@@ -296,7 +296,7 @@ TEST_F(WasmMacroGenTest, LoadsAndStores) {
EXPECT_SIZE(5, WASM_LOAD_MEM(kMemTypes[i], WASM_ZERO)); EXPECT_SIZE(5, WASM_LOAD_MEM(kMemTypes[i], WASM_ZERO));
} }
for (size_t i = 0; i < arraysize(kMemTypes); i++) { for (size_t i = 0; i < arraysize(kMemTypes); i++) {
EXPECT_SIZE(7, WASM_STORE_MEM(kMemTypes[i], WASM_ZERO, WASM_GET_LOCAL(0))); EXPECT_SIZE(7, WASM_STORE_MEM(kMemTypes[i], WASM_ZERO, WASM_LOCAL_GET(0)));
} }
} }
...@@ -306,7 +306,7 @@ TEST_F(WasmMacroGenTest, LoadsAndStoresWithOffset) { ...@@ -306,7 +306,7 @@ TEST_F(WasmMacroGenTest, LoadsAndStoresWithOffset) {
} }
for (size_t i = 0; i < arraysize(kMemTypes); i++) { for (size_t i = 0; i < arraysize(kMemTypes); i++) {
EXPECT_SIZE(7, WASM_STORE_MEM_OFFSET(kMemTypes[i], 13, WASM_ZERO, EXPECT_SIZE(7, WASM_STORE_MEM_OFFSET(kMemTypes[i], 13, WASM_ZERO,
WASM_GET_LOCAL(0))); WASM_LOCAL_GET(0)));
} }
} }
......
...@@ -44,7 +44,7 @@ class WasmCapiCallbacksTest : public WasmCapiTest { ...@@ -44,7 +44,7 @@ class WasmCapiCallbacksTest : public WasmCapiTest {
// int32 stage1(int32 arg0) { return stage2(arg0); } // int32 stage1(int32 arg0) { return stage2(arg0); }
uint32_t stage2_index = uint32_t stage2_index =
builder()->AddImport(CStrVector("stage2"), wasm_i_i_sig()); builder()->AddImport(CStrVector("stage2"), wasm_i_i_sig());
byte code[] = {WASM_CALL_FUNCTION(stage2_index, WASM_GET_LOCAL(0))}; byte code[] = {WASM_CALL_FUNCTION(stage2_index, WASM_LOCAL_GET(0))};
AddExportedFunction(CStrVector("stage1"), code, sizeof(code)); AddExportedFunction(CStrVector("stage1"), code, sizeof(code));
stage2_ = Func::make(store(), cpp_i_i_sig(), Stage2, this); stage2_ = Func::make(store(), cpp_i_i_sig(), Stage2, this);
...@@ -82,7 +82,7 @@ TEST_F(WasmCapiCallbacksTest, GC) { ...@@ -82,7 +82,7 @@ TEST_F(WasmCapiCallbacksTest, GC) {
// int32 stage3_to4(int32 arg0) { return stage4(arg0); } // int32 stage3_to4(int32 arg0) { return stage4(arg0); }
uint32_t stage4_index = uint32_t stage4_index =
builder()->AddImport(CStrVector("stage4"), wasm_i_i_sig()); builder()->AddImport(CStrVector("stage4"), wasm_i_i_sig());
byte code[] = {WASM_CALL_FUNCTION(stage4_index, WASM_GET_LOCAL(0))}; byte code[] = {WASM_CALL_FUNCTION(stage4_index, WASM_LOCAL_GET(0))};
AddExportedFunction(CStrVector("stage3_to4"), code, sizeof(code)); AddExportedFunction(CStrVector("stage3_to4"), code, sizeof(code));
i::Isolate* isolate = i::Isolate* isolate =
...@@ -136,15 +136,15 @@ TEST_F(WasmCapiTest, Recursion) { ...@@ -136,15 +136,15 @@ TEST_F(WasmCapiTest, Recursion) {
uint32_t fibo_c_index = uint32_t fibo_c_index =
builder()->AddImport(CStrVector("fibonacci_c"), wasm_i_i_sig()); builder()->AddImport(CStrVector("fibonacci_c"), wasm_i_i_sig());
byte code_fibo[] = { byte code_fibo[] = {
WASM_IF(WASM_I32_EQ(WASM_GET_LOCAL(0), WASM_ZERO), WASM_IF(WASM_I32_EQ(WASM_LOCAL_GET(0), WASM_ZERO),
WASM_RETURN1(WASM_ZERO)), WASM_RETURN1(WASM_ZERO)),
WASM_IF(WASM_I32_EQ(WASM_GET_LOCAL(0), WASM_ONE), WASM_RETURN1(WASM_ONE)), WASM_IF(WASM_I32_EQ(WASM_LOCAL_GET(0), WASM_ONE), WASM_RETURN1(WASM_ONE)),
// Muck with the parameter to ensure callers don't depend on its value. // Muck with the parameter to ensure callers don't depend on its value.
WASM_SET_LOCAL(0, WASM_I32_SUB(WASM_GET_LOCAL(0), WASM_ONE)), WASM_LOCAL_SET(0, WASM_I32_SUB(WASM_LOCAL_GET(0), WASM_ONE)),
WASM_RETURN1(WASM_I32_ADD( WASM_RETURN1(WASM_I32_ADD(
WASM_CALL_FUNCTION(fibo_c_index, WASM_GET_LOCAL(0)), WASM_CALL_FUNCTION(fibo_c_index, WASM_LOCAL_GET(0)),
WASM_CALL_FUNCTION(fibo_c_index, WASM_CALL_FUNCTION(fibo_c_index,
WASM_I32_SUB(WASM_GET_LOCAL(0), WASM_ONE))))}; WASM_I32_SUB(WASM_LOCAL_GET(0), WASM_ONE))))};
AddExportedFunction(CStrVector("fibonacci_wasm"), code_fibo, AddExportedFunction(CStrVector("fibonacci_wasm"), code_fibo,
sizeof(code_fibo), wasm_i_i_sig()); sizeof(code_fibo), wasm_i_i_sig());
......
...@@ -65,7 +65,7 @@ void RunInStore(Store* store, ZoneBuffer* wire_bytes, int iterations) { ...@@ -65,7 +65,7 @@ void RunInStore(Store* store, ZoneBuffer* wire_bytes, int iterations) {
TEST_F(WasmCapiTest, InstanceFinalization) { TEST_F(WasmCapiTest, InstanceFinalization) {
// Add a dummy function: f(x) { return x; } // Add a dummy function: f(x) { return x; }
byte code[] = {WASM_RETURN1(WASM_GET_LOCAL(0))}; byte code[] = {WASM_RETURN1(WASM_LOCAL_GET(0))};
AddExportedFunction(CStrVector("f"), code, sizeof(code), wasm_i_i_sig()); AddExportedFunction(CStrVector("f"), code, sizeof(code), wasm_i_i_sig());
Compile(); Compile();
g_instances_finalized = 0; g_instances_finalized = 0;
......
...@@ -76,16 +76,16 @@ TEST_F(WasmCapiTest, Globals) { ...@@ -76,16 +76,16 @@ TEST_F(WasmCapiTest, Globals) {
// Define functions for manipulating globals. // Define functions for manipulating globals.
FunctionSig param_f32(0, 1, f32_type); FunctionSig param_f32(0, 1, f32_type);
FunctionSig param_i64(0, 1, i64_type); FunctionSig param_i64(0, 1, i64_type);
byte svfi[] = {WASM_SET_GLOBAL(vfi_index, WASM_GET_LOCAL(0))}; byte svfi[] = {WASM_SET_GLOBAL(vfi_index, WASM_LOCAL_GET(0))};
AddExportedFunction(CStrVector("set var f32 import"), svfi, sizeof(svfi), AddExportedFunction(CStrVector("set var f32 import"), svfi, sizeof(svfi),
&param_f32); &param_f32);
byte svii[] = {WASM_SET_GLOBAL(vii_index, WASM_GET_LOCAL(0))}; byte svii[] = {WASM_SET_GLOBAL(vii_index, WASM_LOCAL_GET(0))};
AddExportedFunction(CStrVector("set var i64 import"), svii, sizeof(svii), AddExportedFunction(CStrVector("set var i64 import"), svii, sizeof(svii),
&param_i64); &param_i64);
byte svfe[] = {WASM_SET_GLOBAL(vfe_index, WASM_GET_LOCAL(0))}; byte svfe[] = {WASM_SET_GLOBAL(vfe_index, WASM_LOCAL_GET(0))};
AddExportedFunction(CStrVector("set var f32 export"), svfe, sizeof(svfe), AddExportedFunction(CStrVector("set var f32 export"), svfe, sizeof(svfe),
&param_f32); &param_f32);
byte svie[] = {WASM_SET_GLOBAL(vie_index, WASM_GET_LOCAL(0))}; byte svie[] = {WASM_SET_GLOBAL(vie_index, WASM_LOCAL_GET(0))};
AddExportedFunction(CStrVector("set var i64 export"), svie, sizeof(svie), AddExportedFunction(CStrVector("set var i64 export"), svie, sizeof(svie),
&param_i64); &param_i64);
......
...@@ -39,20 +39,20 @@ TEST_F(WasmCapiTest, HostRef) { ...@@ -39,20 +39,20 @@ TEST_F(WasmCapiTest, HostRef) {
CStrVector("global")); CStrVector("global"));
uint32_t table_index = builder()->AddTable(kWasmExternRef, 10); uint32_t table_index = builder()->AddTable(kWasmExternRef, 10);
builder()->AddExport(CStrVector("table"), kExternalTable, table_index); builder()->AddExport(CStrVector("table"), kExternalTable, table_index);
byte global_set_code[] = {WASM_SET_GLOBAL(global_index, WASM_GET_LOCAL(0))}; byte global_set_code[] = {WASM_SET_GLOBAL(global_index, WASM_LOCAL_GET(0))};
AddExportedFunction(CStrVector("global.set"), global_set_code, AddExportedFunction(CStrVector("global.set"), global_set_code,
sizeof(global_set_code), &v_r_sig); sizeof(global_set_code), &v_r_sig);
byte global_get_code[] = {WASM_GET_GLOBAL(global_index)}; byte global_get_code[] = {WASM_GET_GLOBAL(global_index)};
AddExportedFunction(CStrVector("global.get"), global_get_code, AddExportedFunction(CStrVector("global.get"), global_get_code,
sizeof(global_get_code), &r_v_sig); sizeof(global_get_code), &r_v_sig);
byte table_set_code[] = { byte table_set_code[] = {
WASM_TABLE_SET(table_index, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))}; WASM_TABLE_SET(table_index, WASM_LOCAL_GET(0), WASM_LOCAL_GET(1))};
AddExportedFunction(CStrVector("table.set"), table_set_code, AddExportedFunction(CStrVector("table.set"), table_set_code,
sizeof(table_set_code), &v_ir_sig); sizeof(table_set_code), &v_ir_sig);
byte table_get_code[] = {WASM_TABLE_GET(table_index, WASM_GET_LOCAL(0))}; byte table_get_code[] = {WASM_TABLE_GET(table_index, WASM_LOCAL_GET(0))};
AddExportedFunction(CStrVector("table.get"), table_get_code, AddExportedFunction(CStrVector("table.get"), table_get_code,
sizeof(table_get_code), &r_i_sig); sizeof(table_get_code), &r_i_sig);
byte func_call_code[] = {WASM_CALL_FUNCTION(func_index, WASM_GET_LOCAL(0))}; byte func_call_code[] = {WASM_CALL_FUNCTION(func_index, WASM_LOCAL_GET(0))};
AddExportedFunction(CStrVector("func.call"), func_call_code, AddExportedFunction(CStrVector("func.call"), func_call_code,
sizeof(func_call_code), &r_r_sig); sizeof(func_call_code), &r_r_sig);
......
...@@ -23,11 +23,11 @@ TEST_F(WasmCapiTest, Memory) { ...@@ -23,11 +23,11 @@ TEST_F(WasmCapiTest, Memory) {
byte size_code[] = {WASM_MEMORY_SIZE}; byte size_code[] = {WASM_MEMORY_SIZE};
AddExportedFunction(CStrVector("size"), size_code, sizeof(size_code), AddExportedFunction(CStrVector("size"), size_code, sizeof(size_code),
&return_i32); &return_i32);
byte load_code[] = {WASM_LOAD_MEM(MachineType::Int8(), WASM_GET_LOCAL(0))}; byte load_code[] = {WASM_LOAD_MEM(MachineType::Int8(), WASM_LOCAL_GET(0))};
AddExportedFunction(CStrVector("load"), load_code, sizeof(load_code), AddExportedFunction(CStrVector("load"), load_code, sizeof(load_code),
&param_i32_return_i32); &param_i32_return_i32);
byte store_code[] = {WASM_STORE_MEM(MachineType::Int8(), WASM_GET_LOCAL(0), byte store_code[] = {WASM_STORE_MEM(MachineType::Int8(), WASM_LOCAL_GET(0),
WASM_GET_LOCAL(1))}; WASM_LOCAL_GET(1))};
AddExportedFunction(CStrVector("store"), store_code, sizeof(store_code), AddExportedFunction(CStrVector("store"), store_code, sizeof(store_code),
&param_i32_i32); &param_i32_i32);
......
...@@ -28,9 +28,9 @@ TEST_F(WasmCapiTest, MultiReturn) { ...@@ -28,9 +28,9 @@ TEST_F(WasmCapiTest, MultiReturn) {
kWasmI32, kWasmI64, kWasmI64, kWasmI32}; kWasmI32, kWasmI64, kWasmI64, kWasmI32};
FunctionSig sig(4, 4, reps); FunctionSig sig(4, 4, reps);
uint32_t func_index = builder()->AddImport(CStrVector("f"), &sig); uint32_t func_index = builder()->AddImport(CStrVector("f"), &sig);
byte code[] = {WASM_CALL_FUNCTION(func_index, WASM_GET_LOCAL(0), byte code[] = {WASM_CALL_FUNCTION(func_index, WASM_LOCAL_GET(0),
WASM_GET_LOCAL(2), WASM_GET_LOCAL(1), WASM_LOCAL_GET(2), WASM_LOCAL_GET(1),
WASM_GET_LOCAL(3))}; WASM_LOCAL_GET(3))};
AddExportedFunction(CStrVector("g"), code, sizeof(code), &sig); AddExportedFunction(CStrVector("g"), code, sizeof(code), &sig);
ownvec<ValType> types = ownvec<ValType> types =
......
...@@ -44,10 +44,10 @@ TEST_F(WasmCapiTest, Table) { ...@@ -44,10 +44,10 @@ TEST_F(WasmCapiTest, Table) {
ValueType reps[] = {kWasmI32, kWasmI32, kWasmI32}; ValueType reps[] = {kWasmI32, kWasmI32, kWasmI32};
FunctionSig call_sig(1, 2, reps); FunctionSig call_sig(1, 2, reps);
byte call_code[] = { byte call_code[] = {
WASM_CALL_INDIRECT(sig_i_i_index, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))}; WASM_CALL_INDIRECT(sig_i_i_index, WASM_LOCAL_GET(0), WASM_LOCAL_GET(1))};
AddExportedFunction(CStrVector("call_indirect"), call_code, sizeof(call_code), AddExportedFunction(CStrVector("call_indirect"), call_code, sizeof(call_code),
&call_sig); &call_sig);
byte f_code[] = {WASM_GET_LOCAL(0)}; byte f_code[] = {WASM_LOCAL_GET(0)};
AddExportedFunction(CStrVector("f"), f_code, sizeof(f_code), wasm_i_i_sig()); AddExportedFunction(CStrVector("f"), f_code, sizeof(f_code), wasm_i_i_sig());
byte g_code[] = {WASM_I32V_1(42)}; byte g_code[] = {WASM_I32V_1(42)};
AddExportedFunction(CStrVector("g"), g_code, sizeof(g_code), wasm_i_i_sig()); AddExportedFunction(CStrVector("g"), g_code, sizeof(g_code), wasm_i_i_sig());
......
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