Reviewers: Michael Starzinger,

Message:
mstarzinger, ptal at this tiny follow-up fix.

Description:
Follow-up to r19845 which suppresses syntax errors in presence of a stack
overflow.

It is also possible that we hit a stack overflow, but ParserBase::Next() returns a valid token (i.e., not Token::INVALID) which is unexcepted from the syntax's
point of view. In that case, we should also suppress the "unexpected token"
error and only report the stack overflow.

[email protected]
BUG=

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

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

Affected files (+4, -4 lines):
  M src/preparser.h


Index: src/preparser.h
diff --git a/src/preparser.h b/src/preparser.h
index 59a9a6108aca239f12537e032eaa14cf4b5a3a74..1ac3c5b26ef7fbeb853a329a9c47d1cb7d813a20 100644
--- a/src/preparser.h
+++ b/src/preparser.h
@@ -1016,10 +1016,10 @@ ParserBase<Traits>::FunctionState::~FunctionState() {

 template<class Traits>
 void ParserBase<Traits>::ReportUnexpectedToken(Token::Value token) {
-  // We don't report stack overflows here, to avoid increasing the
-  // stack depth even further.  Instead we report it after parsing is
-  // over, in ParseProgram.
-  if (token == Token::ILLEGAL && stack_overflow()) {
+  if (stack_overflow()) {
+    // Suppress the error message in the presence of a stack overflow. The
+    // isolate allows only one pending exception at at time and we want to
+    // report the stack overflow later.
     return;
   }
   Scanner::Location source_location = scanner()->location();


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