Reviewers: Igor Sheludko,

Message:
PTAL

Description:
Clear pending exception on stack overflow in the parser

BUG=450960
LOG=n

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

Base URL: https://chromium.googlesource.com/v8/v8.git@master

Affected files (+17, -10 lines):
  M src/runtime/runtime-internal.cc
  A + test/mjsunit/regress/regress-crbug-450960.js


Index: src/runtime/runtime-internal.cc
diff --git a/src/runtime/runtime-internal.cc b/src/runtime/runtime-internal.cc index 38f238b1cdd76e7fc90f21b7689c33b7201ac268..b3e4822bda07350c9764604f31b88bdfcf86a461 100644
--- a/src/runtime/runtime-internal.cc
+++ b/src/runtime/runtime-internal.cc
@@ -166,14 +166,20 @@ RUNTIME_FUNCTION(Runtime_RenderCallSite) {
   Zone zone(isolate);
   if (location.function()->shared()->is_function()) {
     CompilationInfo info(location.function(), &zone);
-    if (!Parser::Parse(&info)) return isolate->heap()->empty_string();
+    if (!Parser::Parse(&info)) {
+      isolate->clear_pending_exception();
+      return isolate->heap()->empty_string();
+    }
     CallPrinter printer(&zone);
const char* string = printer.Print(info.function(), location.start_pos());
     return *isolate->factory()->NewStringFromAsciiChecked(string);
   }

   CompilationInfo info(location.script(), &zone);
-  if (!Parser::Parse(&info)) return isolate->heap()->empty_string();
+  if (!Parser::Parse(&info)) {
+    isolate->clear_pending_exception();
+    return isolate->heap()->empty_string();
+  }
   CallPrinter printer(&zone);
const char* string = printer.Print(info.function(), location.start_pos());
   return *isolate->factory()->NewStringFromAsciiChecked(string);
Index: test/mjsunit/regress/regress-crbug-450960.js
diff --git a/test/mjsunit/compiler/regress-ntl-effect.js b/test/mjsunit/regress/regress-crbug-450960.js
similarity index 53%
copy from test/mjsunit/compiler/regress-ntl-effect.js
copy to test/mjsunit/regress/regress-crbug-450960.js
index 708fe32828c9197dfa3d8c371ab01cbc1ad3317a..5c280f2935c45e19af1077e4af70d8268c58244f 100644
--- a/test/mjsunit/compiler/regress-ntl-effect.js
+++ b/test/mjsunit/regress/regress-crbug-450960.js
@@ -2,15 +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
+// Flags: --stack-size=25

-function g() {
-  throw 0;
-}
+"a".replace(/a/g, "");

-function f() {
-  g();
-  while (1) {}
+function test() {
+   try {
+     test();
+   } catch(e) {
+     "b".replace(/(b)/g, new []);
+   }
 }

-assertThrows(function () { f(); });
+test();


--
--
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