summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2018-03-05 13:04:11 -0800
committerGitHub <noreply@github.com>2018-03-05 13:04:11 -0800
commitac93e8bebf97aec9407e094f56c3fd523399f59e (patch)
tree79c39a5110af0bfb1a4cfc6738fb954a404f1af8 /src
parent363c2c7abd68847b4b226764160e2d3431dc3b54 (diff)
downloadbinaryen-ac93e8bebf97aec9407e094f56c3fd523399f59e.tar.gz
binaryen-ac93e8bebf97aec9407e094f56c3fd523399f59e.tar.bz2
binaryen-ac93e8bebf97aec9407e094f56c3fd523399f59e.zip
better asm2wasm error handling and reporting (#1456)
Diffstat (limited to 'src')
-rw-r--r--src/asm2wasm.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/asm2wasm.h b/src/asm2wasm.h
index 8ce094a6f..92d85b50a 100644
--- a/src/asm2wasm.h
+++ b/src/asm2wasm.h
@@ -690,7 +690,7 @@ private:
Literal getLiteral(Ref ast) {
Literal ret = checkLiteral(ast);
- if (ret.type == none) abort();
+ assert(ret.type != none);
return ret;
}
@@ -1786,7 +1786,7 @@ Function* Asm2WasmBuilder::processFunction(Ref ast) {
ret->op = NegFloat32;
ret->type = Type::f32;
} else {
- abort();
+ WASM_UNREACHABLE();
}
return ret;
} else if (ast[1] == B_NOT) {
@@ -1918,7 +1918,7 @@ Function* Asm2WasmBuilder::processFunction(Ref ast) {
ret->type = value->type;
return ret;
} else {
- abort();
+ WASM_UNREACHABLE();
}
}
if (name == Math_floor || name == Math_sqrt || name == Math_ceil) {
@@ -1933,7 +1933,7 @@ Function* Asm2WasmBuilder::processFunction(Ref ast) {
ret->op = name == Math_floor ? FloorFloat64 : name == Math_ceil ? CeilFloat64 : SqrtFloat64;
ret->type = value->type;
} else {
- abort();
+ Fatal() << "floor/sqrt/ceil only work on float/double in asm.js and wasm";
}
return ret;
}
@@ -1948,7 +1948,7 @@ Function* Asm2WasmBuilder::processFunction(Ref ast) {
} else if (ret->left->type == f64) {
ret->op = name == Math_max ? MaxFloat64 : MinFloat64;
} else {
- abort();
+ Fatal() << "min/max only work on float/double in asm.js and wasm";
}
ret->type = ret->left->type;
return ret;