From 9378b1afb46ebc3094acb6d1b4714f178a7ad38a Mon Sep 17 00:00:00 2001 From: olehougaard Date: Fri, 5 Dec 2008 09:57:36 +0000 Subject: [PATCH] Checking and reporting for stack overflow in the right places. Review URL: http://codereview.chromium.org/12986 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@921 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/compiler.cc | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/compiler.cc b/src/compiler.cc index cfc0e6ca79..1c3eeb226c 100644 --- a/src/compiler.cc +++ b/src/compiler.cc @@ -74,11 +74,6 @@ static Handle MakeCode(FunctionLiteral* literal, // Generate code and return it. Handle result = CodeGenerator::MakeCode(literal, script, is_eval); - // Check for stack-overflow exception. - if (result.is_null()) { - Top::StackOverflow(); - Top::ReportPendingMessages(); - } return result; } @@ -123,6 +118,8 @@ static Handle MakeFunction(bool is_global, // Check for stack-overflow exceptions. if (code.is_null()) { + Top::StackOverflow(); + Top::ReportPendingMessages(); return Handle::null(); } @@ -211,8 +208,6 @@ Handle Compiler::Compile(Handle source, } } - if (result.is_null()) Top::ReportPendingMessages(); - return result; } @@ -243,8 +238,6 @@ Handle Compiler::CompileEval(Handle source, } } - if (result.is_null()) Top::ReportPendingMessages(); - return result; } @@ -294,7 +287,10 @@ bool Compiler::CompileLazy(Handle shared, // Compile the code. Handle code = MakeCode(lit, script, false); + // Check for stack-overflow exception. if (code.is_null()) { + Top::StackOverflow(); + Top::ReportPendingMessages(); return false; }