Chromium Code Reviews| Index: src/compiler.cc |
| diff --git a/src/compiler.cc b/src/compiler.cc |
| index bf36da3180a314647cea89322d7c66a26177d1e6..78cdff57e501ba62aa74cbbfbe877e84d859cd73 100644 |
| --- a/src/compiler.cc |
| +++ b/src/compiler.cc |
| @@ -455,6 +455,17 @@ CompilationJob::Status FinalizeUnoptimizedCompilationJob(CompilationJob* job) { |
| return status; |
| } |
| +void SetSharedFunctionFlagsFromLiteral(FunctionLiteral* literal, |
| + Handle<SharedFunctionInfo> shared_info) { |
| + shared_info->set_ast_node_count(literal->ast_node_count()); |
| + if (literal->dont_optimize_reason() != kNoReason) { |
| + shared_info->DisableOptimization(literal->dont_optimize_reason()); |
| + } |
| + if (literal->flags() & AstProperties::kMustUseIgnitionTurbo) { |
| + shared_info->set_must_use_ignition_turbo(true); |
| + } |
| +} |
| + |
| bool Renumber(Isolate* isolate, Zone* zone, FunctionLiteral* literal, |
| Handle<SharedFunctionInfo> shared_info, |
| Compiler::EagerInnerFunctionLiterals* eager_literals) { |
| @@ -464,14 +475,9 @@ bool Renumber(Isolate* isolate, Zone* zone, FunctionLiteral* literal, |
| literal, eager_literals)) { |
| return false; |
| } |
| + |
| if (!shared_info.is_null()) { |
| - shared_info->set_ast_node_count(literal->ast_node_count()); |
| - if (literal->dont_optimize_reason() != kNoReason) { |
| - shared_info->DisableOptimization(literal->dont_optimize_reason()); |
| - } |
| - if (literal->flags() & AstProperties::kMustUseIgnitionTurbo) { |
| - shared_info->set_must_use_ignition_turbo(true); |
| - } |
| + SetSharedFunctionFlagsFromLiteral(literal, shared_info); |
| } |
| return true; |
| } |
| @@ -499,7 +505,7 @@ bool GenerateUnoptimizedCode(CompilationInfo* info) { |
| return true; |
| } |
| -bool CompileUnoptimizedInnerFunctionsRecursively( |
| +bool CompileUnoptimizedInnerFunctions( |
| ThreadedList<ThreadedListZoneEntry<FunctionLiteral*>>* literals, |
| CompilationInfo* outer_info) { |
| Isolate* isolate = outer_info->isolate(); |
| @@ -514,14 +520,8 @@ bool CompileUnoptimizedInnerFunctionsRecursively( |
| Handle<SharedFunctionInfo> shared = |
| Compiler::GetSharedFunctionInfo(literal, script, outer_info); |
| if (shared->is_compiled()) continue; |
| - Compiler::EagerInnerFunctionLiterals inner_literals; |
| - if (!Renumber(isolate, outer_info->zone(), literal, shared, |
| - &inner_literals) || |
| - !CompileUnoptimizedInnerFunctionsRecursively(&inner_literals, |
| - outer_info)) { |
| - if (!isolate->has_pending_exception()) isolate->StackOverflow(); |
| - return false; |
| - } |
| + |
| + SetSharedFunctionFlagsFromLiteral(literal, shared); |
|
Michael Starzinger
2017/01/19 13:29:22
nit: Please add a brief comment here explaining th
rmcilroy
2017/01/19 17:24:49
Done.
|
| // Try to enqueue the eager function on the compiler dispatcher. |
| CompilerDispatcher* dispatcher = isolate->compiler_dispatcher(); |
| @@ -562,7 +562,7 @@ bool CompileUnoptimizedCode(CompilationInfo* info) { |
| Compiler::EagerInnerFunctionLiterals inner_literals; |
| if (!Compiler::Analyze(info->parse_info(), &inner_literals) || |
| - !CompileUnoptimizedInnerFunctionsRecursively(&inner_literals, info) || |
| + !CompileUnoptimizedInnerFunctions(&inner_literals, info) || |
| !GenerateUnoptimizedCode(info)) { |
| if (!isolate->has_pending_exception()) isolate->StackOverflow(); |
| return false; |