summaryrefslogtreecommitdiff
path: root/src/asm2wasm.h
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2016-03-21 11:57:06 -0700
committerAlon Zakai <alonzakai@gmail.com>2016-03-21 11:57:06 -0700
commit3437e886f32275ba385dfc7ae2c2473ed672c01d (patch)
treef2e3d16977f51f4ce802b39d439ef947132976f0 /src/asm2wasm.h
parentc733dd24ba5df55272feb4880fe302bed42d5568 (diff)
downloadbinaryen-3437e886f32275ba385dfc7ae2c2473ed672c01d.tar.gz
binaryen-3437e886f32275ba385dfc7ae2c2473ed672c01d.tar.bz2
binaryen-3437e886f32275ba385dfc7ae2c2473ed672c01d.zip
special case the asm.js memory growth function
Diffstat (limited to 'src/asm2wasm.h')
-rw-r--r--src/asm2wasm.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/asm2wasm.h b/src/asm2wasm.h
index bf59d08ad..d6856c7f2 100644
--- a/src/asm2wasm.h
+++ b/src/asm2wasm.h
@@ -641,11 +641,17 @@ void Asm2WasmBuilder::processAsm(Ref ast) {
for (unsigned k = 0; k < contents->size(); k++) {
Ref pair = contents[k];
IString key = pair[0]->getIString();
- Ref value = pair[1];
- assert(value[0] == NAME);
+ assert(pair[1][0] == NAME);
+ IString value = pair[1][1]->getIString();
+ if (key == Name("_emscripten_replace_memory")) {
+ // asm.js memory growth provides this special non-asm function, which we don't need (we use grow_memory)
+ assert(wasm.functionsMap.find(value) == wasm.functionsMap.end());
+ continue;
+ }
+ assert(wasm.functionsMap.find(value) != wasm.functionsMap.end());
auto export_ = allocator.alloc<Export>();
export_->name = key;
- export_->value = value[1]->getIString();
+ export_->value = value;
wasm.addExport(export_);
}
}