| Index: test/mjsunit/div-mod.js
|
| diff --git a/test/mjsunit/div-mod.js b/test/mjsunit/div-mod.js
|
| index c3144955cbcfd936958a5fbacf8432b077d36cad..6664df2c9fef6578aed872a3160d6cc7fb8eda19 100644
|
| --- a/test/mjsunit/div-mod.js
|
| +++ b/test/mjsunit/div-mod.js
|
| @@ -43,8 +43,10 @@ function divmod(div_func, mod_func, x, y) {
|
|
|
| function run_tests_for(divisor) {
|
| print("(function(left) { return left / " + divisor + "; })");
|
| - var div_func = this.eval("(function(left) { return left / " + divisor + "; })");
|
| - var mod_func = this.eval("(function(left) { return left % " + divisor + "; })");
|
| + var div_func =
|
| + this.eval("(function(left) { return left / " + divisor + "; })");
|
| + var mod_func =
|
| + this.eval("(function(left) { return left % " + divisor + "; })");
|
| var exp;
|
| // Strange number test.
|
| divmod(div_func, mod_func, 0, divisor);
|
| @@ -97,7 +99,10 @@ function compute_mod(dividend, divisor) {
|
| // dividend is an infinity. Return dividend if divisor is an infinity.
|
| if (isNaN(dividend) || isNaN(divisor) || divisor == 0) { return NaN; }
|
| var sign = 1;
|
| - if (dividend < 0) { dividend = -dividend; sign = -1; }
|
| + if (dividend < 0) {
|
| + dividend = -dividend;
|
| + sign = -1;
|
| + }
|
| if (dividend == Infinity) { return NaN; }
|
| if (divisor < 0) { divisor = -divisor; }
|
| if (divisor == Infinity) { return sign * dividend; }
|
| @@ -204,17 +209,27 @@ function lithium_integer_mod() {
|
| var mod_func;
|
| for (var i = 0; i < left_operands.length; i++) {
|
| for (var j = 0; j < divisors.length; j++) {
|
| - mod_func = this.eval("(function(left) { return left % " + divisors[j]+ "; })");
|
| - assertEquals((mod_func)(left_operands[i]), left_operands[i] % divisors[j]);
|
| - assertEquals((mod_func)(-left_operands[i]), -left_operands[i] % divisors[j]);
|
| + mod_func =
|
| + this.eval("(function(left) { return left % " + divisors[j]+ "; })");
|
| + assertEquals((mod_func)(left_operands[i]),
|
| + left_operands[i] % divisors[j]);
|
| + assertEquals((mod_func)(-left_operands[i]),
|
| + -left_operands[i] % divisors[j]);
|
| }
|
| }
|
|
|
| var results_powers_of_two = [
|
| // 0
|
| - [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
| + [0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
| + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
| + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
| + 0],
|
| // 305419896 == 0x12345678
|
| - [0, 0, 0, 8, 24, 56, 120, 120, 120, 632, 1656, 1656, 5752, 5752, 22136, 22136, 22136, 22136, 284280, 284280, 1332856, 3430008, 3430008, 3430008, 3430008, 36984440, 36984440, 36984440, 305419896, 305419896, 305419896],
|
| + [0, 0, 0, 8, 24, 56, 120, 120, 120, 632,
|
| + 1656, 1656, 5752, 5752, 22136, 22136, 22136, 22136, 284280, 284280,
|
| + 1332856, 3430008, 3430008, 3430008, 3430008,
|
| + 36984440, 36984440, 36984440, 305419896, 305419896,
|
| + 305419896],
|
| ];
|
|
|
| // Test the lithium code for modulo operations with a variable power of two
|
| @@ -300,5 +315,5 @@ function lithium_integer_mod() {
|
| }
|
|
|
| lithium_integer_mod();
|
| -%OptimizeFunctionOnNextCall(lithium_integer_mod)
|
| +%OptimizeFunctionOnNextCall(lithium_integer_mod);
|
| lithium_integer_mod();
|
|
|