Index: test/mjsunit/break.js |
diff --git a/test/mjsunit/arguments.js b/test/mjsunit/break.js |
similarity index 51% |
copy from test/mjsunit/arguments.js |
copy to test/mjsunit/break.js |
index 030273904cc5d94e51eee75dc6a08b2a5a592719..741263d9e3533dccbc1cd721e4bccde2610642e3 100644 |
--- a/test/mjsunit/arguments.js |
+++ b/test/mjsunit/break.js |
@@ -1,4 +1,4 @@ |
-// Copyright 2008 the V8 project authors. All rights reserved. |
+// Copyright 2011 the V8 project authors. All rights reserved. |
// Redistribution and use in source and binary forms, with or without |
// modification, are permitted provided that the following conditions are |
// met: |
@@ -25,73 +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. |
-function argc0() { |
- return arguments.length; |
+function f() { |
+ var i = 10; |
+ var c = 0; |
+ while (i-- > 0) { |
+ c++; |
+ if (i == 5) ; |
+ } |
+ assertEquals(10, c); |
} |
+f(); |
-function argc1(i) { |
- return arguments.length; |
-} |
-function argc2(i, j) { |
- return arguments.length; |
+function f2() { |
+ var i = 10; |
+ var c = 0; |
+ while (i-- > 0) { |
+ c++; |
+ if (i == 5) break; |
+ } |
+ assertEquals(5, c); |
} |
- |
-assertEquals(0, argc0()); |
-assertEquals(1, argc0(1)); |
-assertEquals(2, argc0(1, 2)); |
-assertEquals(3, argc0(1, 2, 3)); |
-assertEquals(0, argc1()); |
-assertEquals(1, argc1(1)); |
-assertEquals(2, argc1(1, 2)); |
-assertEquals(3, argc1(1, 2, 3)); |
-assertEquals(0, argc2()); |
-assertEquals(1, argc2(1)); |
-assertEquals(2, argc2(1, 2)); |
-assertEquals(3, argc2(1, 2, 3)); |
- |
+f2(); |
-var index; |
- |
-function argv0() { |
- return arguments[index]; |
+function f3() { |
+ var i = 10; |
+ var c = 0; |
+ outer: while (i-- > 0) { |
+ var j = 10; |
+ inner1: inner2: inner3: while (j-- > 0) { |
+ c++; |
+ if (i == 8) |
+ break inner2; |
+ if (i == 6) |
+ break outer; |
+ } |
+ } |
+ assertEquals(22, c); |
} |
+f3(); |
-function argv1(i) { |
- return arguments[index]; |
+outer2: { |
+ break outer2; |
+ assertUnreachable(); |
} |
-function argv2(i, j) { |
- return arguments[index]; |
-} |
- |
-index = 0; |
-assertEquals(7, argv0(7)); |
-assertEquals(7, argv0(7, 8)); |
-assertEquals(7, argv0(7, 8, 9)); |
-assertEquals(7, argv1(7)); |
-assertEquals(7, argv1(7, 8)); |
-assertEquals(7, argv1(7, 8, 9)); |
-assertEquals(7, argv2(7)); |
-assertEquals(7, argv2(7, 8)); |
-assertEquals(7, argv2(7, 8, 9)); |
- |
-index = 1; |
-assertEquals(8, argv0(7, 8)); |
-assertEquals(8, argv0(7, 8)); |
-assertEquals(8, argv1(7, 8, 9)); |
-assertEquals(8, argv1(7, 8, 9)); |
-assertEquals(8, argv2(7, 8, 9)); |
-assertEquals(8, argv2(7, 8, 9)); |
- |
-index = 2; |
-assertEquals(9, argv0(7, 8, 9)); |
-assertEquals(9, argv1(7, 8, 9)); |
-assertEquals(9, argv2(7, 8, 9)); |
- |
-// Test that calling a lazily compiled function with |
-// an unexpected number of arguments works. |
-function f(a) { return arguments.length; }; |
-assertEquals(3, f(1, 2, 3)); |
+outer3: break outer3; // nop |
+l1: l2: l3: break l2; // nop |