[wasm] Use static_assert instead of assert

Fixes nits found by @clemensh after
CL https://chromium-review.googlesource.com/c/v8/v8/+/834670
was committed. That is, the code uses static asserts instead of
assert.

Bug: v8:7226
Change-Id: I5488ec4609d1bee3aafa61a3ff2505f71b06d80d
Reviewed-on: https://chromium-review.googlesource.com/847687
Reviewed-by: Clemens Hammacher <clemensh@chromium.org>
Commit-Queue: Karl Schimpf <kschimpf@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50388}
This commit is contained in:
Karl Schimpf 2018-01-05 07:35:21 -08:00 committed by Commit Bot
parent da72b856e3
commit 716e539c2e

View File

@ -2876,16 +2876,16 @@ WASM_EXEC_TEST(I32SConvertSatF32) {
WasmRunner<int32_t, float> r(execution_mode); WasmRunner<int32_t, float> r(execution_mode);
BUILD(r, WASM_I32_SCONVERT_SAT_F32(WASM_GET_LOCAL(0))); BUILD(r, WASM_I32_SCONVERT_SAT_F32(WASM_GET_LOCAL(0)));
constexpr float kLowerBound = constexpr float kLowerBound = std::numeric_limits<int32_t>::min();
static_cast<float>(std::numeric_limits<int32_t>::min()); constexpr float kUpperBound = std::numeric_limits<int32_t>::max();
constexpr float kUpperBound =
static_cast<float>(std::numeric_limits<int32_t>::max());
assert(static_cast<int64_t>(kUpperBound) >
static_cast<int64_t>(std::numeric_limits<int32_t>::max()));
assert(static_cast<int32_t>(kLowerBound) ==
std::numeric_limits<int32_t>::min());
FOR_FLOAT32_INPUTS(i) { FOR_FLOAT32_INPUTS(i) {
static_assert(static_cast<int64_t>(kUpperBound) >
static_cast<int64_t>(std::numeric_limits<int32_t>::max()),
"kUpperBound invalidates the following bounds check.");
static_assert(static_cast<int32_t>(kLowerBound) ==
std::numeric_limits<int32_t>::min(),
"kLowerBounds invalidates the following bounds check.");
if (*i < kUpperBound && *i >= kLowerBound) { if (*i < kUpperBound && *i >= kLowerBound) {
CHECK_EQ(static_cast<int32_t>(*i), r.Call(*i)); CHECK_EQ(static_cast<int32_t>(*i), r.Call(*i));
} else if (std::isnan(*i)) { } else if (std::isnan(*i)) {