| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/compiler.h" | 7 #include "src/compiler.h" |
| 8 | 8 |
| 9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
| 10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
| (...skipping 1033 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1044 | 1044 |
| 1045 CompilationCache* compilation_cache = isolate->compilation_cache(); | 1045 CompilationCache* compilation_cache = isolate->compilation_cache(); |
| 1046 | 1046 |
| 1047 // Do a lookup in the compilation cache but not for extensions. | 1047 // Do a lookup in the compilation cache but not for extensions. |
| 1048 MaybeHandle<SharedFunctionInfo> maybe_result; | 1048 MaybeHandle<SharedFunctionInfo> maybe_result; |
| 1049 Handle<SharedFunctionInfo> result; | 1049 Handle<SharedFunctionInfo> result; |
| 1050 if (extension == NULL) { | 1050 if (extension == NULL) { |
| 1051 if (FLAG_serialize_toplevel && | 1051 if (FLAG_serialize_toplevel && |
| 1052 compile_options == ScriptCompiler::kConsumeCodeCache && | 1052 compile_options == ScriptCompiler::kConsumeCodeCache && |
| 1053 !isolate->debug()->is_loaded()) { | 1053 !isolate->debug()->is_loaded()) { |
| 1054 HistogramTimerScope timer(isolate->counters()->compile_deserialize()); |
| 1054 return CodeSerializer::Deserialize(isolate, *cached_data, source); | 1055 return CodeSerializer::Deserialize(isolate, *cached_data, source); |
| 1055 } else { | 1056 } else { |
| 1056 maybe_result = compilation_cache->LookupScript( | 1057 maybe_result = compilation_cache->LookupScript( |
| 1057 source, script_name, line_offset, column_offset, | 1058 source, script_name, line_offset, column_offset, |
| 1058 is_shared_cross_origin, context); | 1059 is_shared_cross_origin, context); |
| 1059 } | 1060 } |
| 1060 } | 1061 } |
| 1061 | 1062 |
| 1062 base::ElapsedTimer timer; | 1063 base::ElapsedTimer timer; |
| 1063 if (FLAG_profile_deserialization && FLAG_serialize_toplevel && | 1064 if (FLAG_profile_deserialization && FLAG_serialize_toplevel && |
| (...skipping 26 matching lines...) Expand all Loading... |
| 1090 compile_options == ScriptCompiler::kProduceCodeCache) { | 1091 compile_options == ScriptCompiler::kProduceCodeCache) { |
| 1091 info.PrepareForSerializing(); | 1092 info.PrepareForSerializing(); |
| 1092 } | 1093 } |
| 1093 if (FLAG_use_strict) info.SetStrictMode(STRICT); | 1094 if (FLAG_use_strict) info.SetStrictMode(STRICT); |
| 1094 | 1095 |
| 1095 result = CompileToplevel(&info); | 1096 result = CompileToplevel(&info); |
| 1096 if (extension == NULL && !result.is_null() && !result->dont_cache()) { | 1097 if (extension == NULL && !result.is_null() && !result->dont_cache()) { |
| 1097 compilation_cache->PutScript(source, context, result); | 1098 compilation_cache->PutScript(source, context, result); |
| 1098 if (FLAG_serialize_toplevel && | 1099 if (FLAG_serialize_toplevel && |
| 1099 compile_options == ScriptCompiler::kProduceCodeCache) { | 1100 compile_options == ScriptCompiler::kProduceCodeCache) { |
| 1101 HistogramTimerScope histogram_timer( |
| 1102 isolate->counters()->compile_serialize()); |
| 1100 *cached_data = CodeSerializer::Serialize(isolate, result, source); | 1103 *cached_data = CodeSerializer::Serialize(isolate, result, source); |
| 1101 if (FLAG_profile_deserialization) { | 1104 if (FLAG_profile_deserialization) { |
| 1102 PrintF("[Compiling and serializing %d bytes took %0.3f ms]\n", | 1105 PrintF("[Compiling and serializing %d bytes took %0.3f ms]\n", |
| 1103 (*cached_data)->length(), timer.Elapsed().InMillisecondsF()); | 1106 (*cached_data)->length(), timer.Elapsed().InMillisecondsF()); |
| 1104 } | 1107 } |
| 1105 } | 1108 } |
| 1106 } | 1109 } |
| 1107 | 1110 |
| 1108 if (result.is_null()) isolate->ReportPendingMessages(); | 1111 if (result.is_null()) isolate->ReportPendingMessages(); |
| 1109 } else if (result->ic_age() != isolate->heap()->global_ic_age()) { | 1112 } else if (result->ic_age() != isolate->heap()->global_ic_age()) { |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1425 AllowHandleDereference allow_deref; | 1428 AllowHandleDereference allow_deref; |
| 1426 bool tracing_on = info()->IsStub() | 1429 bool tracing_on = info()->IsStub() |
| 1427 ? FLAG_trace_hydrogen_stubs | 1430 ? FLAG_trace_hydrogen_stubs |
| 1428 : (FLAG_trace_hydrogen && | 1431 : (FLAG_trace_hydrogen && |
| 1429 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); | 1432 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); |
| 1430 return (tracing_on && | 1433 return (tracing_on && |
| 1431 base::OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); | 1434 base::OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); |
| 1432 } | 1435 } |
| 1433 | 1436 |
| 1434 } } // namespace v8::internal | 1437 } } // namespace v8::internal |
| OLD | NEW |