From 5ea819f80c6840c492386bfafbffb059c7e2091f Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Tue, 23 Oct 2012 10:25:11 +0200 Subject: Imported WebKit commit 20434eb8eb95065803473139d8794e98a7672f75 (http://svn.webkit.org/repository/webkit/trunk@132191) New snapshot that should fix build with latest qtbase and the QPlastiqueStyle removal --- Source/JavaScriptCore/parser/Parser.cpp | 4 +++- Source/JavaScriptCore/parser/Parser.h | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'Source/JavaScriptCore/parser') diff --git a/Source/JavaScriptCore/parser/Parser.cpp b/Source/JavaScriptCore/parser/Parser.cpp index 0f734d3a1..049a51939 100644 --- a/Source/JavaScriptCore/parser/Parser.cpp +++ b/Source/JavaScriptCore/parser/Parser.cpp @@ -39,6 +39,7 @@ #define failWithToken(tok) do { if (!m_error) updateErrorMessage(tok); return 0; } while (0) #define failWithMessage(msg) do { if (!m_error) updateErrorMessage(msg); return 0; } while (0) #define failWithNameAndMessage(before, name, after) do { if (!m_error) updateErrorWithNameAndMessage(before, name, after); return 0; } while (0) +#define failWithStackOverflow() do { m_error = true; m_hasStackOverflow = true; return 0; } while (0) #define failIfFalse(cond) do { if (!(cond)) fail(); } while (0) #define failIfFalseWithMessage(cond, msg) do { if (!(cond)) failWithMessage(msg); } while (0) #define failIfFalseWithNameAndMessage(cond, before, name, msg) do { if (!(cond)) failWithNameAndMessage(before, name, msg); } while (0) @@ -54,7 +55,7 @@ #define consumeOrFail(tokenType) do { if (!consume(tokenType)) failWithToken(tokenType); } while (0) #define consumeOrFailWithFlags(tokenType, flags) do { if (!consume(tokenType, flags)) failWithToken(tokenType); } while (0) #define matchOrFail(tokenType) do { if (!match(tokenType)) failWithToken(tokenType); } while (0) -#define failIfStackOverflow() do { failIfFalseWithMessage(canRecurse(), "Code nested too deeply."); } while (0) +#define failIfStackOverflow() do { if (!canRecurse()) failWithStackOverflow(); } while (0) using namespace std; @@ -65,6 +66,7 @@ Parser::Parser(JSGlobalData* globalData, const SourceCode& source, Fu : m_globalData(globalData) , m_source(&source) , m_stack(wtfThreadData().stack()) + , m_hasStackOverflow(false) , m_error(false) , m_errorMessage("Parse error") , m_allowsIn(true) diff --git a/Source/JavaScriptCore/parser/Parser.h b/Source/JavaScriptCore/parser/Parser.h index dc42d36ba..3b0316f81 100644 --- a/Source/JavaScriptCore/parser/Parser.h +++ b/Source/JavaScriptCore/parser/Parser.h @@ -896,6 +896,7 @@ private: OwnPtr m_lexer; StackBounds m_stack; + bool m_hasStackOverflow; bool m_error; String m_errorMessage; JSToken m_token; @@ -987,7 +988,7 @@ PassRefPtr Parser::parse(JSGlobalObject* lexicalGlobalObj // we ran out of stack while parsing. If we see an error while parsing eval or program // code we assume that it was a syntax error since running out of stack is much less // likely, and we are currently unable to distinguish between the two cases. - if (isFunctionBodyNode(static_cast(0))) + if (isFunctionBodyNode(static_cast(0)) || m_hasStackOverflow) *exception = createStackOverflowError(lexicalGlobalObject); else if (isEvalNode()) *exception = createSyntaxError(lexicalGlobalObject, errMsg); -- cgit v1.2.1