| Index: test/mjsunit/math-floor-part2.js
|
| diff --git a/test/mjsunit/regress/regress-1132.js b/test/mjsunit/math-floor-part2.js
|
| similarity index 56%
|
| copy from test/mjsunit/regress/regress-1132.js
|
| copy to test/mjsunit/math-floor-part2.js
|
| index 3314db85727272f274f556db3ac415b352201e7e..b6d51b2bde91265c755e17f9b5319c8ac34073aa 100644
|
| --- a/test/mjsunit/regress/regress-1132.js
|
| +++ b/test/mjsunit/math-floor-part2.js
|
| @@ -25,26 +25,52 @@
|
| // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
| -// Test the case when exception is thrown from the parser when lazy
|
| -// compiling a function.
|
| +// Flags: --max-new-space-size=256 --allow-natives-syntax
|
|
|
| -// Flags: --stack_size=32
|
| -// NOTE: stack size constant above has been empirically chosen.
|
| -// If the test starts to fail in Genesis, consider increasing this constant.
|
| +var test_id = 0;
|
| +
|
| +function testFloor(expect, input) {
|
| + var test = new Function('n',
|
| + '"' + (test_id++) + '";return Math.floor(n)');
|
| + assertEquals(expect, test(input));
|
| + assertEquals(expect, test(input));
|
| + assertEquals(expect, test(input));
|
| + %OptimizeFunctionOnNextCall(test);
|
| + assertEquals(expect, test(input));
|
| +}
|
| +
|
| +function zero() {
|
| + var x = 0.5;
|
| + return (function() { return x - 0.5; })();
|
| +}
|
|
|
| function test() {
|
| - try {
|
| - test(1, test(1));
|
| - } catch(e) {
|
| - assertFalse(delete e, "deleting catch variable");
|
| - assertEquals(42, e);
|
| - }
|
| + // 2^30 is a smi boundary.
|
| + var two_30 = 1 << 30;
|
| +
|
| + testFloor(two_30, two_30);
|
| + testFloor(two_30, two_30 + 0.1);
|
| + testFloor(two_30, two_30 + 0.5);
|
| + testFloor(two_30, two_30 + 0.7);
|
| +
|
| + testFloor(two_30 - 1, two_30 - 1);
|
| + testFloor(two_30 - 1, two_30 - 1 + 0.1);
|
| + testFloor(two_30 - 1, two_30 - 1 + 0.5);
|
| + testFloor(two_30 - 1, two_30 - 1 + 0.7);
|
| +
|
| + testFloor(-two_30, -two_30);
|
| + testFloor(-two_30, -two_30 + 0.1);
|
| + testFloor(-two_30, -two_30 + 0.5);
|
| + testFloor(-two_30, -two_30 + 0.7);
|
| +
|
| + testFloor(-two_30 + 1, -two_30 + 1);
|
| + testFloor(-two_30 + 1, -two_30 + 1 + 0.1);
|
| + testFloor(-two_30 + 1, -two_30 + 1 + 0.5);
|
| + testFloor(-two_30 + 1, -two_30 + 1 + 0.7);
|
| }
|
|
|
| -var exception = false;
|
| -try {
|
| +
|
| +// Test in a loop to cover the custom IC and GC-related issues.
|
| +for (var i = 0; i < 100; i++) {
|
| test();
|
| -} catch (e) {
|
| - exception = true;
|
| }
|
| -assertTrue(exception);
|
|
|