Reviewers: mvstanton,

Description:
Fix assertion in RegExp parser to correctly expect stack overflow.

Advance() always checks for stack overflow. If stack indeed overflowed,
current() would hold the kEndMarker. ParseOctalLiteral does not expect
this in the assertion, which causes assertion failure.

[email protected]
BUG=350865

Please review this at https://codereview.chromium.org/192773002/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+11, -8 lines):
  M src/parser.cc
  A + test/mjsunit/regress/regress-350865.js


Index: src/parser.cc
diff --git a/src/parser.cc b/src/parser.cc
index 9b8223c7558e5b9217ece0ab67c331e6d717206b..cf417b8c64c905c1f50c52329aa2de915446f327 100644
--- a/src/parser.cc
+++ b/src/parser.cc
@@ -4990,7 +4990,7 @@ bool RegExpParser::ParseIntervalQuantifier(int* min_out, int* max_out) {


 uc32 RegExpParser::ParseOctalLiteral() {
-  ASSERT('0' <= current() && current() <= '7');
+ ASSERT(('0' <= current() && current() <= '7') || current() == kEndMarker);
   // For compatibility with some other browsers (not all), we parse
   // up to three octal digits with a value below 256.
   uc32 value = current() - '0';
Index: test/mjsunit/regress/regress-350865.js
diff --git a/test/mjsunit/regress/regress-347906.js b/test/mjsunit/regress/regress-350865.js
similarity index 54%
copy from test/mjsunit/regress/regress-347906.js
copy to test/mjsunit/regress/regress-350865.js
index c751618928c93015679087ee1b500637657aa341..74234db8842929a57d93a10cda0f62078f014845 100644
--- a/test/mjsunit/regress/regress-347906.js
+++ b/test/mjsunit/regress/regress-350865.js
@@ -2,13 +2,16 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.

-// Flags: --allow-natives-syntax --harmony
+// Flags: --stress-compaction --stack-size=150

-function foo() {
-  return Math.clz32(12.34);
+/\2/.test("1");
+
+function rec() {
+  try {
+    rec();
+  } catch(e) {
+    /\2/.test("1");
+  }
 }

-foo();
-foo();
-%OptimizeFunctionOnNextCall(foo);
-foo();
+rec();


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to