summaryrefslogtreecommitdiff
path: root/src/asmjs
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2016-04-26 20:06:40 -0700
committerAlon Zakai <alonzakai@gmail.com>2016-04-26 20:06:40 -0700
commit206338a6c4e3f9739abd7a2ad082d1770b3a628f (patch)
tree817992a1e811af71087a228b20f3c35df9485b96 /src/asmjs
parentdd778824cfc60c4478bbe7690769f444dad92803 (diff)
parentd9096704dfa84aea94bb6ac2ffa02d88fa546bfa (diff)
downloadbinaryen-206338a6c4e3f9739abd7a2ad082d1770b3a628f.tar.gz
binaryen-206338a6c4e3f9739abd7a2ad082d1770b3a628f.tar.bz2
binaryen-206338a6c4e3f9739abd7a2ad082d1770b3a628f.zip
Prep for arena vectors
Arena vectors
Diffstat (limited to 'src/asmjs')
-rw-r--r--src/asmjs/asm_v_wasm.cpp30
1 files changed, 6 insertions, 24 deletions
diff --git a/src/asmjs/asm_v_wasm.cpp b/src/asmjs/asm_v_wasm.cpp
index 317a8b625..3e7e0241e 100644
--- a/src/asmjs/asm_v_wasm.cpp
+++ b/src/asmjs/asm_v_wasm.cpp
@@ -71,24 +71,6 @@ std::string getSig(Function *func) {
return ret;
}
-std::string getSig(CallBase *call) {
- std::string ret;
- ret += getSig(call->type);
- for (auto operand : call->operands) {
- ret += getSig(operand->type);
- }
- return ret;
-}
-
-std::string getSig(WasmType result, const ExpressionList& operands) {
- std::string ret;
- ret += getSig(result);
- for (auto operand : operands) {
- ret += getSig(operand->type);
- }
- return ret;
-}
-
WasmType sigToWasmType(char sig) {
switch (sig) {
case 'i': return i32;
@@ -100,22 +82,22 @@ WasmType sigToWasmType(char sig) {
}
}
-FunctionType sigToFunctionType(std::string sig) {
- FunctionType ret;
- ret.result = sigToWasmType(sig[0]);
+FunctionType* sigToFunctionType(std::string sig, MixedArena& allocator) {
+ auto ret = allocator.alloc<FunctionType>();
+ ret->result = sigToWasmType(sig[0]);
for (size_t i = 1; i < sig.size(); i++) {
- ret.params.push_back(sigToWasmType(sig[i]));
+ ret->params.push_back(sigToWasmType(sig[i]));
}
return ret;
}
-FunctionType* ensureFunctionType(std::string sig, Module* wasm, MixedArena& allocator) {
+FunctionType* ensureFunctionType(std::string sig, Module* wasm) {
cashew::IString name(("FUNCSIG$" + sig).c_str(), false);
if (wasm->checkFunctionType(name)) {
return wasm->getFunctionType(name);
}
// add new type
- auto type = allocator.alloc<FunctionType>();
+ auto type = wasm->allocator.alloc<FunctionType>();
type->name = name;
type->result = sigToWasmType(sig[0]);
for (size_t i = 1; i < sig.size(); i++) {