diff options
author | Alon Zakai <alonzakai@gmail.com> | 2016-05-22 15:05:02 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2016-05-22 15:05:02 -0700 |
commit | 5d16d4b3b344aa1dbe07deff0d282adea6f8c369 (patch) | |
tree | 22f802104112bd276dfa8a0990412f289e6f0770 /src | |
parent | 89a3fcbc78903d1a904354dd6eb2c4bd1ac44e8e (diff) | |
download | binaryen-5d16d4b3b344aa1dbe07deff0d282adea6f8c369.tar.gz binaryen-5d16d4b3b344aa1dbe07deff0d282adea6f8c369.tar.bz2 binaryen-5d16d4b3b344aa1dbe07deff0d282adea6f8c369.zip |
don't depend on asm.js type detection in binary formation in asm2wasm, use the full asm global info we have (#535)
Diffstat (limited to 'src')
-rw-r--r-- | src/asm2wasm.h | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/asm2wasm.h b/src/asm2wasm.h index d1959b918..0aa3f91ac 100644 --- a/src/asm2wasm.h +++ b/src/asm2wasm.h @@ -306,8 +306,8 @@ private: return detectSign(ast, Math_fround) == ASM_UNSIGNED; } - BinaryOp parseAsmBinaryOp(IString op, Ref left, Ref right, AsmData *asmData) { - WasmType leftType = detectWasmType(left, asmData); + BinaryOp parseAsmBinaryOp(IString op, Ref left, Ref right, Expression* leftWasm, Expression* rightWasm) { + WasmType leftType = leftWasm->type; bool isInteger = leftType == WasmType::i32; if (op == PLUS) return isInteger ? BinaryOp::AddInt32 : (leftType == f32 ? BinaryOp::AddFloat32 : BinaryOp::AddFloat64); @@ -997,13 +997,12 @@ Function* Asm2WasmBuilder::processFunction(Ref ast) { fixCallType(ret, i32); return ret; } - BinaryOp binary = parseAsmBinaryOp(ast[1]->getIString(), ast[2], ast[3], &asmData); auto ret = allocator.alloc<Binary>(); - ret->op = binary; ret->left = process(ast[2]); ret->right = process(ast[3]); + ret->op = parseAsmBinaryOp(ast[1]->getIString(), ast[2], ast[3], ret->left, ret->right); ret->finalize(); - if (binary == BinaryOp::RemSInt32 && isWasmTypeFloat(ret->type)) { + if (ret->op == BinaryOp::RemSInt32 && isWasmTypeFloat(ret->type)) { // WebAssembly does not have floating-point remainder, we have to emit a call to a special import of ours CallImport *call = allocator.alloc<CallImport>(); call->target = F64_REM; |