v8/test/mjsunit/regress/wasm
Eric Holk ec772a4fd8 Restrict range for int64_t to immediate conversions
The included test case illustrates the problem. It subtracts (16 << 27)
from another number. The Machine Operator Reducer would replace the
shift computation with 0x0000000080000000, and then change the subtract
to an add of -(0x0000000080000000), which is 0xffffffff80000000.
The instruction selector would determine that this value could be an
immediate, because it fits in 32 bits, so it would select the lea
instruction. Finally, the code generator would detect that the
immediate was less than 0, flip the sign and replace the add with a
subtract of 0x80000000. Because the x64 subtract instruction's
immediate field is 32 bits, the processor would interpret this as
0xffffffff80000000 instead of an unsigned value.

This change fixes the issue by making the CanBeImmediate check
explicitly compare against INT_MIN and INT_MAX. We disallow INT_MIN
as an immediate precisely because we cannot tell 0x0000000080000000
from 0xffffffff80000000 when truncated to 32 bits.

Bug: chromium:711203
Change-Id: Ie371b8ea290684a6bb723bae9c693a866f961850
Reviewed-on: https://chromium-review.googlesource.com/482448
Commit-Queue: Eric Holk <eholk@chromium.org>
Reviewed-by: Mircea Trofin <mtrofin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#44758}
2017-04-20 21:03:31 +00:00
..
loop-stack-check.js
regress-5860.js
regress-709684.js Fixed accounting issues due to code table containing imports as well as wasm funcs. 2017-04-10 14:03:59 +00:00
regress-712569.js [wasm] Fix DCHECK handiling pending exceptions. 2017-04-18 19:15:12 +00:00
regression-5531.js
regression-5800.js
regression-5884.js
regression-6054.js
regression-6164.js
regression-02256.js
regression-02256b.js
regression-02862.js
regression-643595.js
regression-644682.js
regression-647649.js
regression-648079.js
regression-651961.js
regression-654377.js
regression-663994.js
regression-666741.js
regression-667745.js
regression-670683.js
regression-674447.js
regression-680938.js
regression-684858.js
regression-688876.js
regression-689450.js
regression-694433.js
regression-698587.js
regression-699485.js [wasm] Handle no initial memory case correctly when memory is exported 2017-04-18 06:34:16 +00:00
regression-702460.js
regression-702839.js
regression-703568.js
regression-708714.js [wasm] Stop decoding sections once an error occured 2017-04-10 13:00:50 +00:00
regression-710844.js [wasm] Handle no initial memory case correctly when memory is exported 2017-04-18 06:34:16 +00:00
regression-711203.js Restrict range for int64_t to immediate conversions 2017-04-20 21:03:31 +00:00