| Index: test/mjsunit/math-floor-negative.js
|
| diff --git a/test/mjsunit/regress/regress-2110.js b/test/mjsunit/math-floor-negative.js
|
| similarity index 70%
|
| copy from test/mjsunit/regress/regress-2110.js
|
| copy to test/mjsunit/math-floor-negative.js
|
| index d7f78d26a7b4d16c4217d2b0ac136e52e4542eb1..4cabff577eafc1f7eb435f0e4b5ae3db27d1e0ae 100644
|
| --- a/test/mjsunit/regress/regress-2110.js
|
| +++ b/test/mjsunit/math-floor-negative.js
|
| @@ -25,29 +25,35 @@
|
| // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
| -// Flags: --allow-natives-syntax
|
| +// Flags: --noenable_sse4_1 --allow-natives-syntax
|
|
|
| -var uint8 = new Uint8Array(1);
|
| -
|
| -function test() {
|
| - uint8[0] = 0x800000aa;
|
| - assertEquals(0xaa, uint8[0]);
|
| +function test1() {
|
| + // Trigger overflow when converting/truncating double to integer.
|
| + // Divide by 10 to avoid overflow when smi-tagging at the end.
|
| + return Math.floor(-100000000000.5) / 10;
|
| }
|
|
|
| -test();
|
| -test();
|
| -test();
|
| -%OptimizeFunctionOnNextCall(test);
|
| -test();
|
| -
|
| -var uint32 = new Uint32Array(1);
|
| -
|
| function test2() {
|
| - uint32[0] = 0x80123456789abcde;
|
| - assertEquals(0x789ac000, uint32[0]);
|
| + // Trigger no overflow.
|
| + return Math.floor(-100.2);
|
| }
|
|
|
| +function test3() {
|
| + // Trigger overflow when compensating by subtracting after compare.
|
| + // Divide by 10 to avoid overflow when smi-tagging at the end.
|
| + return Math.floor(-2147483648.1) / 10;
|
| +}
|
| +
|
| +test1();
|
| +test1();
|
| +%OptimizeFunctionOnNextCall(test1);
|
| test2();
|
| test2();
|
| %OptimizeFunctionOnNextCall(test2);
|
| -test2();
|
| +test3();
|
| +test3();
|
| +%OptimizeFunctionOnNextCall(test3);
|
| +
|
| +assertEquals(-10000000000.1, test1());
|
| +assertEquals(-101, test2());
|
| +assertEquals(-214748364.9, test3());
|
|
|