Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(768)

Unified Diff: src/full-codegen.cc

Issue 3561012: More refactoring of class Compiler's interface. (Closed)
Patch Set: Reindent some code, change some copyright dates. Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/full-codegen.cc
diff --git a/src/full-codegen.cc b/src/full-codegen.cc
index fa835cb0f4575f7290d97cbcb718869e61d53f12..796b0717cf0e84dc1a627cfeed126f4565e2ab2a 100644
--- a/src/full-codegen.cc
+++ b/src/full-codegen.cc
@@ -277,7 +277,7 @@ void BreakableStatementChecker::VisitThisFunction(ThisFunction* expr) {
#define __ ACCESS_MASM(masm())
-Handle<Code> FullCodeGenerator::MakeCode(CompilationInfo* info) {
+bool FullCodeGenerator::MakeCode(CompilationInfo* info) {
Handle<Script> script = info->script();
if (!script->IsUndefined() && !script->source()->IsUndefined()) {
int len = String::cast(script->source())->length();
@@ -291,10 +291,13 @@ Handle<Code> FullCodeGenerator::MakeCode(CompilationInfo* info) {
cgen.Generate(info);
if (cgen.HasStackOverflow()) {
ASSERT(!Top::has_pending_exception());
- return Handle<Code>::null();
+ return false;
}
+
Code::Flags flags = Code::ComputeFlags(Code::FUNCTION, NOT_IN_LOOP);
- return CodeGenerator::MakeCodeEpilogue(&masm, flags, info);
+ Handle<Code> code = CodeGenerator::MakeCodeEpilogue(&masm, flags, info);
+ info->SetCode(code); // may be an empty handle.
+ return !code.is_null();
}
@@ -462,9 +465,12 @@ void FullCodeGenerator::VisitDeclarations(
}
} else {
Handle<SharedFunctionInfo> function =
- Compiler::BuildFunctionInfo(decl->fun(), script(), this);
+ Compiler::BuildFunctionInfo(decl->fun(), script());
// Check for stack-overflow exception.
- if (HasStackOverflow()) return;
+ if (function.is_null()) {
+ SetStackOverflow();
+ return;
+ }
array->set(j++, *function);
}
}
@@ -1156,8 +1162,11 @@ void FullCodeGenerator::VisitFunctionLiteral(FunctionLiteral* expr) {
// Build the function boilerplate and instantiate it.
Handle<SharedFunctionInfo> function_info =
- Compiler::BuildFunctionInfo(expr, script(), this);
- if (HasStackOverflow()) return;
+ Compiler::BuildFunctionInfo(expr, script());
+ if (function_info.is_null()) {
+ SetStackOverflow();
+ return;
+ }
EmitNewClosure(function_info);
}
« src/compiler.h ('K') | « src/full-codegen.h ('k') | src/ia32/codegen-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698