diff options
author | Alon Zakai <azakai@google.com> | 2024-06-12 14:25:50 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-12 21:25:50 +0000 |
commit | 34686197f5a05854c0723214f3fdffbc9b19a7d5 (patch) | |
tree | 65b0750b174e29bba39b92289135b6887ba5b425 /src/emscripten-optimizer | |
parent | 0e1187664ebf93bd268ba7d77813441a4874d998 (diff) | |
download | binaryen-34686197f5a05854c0723214f3fdffbc9b19a7d5.tar.gz binaryen-34686197f5a05854c0723214f3fdffbc9b19a7d5.tar.bz2 binaryen-34686197f5a05854c0723214f3fdffbc9b19a7d5.zip |
wasm2js: Fix null handling and RefAsNonNull (#6656)
Diffstat (limited to 'src/emscripten-optimizer')
-rw-r--r-- | src/emscripten-optimizer/optimizer-shared.cpp | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/emscripten-optimizer/optimizer-shared.cpp b/src/emscripten-optimizer/optimizer-shared.cpp index 773c5d9fc..f4482aa09 100644 --- a/src/emscripten-optimizer/optimizer-shared.cpp +++ b/src/emscripten-optimizer/optimizer-shared.cpp @@ -17,6 +17,7 @@ #include <limits> #include "optimizer.h" +#include "shared-constants.h" #include "support/safe_integer.h" using namespace cashew; @@ -33,17 +34,14 @@ Ref makeJsCoercedZero(JsType type) { switch (type) { case JS_INT: return ValueBuilder::makeNum(0); - break; case JS_DOUBLE: return ValueBuilder::makeUnary(PLUS, ValueBuilder::makeNum(0)); - break; case JS_FLOAT: { if (!JS_FLOAT_ZERO.isNull()) { return ValueBuilder::makeName(JS_FLOAT_ZERO); } else { return ValueBuilder::makeCall(MATH_FROUND, ValueBuilder::makeNum(0)); } - break; } case JS_FLOAT32X4: { return ValueBuilder::makeCall(SIMD_FLOAT32X4, @@ -51,12 +49,10 @@ Ref makeJsCoercedZero(JsType type) { ValueBuilder::makeNum(0), ValueBuilder::makeNum(0), ValueBuilder::makeNum(0)); - break; } case JS_FLOAT64X2: { return ValueBuilder::makeCall( SIMD_FLOAT64X2, ValueBuilder::makeNum(0), ValueBuilder::makeNum(0)); - break; } case JS_INT8X16: { return ValueBuilder::makeCall(SIMD_INT8X16, @@ -76,7 +72,6 @@ Ref makeJsCoercedZero(JsType type) { ValueBuilder::makeNum(0), ValueBuilder::makeNum(0), ValueBuilder::makeNum(0)); - break; } case JS_INT16X8: { return ValueBuilder::makeCall(SIMD_INT16X8, @@ -88,7 +83,6 @@ Ref makeJsCoercedZero(JsType type) { ValueBuilder::makeNum(0), ValueBuilder::makeNum(0), ValueBuilder::makeNum(0)); - break; } case JS_INT32X4: { return ValueBuilder::makeCall(SIMD_INT32X4, @@ -96,7 +90,9 @@ Ref makeJsCoercedZero(JsType type) { ValueBuilder::makeNum(0), ValueBuilder::makeNum(0), ValueBuilder::makeNum(0)); - break; + } + case JS_REF: { + return ValueBuilder::makeName(wasm::NULL_); } default: assert(0); |