Revision: 4918
Author: lukezarko
Date: Tue Jun 22 15:20:58 2010
Log: Make the apply.js unit test more resilient to differing stack positions.

More information is at http://code.google.com/p/v8/issues/detail?id=742

Review URL: http://codereview.chromium.org/2835014
http://code.google.com/p/v8/source/detail?r=4918

Modified:
 /branches/bleeding_edge/test/mjsunit/apply.js
 /branches/bleeding_edge/test/mjsunit/mjsunit.status

=======================================
--- /branches/bleeding_edge/test/mjsunit/apply.js       Thu Jul  9 01:00:12 2009
+++ /branches/bleeding_edge/test/mjsunit/apply.js       Tue Jun 22 15:20:58 2010
@@ -111,6 +111,8 @@
   assertEquals(345, this);
   return arguments.length + arguments[arguments.length - 1];
 }
+
+var stack_corner_case_failure = false;

 for (var j = 1; j < 0x40000000; j <<= 1) {
   try {
@@ -118,6 +120,17 @@
     a[j - 1] = 42;
     assertEquals(42 + j, al.apply(345, a));
   } catch (e) {
+    if (e.toString().indexOf("Maximum call stack size exceeded") != -1) {
+ // For some combinations of build settings, it may be the case that the
+      // stack here is just tall enough to contain the array whose size is
+      // specified by j but is not tall enough to contain the activation
+      // record for the apply call. Allow one such corner case through,
+ // checking that the length check will do the right thing for an array
+      // the next size up.
+      assertEquals(false, stack_corner_case_failure);
+      stack_corner_case_failure = true;
+      continue;
+    }
     assertTrue(e.toString().indexOf("Function.prototype.apply") != -1,
               "exception does not contain Function.prototype.apply: " +
                   e.toString());
@@ -127,7 +140,7 @@
         a = new Array(j);
         a[j - 1] = 42;
         al.apply(345, a);
-        assertUnreachable("Apply of arrray with length " + a.length +
+        assertUnreachable("Apply of array with length " + a.length +
                           " should have thrown");
       } catch (e) {
         assertTrue(e.toString().indexOf("Function.prototype.apply") != -1,
=======================================
--- /branches/bleeding_edge/test/mjsunit/mjsunit.status Wed May 12 07:46:09 2010 +++ /branches/bleeding_edge/test/mjsunit/mjsunit.status Tue Jun 22 15:20:58 2010
@@ -34,9 +34,6 @@
 # too long to run in debug mode on ARM.
 fuzz-natives: PASS, SKIP if ($mode == release || $arch == arm)

-# Issue 494: new snapshot code breaks mjsunit/apply on mac debug snapshot.
-apply: PASS, FAIL if ($system == macos && $mode == debug)
-
 big-object-literal: PASS, SKIP if ($arch == arm)

 # Issue 488: this test sometimes times out.

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

Reply via email to