summaryrefslogtreecommitdiff
path: root/src/wasm-s-parser.h
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2016-04-27 10:43:21 -0700
committerAlon Zakai <alonzakai@gmail.com>2016-04-27 16:59:17 -0700
commit127f9688cc26ab362dabadac5494af23cd78ac8b (patch)
tree14d88e021164cb784a7bb9d66bf9d0974c94c2cd /src/wasm-s-parser.h
parent46f99e692014e714ffeed7f3db870ffd12bf077c (diff)
downloadbinaryen-127f9688cc26ab362dabadac5494af23cd78ac8b.tar.gz
binaryen-127f9688cc26ab362dabadac5494af23cd78ac8b.tar.bz2
binaryen-127f9688cc26ab362dabadac5494af23cd78ac8b.zip
allocate only expressions in arenas - functions, imports, exports, function types, can more simply be held by unique_ptrs on the owning module. this avoids need to coordinate arena allocation for their elements, and only the far more plentiful expression nodes are a perf factor anyhow
Diffstat (limited to 'src/wasm-s-parser.h')
-rw-r--r--src/wasm-s-parser.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/wasm-s-parser.h b/src/wasm-s-parser.h
index 36dacc627..ccaec82d0 100644
--- a/src/wasm-s-parser.h
+++ b/src/wasm-s-parser.h
@@ -1113,14 +1113,14 @@ private:
wasm.memory.exportName = s[1]->str();
return;
}
- auto ex = allocator.alloc<Export>();
+ auto ex = new Export;
ex->name = s[1]->str();
ex->value = s[2]->str();
wasm.addExport(ex);
}
void parseImport(Element& s) {
- auto im = allocator.alloc<Import>();
+ auto im = new Import;
size_t i = 1;
if (s.size() > 3 && s[3]->isStr()) {
im->name = s[i++]->str();
@@ -1131,7 +1131,7 @@ private:
im->module = s[i++]->str();
if (!s[i]->isStr()) onError();
im->base = s[i++]->str();
- FunctionType* type = allocator.alloc<FunctionType>();
+ std::unique_ptr<FunctionType> type = make_unique<FunctionType>();
if (s.size() > i) {
Element& params = *s[i];
IString id = params[0]->str();
@@ -1154,7 +1154,7 @@ private:
type->result = stringToWasmType(result[1]->str());
}
}
- im->type = ensureFunctionType(getSig(type), &wasm);
+ im->type = ensureFunctionType(getSig(type.get()), &wasm);
wasm.addImport(im);
}
@@ -1165,7 +1165,7 @@ private:
}
void parseType(Element& s) {
- auto type = allocator.alloc<FunctionType>();
+ auto type = new FunctionType;
size_t i = 1;
if (s[i]->isStr()) {
type->name = s[i]->str();