Index: test/mjsunit/regress/regress-320948.js |
diff --git a/test/mjsunit/harmony/iteration-syntax.js b/test/mjsunit/regress/regress-320948.js |
similarity index 50% |
copy from test/mjsunit/harmony/iteration-syntax.js |
copy to test/mjsunit/regress/regress-320948.js |
index 3bda78ed4e16d312d7f3351a9c60158659f99e1a..734031c35ca90d6e5a90adde73567672914ed5f4 100644 |
--- a/test/mjsunit/harmony/iteration-syntax.js |
+++ b/test/mjsunit/regress/regress-320948.js |
@@ -25,46 +25,57 @@ |
// (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: --harmony-iteration --harmony-scoping |
+// Flags: --allow-natives-syntax --debug-code |
-// Test for-of syntax. |
+var one_byte = %NewString(10, true); |
+var two_byte = %NewString(10, false); |
-"use strict"; |
+function foo1(s, arg1, arg2) { |
+ return %_OneByteSeqStringSetChar(s, arg1, arg2) |
+} |
+foo1(one_byte, 0, 0); |
+assertThrows("{ foo1(4, 0, 0); }"); |
+assertThrows("{ foo1(one_byte, new Object(), 0); }"); |
+assertThrows("{ foo1(one_byte, 0, new Object()); }"); |
+assertThrows("{ foo1(one_byte, 100000, 100; }"); |
+assertThrows("{ foo1(one_byte, -1, 100; }"); |
-function f() { for (x of y) { } } |
-function f() { for (var x of y) { } } |
-function f() { for (let x of y) { } } |
+function bar1(s, arg1, arg2) { |
+ return %_OneByteSeqStringSetChar(s, arg1, arg2) |
+} |
-assertThrows("function f() { for (x of) { } }", SyntaxError); |
-assertThrows("function f() { for (x of y z) { } }", SyntaxError); |
-assertThrows("function f() { for (x of y;) { } }", SyntaxError); |
+bar1(one_byte, 0, 0); |
+bar1(one_byte, 0, 0); |
+bar1(one_byte, 0, 0); |
+%OptimizeFunctionOnNextCall(bar1); |
+bar1(one_byte, 0, 0); |
+assertThrows("{ bar1(4, 0, 0); }"); |
+assertThrows("{ bar1(one_byte, new Object(), 0); }"); |
+assertThrows("{ bar1(one_byte, 0, new Object()); }"); |
+assertThrows("{ bar1(one_byte, 100000, 100; }"); |
+assertThrows("{ bar1(one_byte, -1, 100; }"); |
-assertThrows("function f() { for (var x of) { } }", SyntaxError); |
-assertThrows("function f() { for (var x of y z) { } }", SyntaxError); |
-assertThrows("function f() { for (var x of y;) { } }", SyntaxError); |
+function foo2(s, arg1, arg2) { |
+ return %_TwoByteSeqStringSetChar(s, arg1, arg2) |
+} |
+foo2(two_byte, 0, 0); |
+assertThrows("{ foo2(4, 0, 0); }"); |
+assertThrows("{ foo2(two_byte, new Object(), 0); }"); |
+assertThrows("{ foo2(two_byte, 0, new Object()); }"); |
+assertThrows("{ foo2(two_byte, 100000, 100; }"); |
+assertThrows("{ foo2(two_byte, -1, 100; }"); |
-assertThrows("function f() { for (let x of) { } }", SyntaxError); |
-assertThrows("function f() { for (let x of y z) { } }", SyntaxError); |
-assertThrows("function f() { for (let x of y;) { } }", SyntaxError); |
+function bar2(s, arg1, arg2) { |
+ return %_TwoByteSeqStringSetChar(s, arg1, arg2) |
+} |
-assertThrows("function f() { for (of y) { } }", SyntaxError); |
-assertThrows("function f() { for (of of) { } }", SyntaxError); |
-assertThrows("function f() { for (var of y) { } }", SyntaxError); |
-assertThrows("function f() { for (var of of) { } }", SyntaxError); |
-assertThrows("function f() { for (let of y) { } }", SyntaxError); |
-assertThrows("function f() { for (let of of) { } }", SyntaxError); |
- |
-assertThrows("function f() { for (x = 3 of y) { } }", SyntaxError); |
-assertThrows("function f() { for (var x = 3 of y) { } }", SyntaxError); |
-assertThrows("function f() { for (let x = 3 of y) { } }", SyntaxError); |
- |
- |
-// Alack, this appears to be valid. |
-function f() { for (of of y) { } } |
-function f() { for (let of of y) { } } |
-function f() { for (var of of y) { } } |
- |
-// This too, of course. |
-function f() { for (of in y) { } } |
-function f() { for (var of in y) { } } |
-function f() { for (let of in y) { } } |
+bar2(two_byte, 0, 0); |
+bar2(two_byte, 0, 0); |
+bar2(two_byte, 0, 0); |
+%OptimizeFunctionOnNextCall(bar2); |
+bar2(two_byte, 0, 0); |
+assertThrows("{ bar2(4, 0, 0); }"); |
+assertThrows("{ bar2(two_byte, new Object(), 0); }"); |
+assertThrows("{ bar2(two_byte, 0, new Object()); }"); |
+assertThrows("{ bar2(two_byte, 100000, 100; }"); |
+assertThrows("{ bar2(two_byte, -1, 100; }"); |