Reviewers: William Hesse, Description: Add test cases for fast smi loops.
Please review this at http://codereview.chromium.org/1014007 SVN Base: http://v8.googlecode.com/svn/branches/bleeding_edge/ Affected files: M src/ia32/codegen-ia32.cc M test/mjsunit/compiler/loopcount.js Index: test/mjsunit/compiler/loopcount.js =================================================================== --- test/mjsunit/compiler/loopcount.js (revision 4172) +++ test/mjsunit/compiler/loopcount.js (working copy) @@ -54,5 +54,24 @@ } assertEquals(-0x40000001, f5()); + function f6() { var x = 0x3fffffff; x++; return x+1; } assertEquals(0x40000001, f6()); + + +function f7() { + var i; + for (i = 0x3ffffffd; i <= 0x3ffffffe; i++) {} + i++; i = i + 1; + return i; +} +assertEquals(0x40000001, f7()); + + +function f8() { + var i; + for (i = 0x3ffffffd; i <= 0x3fffffff; i++) {} + i++; i++; + return i; +} +assertEquals(0x40000002, f8()); Index: src/ia32/codegen-ia32.cc =================================================================== --- src/ia32/codegen-ia32.cc (revision 4172) +++ src/ia32/codegen-ia32.cc (working copy) @@ -3730,7 +3730,8 @@ // If we have (a) a loop with a compile-time constant trip count // and (b) the loop induction variable is not assignend inside the // loop we update the number type of the induction variable to be smi. - + // before generating the body, the update expression and the test at + // the bottom. if (node->is_fast_smi_loop()) { // Set number type of the loop variable to smi. Slot* slot = node->loop_variable()->slot(); @@ -3763,8 +3764,8 @@ } } - // The update expression resets the type of the loop variable. So we - // set it to smi before compiling the test expression. + // Set the type of the loop variable to smi before compiling the test + // expression if we are in a fast smi loop. if (node->is_fast_smi_loop()) { // Set number type of the loop variable to smi. Slot* slot = node->loop_variable()->slot(); -- v8-dev mailing list [email protected] http://groups.google.com/group/v8-dev
