| 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);
|
| }
|
|
|
|
|