Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(492)

Unified Diff: test/cctest/wasm/test-run-wasm.cc

Issue 2165633006: [wasm] Remove special memory type for (internal) globals and use local type instead. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: test/cctest/wasm/test-run-wasm.cc
diff --git a/test/cctest/wasm/test-run-wasm.cc b/test/cctest/wasm/test-run-wasm.cc
index 9891cb631f8f8e2406acf0c0412dd14c90a23f32..559c1317d7f2c92d9d4ac9744dc09c48b39ddb4a 100644
--- a/test/cctest/wasm/test-run-wasm.cc
+++ b/test/cctest/wasm/test-run-wasm.cc
@@ -1864,7 +1864,7 @@ WASM_EXEC_TEST(Int32LoadInt16_zeroext) {
WASM_EXEC_TEST(Int32Global) {
TestingModule module(execution_mode);
- int32_t* global = module.AddGlobal<int32_t>(MachineType::Int32());
+ int32_t* global = module.AddGlobal<int32_t>(kAstI32);
WasmRunner<int32_t> r(&module, MachineType::Int32());
// global = global + p0
BUILD(r, WASM_STORE_GLOBAL(
@@ -1881,9 +1881,9 @@ WASM_EXEC_TEST(Int32Global) {
WASM_EXEC_TEST(Int32Globals_DontAlias) {
const int kNumGlobals = 3;
TestingModule module(execution_mode);
- int32_t* globals[] = {module.AddGlobal<int32_t>(MachineType::Int32()),
- module.AddGlobal<int32_t>(MachineType::Int32()),
- module.AddGlobal<int32_t>(MachineType::Int32())};
+ int32_t* globals[] = {module.AddGlobal<int32_t>(kAstI32),
+ module.AddGlobal<int32_t>(kAstI32),
+ module.AddGlobal<int32_t>(kAstI32)};
for (int g = 0; g < kNumGlobals; ++g) {
// global = global + p0
@@ -1908,7 +1908,7 @@ WASM_EXEC_TEST(Int32Globals_DontAlias) {
WASM_EXEC_TEST(Float32Global) {
TestingModule module(execution_mode);
- float* global = module.AddGlobal<float>(MachineType::Float32());
+ float* global = module.AddGlobal<float>(kAstF32);
WasmRunner<int32_t> r(&module, MachineType::Int32());
// global = global + p0
BUILD(r, B2(WASM_STORE_GLOBAL(
@@ -1926,7 +1926,7 @@ WASM_EXEC_TEST(Float32Global) {
WASM_EXEC_TEST(Float64Global) {
TestingModule module(execution_mode);
- double* global = module.AddGlobal<double>(MachineType::Float64());
+ double* global = module.AddGlobal<double>(kAstF64);
WasmRunner<int32_t> r(&module, MachineType::Int32());
// global = global + p0
BUILD(r, B2(WASM_STORE_GLOBAL(
@@ -1944,35 +1944,25 @@ WASM_EXEC_TEST(Float64Global) {
WASM_EXEC_TEST(MixedGlobals) {
TestingModule module(execution_mode);
- int32_t* unused = module.AddGlobal<int32_t>(MachineType::Int32());
+ int32_t* unused = module.AddGlobal<int32_t>(kAstI32);
byte* memory = module.AddMemory(32);
- int8_t* var_int8 = module.AddGlobal<int8_t>(MachineType::Int8());
- uint8_t* var_uint8 = module.AddGlobal<uint8_t>(MachineType::Uint8());
- int16_t* var_int16 = module.AddGlobal<int16_t>(MachineType::Int16());
- uint16_t* var_uint16 = module.AddGlobal<uint16_t>(MachineType::Uint16());
- int32_t* var_int32 = module.AddGlobal<int32_t>(MachineType::Int32());
- uint32_t* var_uint32 = module.AddGlobal<uint32_t>(MachineType::Uint32());
- float* var_float = module.AddGlobal<float>(MachineType::Float32());
- double* var_double = module.AddGlobal<double>(MachineType::Float64());
+ int32_t* var_int32 = module.AddGlobal<int32_t>(kAstI32);
+ uint32_t* var_uint32 = module.AddGlobal<uint32_t>(kAstI32);
+ float* var_float = module.AddGlobal<float>(kAstF32);
+ double* var_double = module.AddGlobal<double>(kAstF64);
WasmRunner<int32_t> r(&module, MachineType::Int32());
- BUILD(
- r,
- WASM_BLOCK(
- 9,
- WASM_STORE_GLOBAL(1, WASM_LOAD_MEM(MachineType::Int8(), WASM_ZERO)),
- WASM_STORE_GLOBAL(2, WASM_LOAD_MEM(MachineType::Uint8(), WASM_ZERO)),
- WASM_STORE_GLOBAL(3, WASM_LOAD_MEM(MachineType::Int16(), WASM_ZERO)),
- WASM_STORE_GLOBAL(4, WASM_LOAD_MEM(MachineType::Uint16(), WASM_ZERO)),
- WASM_STORE_GLOBAL(5, WASM_LOAD_MEM(MachineType::Int32(), WASM_ZERO)),
- WASM_STORE_GLOBAL(6, WASM_LOAD_MEM(MachineType::Uint32(), WASM_ZERO)),
- WASM_STORE_GLOBAL(7,
- WASM_LOAD_MEM(MachineType::Float32(), WASM_ZERO)),
- WASM_STORE_GLOBAL(8,
- WASM_LOAD_MEM(MachineType::Float64(), WASM_ZERO)),
- WASM_ZERO));
+ BUILD(r, WASM_BLOCK(9, WASM_STORE_GLOBAL(
+ 1, WASM_LOAD_MEM(MachineType::Int32(), WASM_ZERO)),
+ WASM_STORE_GLOBAL(
+ 2, WASM_LOAD_MEM(MachineType::Uint32(), WASM_ZERO)),
+ WASM_STORE_GLOBAL(
+ 3, WASM_LOAD_MEM(MachineType::Float32(), WASM_ZERO)),
+ WASM_STORE_GLOBAL(
+ 4, WASM_LOAD_MEM(MachineType::Float64(), WASM_ZERO)),
+ WASM_ZERO));
memory[0] = 0xaa;
memory[1] = 0xcc;
@@ -1984,10 +1974,6 @@ WASM_EXEC_TEST(MixedGlobals) {
memory[7] = 0x99;
r.Call(1);
- CHECK(static_cast<int8_t>(0xaa) == *var_int8);
- CHECK(static_cast<uint8_t>(0xaa) == *var_uint8);
- CHECK(static_cast<int16_t>(0xccaa) == *var_int16);
- CHECK(static_cast<uint16_t>(0xccaa) == *var_uint16);
CHECK(static_cast<int32_t>(0xee55ccaa) == *var_int32);
CHECK(static_cast<uint32_t>(0xee55ccaa) == *var_uint32);
CHECK(bit_cast<float>(0xee55ccaa) == *var_float);

Powered by Google App Engine
This is Rietveld 408576698