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

Unified Diff: test/unittests/wasm/ast-decoder-unittest.cc

Issue 2540133002: [wasm] Remove raw byte pointers from WasmModule (Closed)
Patch Set: Address comments Created 4 years 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
« no previous file with comments | « test/fuzzer/wasm-code.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/unittests/wasm/ast-decoder-unittest.cc
diff --git a/test/unittests/wasm/ast-decoder-unittest.cc b/test/unittests/wasm/ast-decoder-unittest.cc
index d5b005dcfc2641e7037feeb31be782e70cf0f7ee..403c7bc9e8aba3155a8be911b43f0653f755c117 100644
--- a/test/unittests/wasm/ast-decoder-unittest.cc
+++ b/test/unittests/wasm/ast-decoder-unittest.cc
@@ -1279,9 +1279,9 @@ namespace {
// globals.
class TestModuleEnv : public ModuleEnv {
public:
- TestModuleEnv() {
- instance = nullptr;
- module = &mod;
+ explicit TestModuleEnv(ModuleOrigin origin = kWasmOrigin)
+ : ModuleEnv(&mod, nullptr) {
+ mod.origin = origin;
}
byte AddGlobal(LocalType type, bool mutability = true) {
mod.globals.push_back({type, mutability, WasmInitExpr(), 0, false, false});
@@ -1654,7 +1654,6 @@ TEST_F(AstDecoderTest, AllSetGlobalCombinations) {
TEST_F(AstDecoderTest, WasmGrowMemory) {
TestModuleEnv module_env;
module = &module_env;
- module->origin = kWasmOrigin;
byte code[] = {WASM_GET_LOCAL(0), kExprGrowMemory, 0};
EXPECT_VERIFIES_C(i_i, code);
@@ -1662,9 +1661,8 @@ TEST_F(AstDecoderTest, WasmGrowMemory) {
}
TEST_F(AstDecoderTest, AsmJsGrowMemory) {
- TestModuleEnv module_env;
+ TestModuleEnv module_env(kAsmJsOrigin);
module = &module_env;
- module->origin = kAsmJsOrigin;
byte code[] = {WASM_GET_LOCAL(0), kExprGrowMemory, 0};
EXPECT_FAILURE_C(i_i, code);
@@ -1694,9 +1692,8 @@ TEST_F(AstDecoderTest, AsmJsBinOpsCheckOrigin) {
};
{
- TestModuleEnv module_env;
+ TestModuleEnv module_env(kAsmJsOrigin);
module = &module_env;
- module->origin = kAsmJsOrigin;
for (size_t i = 0; i < arraysize(AsmJsBinOps); i++) {
TestBinop(AsmJsBinOps[i].op, AsmJsBinOps[i].sig);
}
@@ -1705,7 +1702,6 @@ TEST_F(AstDecoderTest, AsmJsBinOpsCheckOrigin) {
{
TestModuleEnv module_env;
module = &module_env;
- module->origin = kWasmOrigin;
for (size_t i = 0; i < arraysize(AsmJsBinOps); i++) {
byte code[] = {
WASM_BINOP(AsmJsBinOps[i].op, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))};
@@ -1742,9 +1738,8 @@ TEST_F(AstDecoderTest, AsmJsUnOpsCheckOrigin) {
{kExprI32AsmjsSConvertF64, sigs.i_d()},
{kExprI32AsmjsUConvertF64, sigs.i_d()}};
{
- TestModuleEnv module_env;
+ TestModuleEnv module_env(kAsmJsOrigin);
module = &module_env;
- module->origin = kAsmJsOrigin;
for (size_t i = 0; i < arraysize(AsmJsUnOps); i++) {
TestUnop(AsmJsUnOps[i].op, AsmJsUnOps[i].sig);
}
@@ -1753,7 +1748,6 @@ TEST_F(AstDecoderTest, AsmJsUnOpsCheckOrigin) {
{
TestModuleEnv module_env;
module = &module_env;
- module->origin = kWasmOrigin;
for (size_t i = 0; i < arraysize(AsmJsUnOps); i++) {
byte code[] = {WASM_UNOP(AsmJsUnOps[i].op, WASM_GET_LOCAL(0))};
EXPECT_FAILURE_SC(AsmJsUnOps[i].sig, code);
« no previous file with comments | « test/fuzzer/wasm-code.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698