Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(987)

Unified Diff: test/mjsunit/regress/regress-crbug-178790.js

Issue 12746003: Merged r13788, r13658 into 3.16 branch. (Closed) Base URL: https://v8.googlecode.com/svn/branches/3.16
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/mjsunit/regress/regress-2537.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/regress/regress-crbug-178790.js
diff --git a/test/mjsunit/regress/regress-crbug-170856.js b/test/mjsunit/regress/regress-crbug-178790.js
similarity index 72%
copy from test/mjsunit/regress/regress-crbug-170856.js
copy to test/mjsunit/regress/regress-crbug-178790.js
index 2e73b12caaf78c8b070c243ee79d3b8e557ad97d..57071eaa087c3503c4d1ef56e0fd87000a364a29 100644
--- a/test/mjsunit/regress/regress-crbug-170856.js
+++ b/test/mjsunit/regress/regress-crbug-178790.js
@@ -25,9 +25,28 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-r = new RegExp("a");
+// Create a regexp in the form of a?a?...a? so that fully
+// traversing the entire graph would be prohibitively expensive.
+// This should not cause time out.
+var r1 = "";
+for (var i = 0; i < 1000; i++) {
+ r1 += "a?";
+}
+"test".match(RegExp(r1));
+
+var r2 = "";
for (var i = 0; i < 100; i++) {
- r["abc" + i] = i;
+ r2 += "(a?|b?|c?|d?|e?|f?|g?)";
}
-"zzzz".replace(r, "");
-assertEquals(0, r.lastIndex);
+"test".match(RegExp(r2));
+
+// Create a regexp in the form of ((..(a)a..)a.
+// Compiling it causes EatsAtLeast to reach the maximum
+// recursion depth possible with a given budget.
+// This should not cause a stack overflow.
+var r3 = "a";
+for (var i = 0; i < 1000; i++) {
+ r3 = "(" + r3 + ")a";
+}
+"test".match(RegExp(r3));
+
« no previous file with comments | « test/mjsunit/regress/regress-2537.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698