Index: test/mjsunit/regexp.js |
diff --git a/test/mjsunit/regexp.js b/test/mjsunit/regexp.js |
index a8891969f4839db012459d9d273d384cce3ce201..db8b13388e4b9e75e13052546bcbe1821c305cbd 100644 |
--- a/test/mjsunit/regexp.js |
+++ b/test/mjsunit/regexp.js |
@@ -484,3 +484,21 @@ assertRegExpTest(/[,b]\b[,b]/, ",b", true); |
assertRegExpTest(/[,b]\B[,b]/, ",b", false); |
assertRegExpTest(/[,b]\b[,b]/, "b,", true); |
assertRegExpTest(/[,b]\B[,b]/, "b,", false); |
+ |
+// Test that caching of result doesn't share result objects. |
+// More iterations increases the chance of hitting a GC. |
+for (var i = 0; i < 100; i++) { |
+ var re = /x(y)z/; |
+ var res = re.exec("axyzb"); |
+ assertTrue(!!res); |
+ assertEquals(2, res.length); |
+ assertEquals("xyz", res[0]); |
+ assertEquals("y", res[1]); |
+ assertEquals(1, res.index); |
+ assertEquals("axyzb", res.input); |
+ assertEquals(undefined, res.foobar); |
+ |
+ res.foobar = "Arglebargle"; |
+ res[3] = "Glopglyf"; |
+ assertEquals("Arglebargle", res.foobar); |
+} |