Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1526)

Unified Diff: test/mjsunit/math-floor-part2.js

Issue 10967064: Split test/mjsunit/math-floor into smaller chunks (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);

Powered by Google App Engine
This is Rietveld 408576698