Revision: 8402
Author:   [email protected]
Date:     Fri Jun 24 00:46:57 2011
Log:      Add regression test for optimized version of Math.abs.

This issue was already fixed on bleeding edge, but adding regression
test to get coverage and to make sure it works on the branches.
Review URL: http://codereview.chromium.org/7237022
http://code.google.com/p/v8/source/detail?r=8402

Modified:
 /branches/bleeding_edge/test/mjsunit/math-abs.js

=======================================
--- /branches/bleeding_edge/test/mjsunit/math-abs.js Fri Apr 15 04:35:36 2011 +++ /branches/bleeding_edge/test/mjsunit/math-abs.js Fri Jun 24 00:46:57 2011
@@ -25,7 +25,7 @@
 // (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: --max-new-space-size=256
+// Flags: --max-new-space-size=256 --allow-natives-syntax

 function zero() {
   var x = 0.5;
@@ -96,3 +96,16 @@
 for (var i = 0; i < 500; i++) {
   test();
 }
+
+// Regression test for optimized version of Math.abs, see:
+// http://codereview.chromium.org/6875002.
+function foo(x) {
+  return Math.abs(x);
+}
+// Get some smi type feedback.
+for(var i = 0; i < 1000; i++) {
+  foo(-i);
+}
+assertEquals(42, foo(-42));
+%OptimizeFunctionOnNextCall(foo)
+assertEquals(42, foo(-42));

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to