From 3437e886f32275ba385dfc7ae2c2473ed672c01d Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Mon, 21 Mar 2016 11:57:06 -0700 Subject: special case the asm.js memory growth function --- src/asm2wasm.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src') 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_->name = key; - export_->value = value[1]->getIString(); + export_->value = value; wasm.addExport(export_); } } -- cgit v1.2.3