Checking and reporting for stack overflow in the right places.
authorolehougaard <olehougaard@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Fri, 5 Dec 2008 09:57:36 +0000 (09:57 +0000)
committerolehougaard <olehougaard@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Fri, 5 Dec 2008 09:57:36 +0000 (09:57 +0000)
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

index cfc0e6ca7950727954b95a92aa56144a313377c0..1c3eeb226cf50338f40f74d795fdb26a4c4a3f8f 100644 (file)
@@ -74,11 +74,6 @@ static Handle<Code> MakeCode(FunctionLiteral* literal,
 
   // Generate code and return it.
   Handle<Code> 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<JSFunction> MakeFunction(bool is_global,
 
   // Check for stack-overflow exceptions.
   if (code.is_null()) {
+    Top::StackOverflow();
+    Top::ReportPendingMessages();
     return Handle<JSFunction>::null();
   }
 
@@ -211,8 +208,6 @@ Handle<JSFunction> Compiler::Compile(Handle<String> source,
     }
   }
 
-  if (result.is_null()) Top::ReportPendingMessages();
-
   return result;
 }
 
@@ -243,8 +238,6 @@ Handle<JSFunction> Compiler::CompileEval(Handle<String> source,
     }
   }
 
-  if (result.is_null()) Top::ReportPendingMessages();
-
   return result;
 }
 
@@ -294,7 +287,10 @@ bool Compiler::CompileLazy(Handle<SharedFunctionInfo> shared,
   // Compile the code.
   Handle<Code> code = MakeCode(lit, script, false);
 
+  // Check for stack-overflow exception.
   if (code.is_null()) {
+    Top::StackOverflow();
+    Top::ReportPendingMessages();
     return false;
   }