Chromium Code Reviews| Index: src/compiler.cc |
| diff --git a/src/compiler.cc b/src/compiler.cc |
| index 546ac887421ab2e10f251ec038d98f049dc37755..5e0fe479a62f9f6b869664198c0dbe1bf1b259fb 100644 |
| --- a/src/compiler.cc |
| +++ b/src/compiler.cc |
| @@ -1284,9 +1284,8 @@ Handle<SharedFunctionInfo> Compiler::CompileScript( |
| MaybeHandle<SharedFunctionInfo> maybe_result; |
| Handle<SharedFunctionInfo> result; |
| if (extension == NULL) { |
| - if (FLAG_serialize_toplevel && |
|
vogelheim
2014/12/11 11:06:22
I'd prefer to check the condition once upfront and
|
| - compile_options == ScriptCompiler::kConsumeCodeCache && |
| - !isolate->debug()->is_loaded()) { |
| + if (IsCodeCachingActive(isolate) && |
| + compile_options == ScriptCompiler::kConsumeCodeCache) { |
| HistogramTimerScope timer(isolate->counters()->compile_deserialize()); |
| Handle<SharedFunctionInfo> result; |
| if (CodeSerializer::Deserialize(isolate, *cached_data, source) |
| @@ -1302,7 +1301,7 @@ Handle<SharedFunctionInfo> Compiler::CompileScript( |
| } |
| base::ElapsedTimer timer; |
| - if (FLAG_profile_deserialization && FLAG_serialize_toplevel && |
| + if (FLAG_profile_deserialization && IsCodeCachingActive(isolate) && |
| compile_options == ScriptCompiler::kProduceCodeCache) { |
| timer.Start(); |
| } |
| @@ -1328,7 +1327,7 @@ Handle<SharedFunctionInfo> Compiler::CompileScript( |
| info.SetCachedData(cached_data, compile_options); |
| info.SetExtension(extension); |
| info.SetContext(context); |
| - if (FLAG_serialize_toplevel && |
| + if (IsCodeCachingActive(isolate) && |
| compile_options == ScriptCompiler::kProduceCodeCache) { |
| info.PrepareForSerializing(); |
| } |
| @@ -1337,7 +1336,7 @@ Handle<SharedFunctionInfo> Compiler::CompileScript( |
| result = CompileToplevel(&info); |
| if (extension == NULL && !result.is_null() && !result->dont_cache()) { |
| compilation_cache->PutScript(source, context, result); |
| - if (FLAG_serialize_toplevel && |
| + if (IsCodeCachingActive(isolate) && |
| compile_options == ScriptCompiler::kProduceCodeCache) { |
| HistogramTimerScope histogram_timer( |
| isolate->counters()->compile_serialize()); |
| @@ -1551,6 +1550,11 @@ bool Compiler::DebuggerWantsEagerCompilation(CompilationInfo* info, |
| } |
| +bool Compiler::IsCodeCachingActive(Isolate* isolate) { |
| + return FLAG_serialize_toplevel && !isolate->debug()->is_loaded(); |
| +} |
| + |
| + |
| CompilationPhase::CompilationPhase(const char* name, CompilationInfo* info) |
| : name_(name), info_(info), zone_(info->isolate()) { |
| if (FLAG_hydrogen_stats) { |