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

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

Issue 1538543002: Have WasmModule free it's own memory. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix Created 5 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/cctest/wasm/test-run-wasm-module.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 57138865a005b80841201b8b85b6a613f34cbac7..22326545aaf513a401df282e82e6688215a0bbc3 100644
--- a/test/unittests/wasm/ast-decoder-unittest.cc
+++ b/test/unittests/wasm/ast-decoder-unittest.cc
@@ -1189,31 +1189,28 @@ class TestModuleEnv : public ModuleEnv {
module = &mod;
linker = nullptr;
function_code = nullptr;
- mod.globals = &globals;
- mod.signatures = &signatures;
- mod.functions = &functions;
+ mod.globals = new std::vector<WasmGlobal>;
+ mod.signatures = new std::vector<FunctionSig*>;
+ mod.functions = new std::vector<WasmFunction>;
}
byte AddGlobal(MachineType mem_type) {
- globals.push_back({0, mem_type, 0, false});
- CHECK(globals.size() <= 127);
- return static_cast<byte>(globals.size() - 1);
+ mod.globals->push_back({0, mem_type, 0, false});
+ CHECK(mod.globals->size() <= 127);
+ return static_cast<byte>(mod.globals->size() - 1);
}
byte AddSignature(FunctionSig* sig) {
- signatures.push_back(sig);
- CHECK(signatures.size() <= 127);
- return static_cast<byte>(signatures.size() - 1);
+ mod.signatures->push_back(sig);
+ CHECK(mod.signatures->size() <= 127);
+ return static_cast<byte>(mod.signatures->size() - 1);
}
byte AddFunction(FunctionSig* sig) {
- functions.push_back({sig, 0, 0, 0, 0, 0, 0, 0, false, false});
- CHECK(functions.size() <= 127);
- return static_cast<byte>(functions.size() - 1);
+ mod.functions->push_back({sig, 0, 0, 0, 0, 0, 0, 0, false, false});
+ CHECK(mod.functions->size() <= 127);
+ return static_cast<byte>(mod.functions->size() - 1);
}
private:
WasmModule mod;
- std::vector<WasmGlobal> globals;
- std::vector<FunctionSig*> signatures;
- std::vector<WasmFunction> functions;
};
} // namespace
« no previous file with comments | « test/cctest/wasm/test-run-wasm-module.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698