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/ast-numbering.h" | 9 #include "src/ast-numbering.h" |
10 #include "src/ast-this-access-visitor.h" | 10 #include "src/ast-this-access-visitor.h" |
(...skipping 1275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1286 int source_length = source->length(); | 1286 int source_length = source->length(); |
1287 isolate->counters()->total_load_size()->Increment(source_length); | 1287 isolate->counters()->total_load_size()->Increment(source_length); |
1288 isolate->counters()->total_compile_size()->Increment(source_length); | 1288 isolate->counters()->total_compile_size()->Increment(source_length); |
1289 | 1289 |
1290 CompilationCache* compilation_cache = isolate->compilation_cache(); | 1290 CompilationCache* compilation_cache = isolate->compilation_cache(); |
1291 | 1291 |
1292 // Do a lookup in the compilation cache but not for extensions. | 1292 // Do a lookup in the compilation cache but not for extensions. |
1293 MaybeHandle<SharedFunctionInfo> maybe_result; | 1293 MaybeHandle<SharedFunctionInfo> maybe_result; |
1294 Handle<SharedFunctionInfo> result; | 1294 Handle<SharedFunctionInfo> result; |
1295 if (extension == NULL) { | 1295 if (extension == NULL) { |
1296 if (FLAG_serialize_toplevel && | 1296 maybe_result = compilation_cache->LookupScript( |
| 1297 source, script_name, line_offset, column_offset, is_shared_cross_origin, |
| 1298 context); |
| 1299 if (maybe_result.is_null() && FLAG_serialize_toplevel && |
1297 compile_options == ScriptCompiler::kConsumeCodeCache && | 1300 compile_options == ScriptCompiler::kConsumeCodeCache && |
1298 !isolate->debug()->is_loaded()) { | 1301 !isolate->debug()->is_loaded()) { |
1299 HistogramTimerScope timer(isolate->counters()->compile_deserialize()); | 1302 HistogramTimerScope timer(isolate->counters()->compile_deserialize()); |
1300 Handle<SharedFunctionInfo> result; | 1303 Handle<SharedFunctionInfo> result; |
1301 if (CodeSerializer::Deserialize(isolate, *cached_data, source) | 1304 if (CodeSerializer::Deserialize(isolate, *cached_data, source) |
1302 .ToHandle(&result)) { | 1305 .ToHandle(&result)) { |
1303 return result; | 1306 return result; |
1304 } | 1307 } |
1305 // Deserializer failed. Fall through to compile. | 1308 // Deserializer failed. Fall through to compile. |
1306 } else { | |
1307 maybe_result = compilation_cache->LookupScript( | |
1308 source, script_name, line_offset, column_offset, | |
1309 is_shared_cross_origin, context); | |
1310 } | 1309 } |
1311 } | 1310 } |
1312 | 1311 |
1313 base::ElapsedTimer timer; | 1312 base::ElapsedTimer timer; |
1314 if (FLAG_profile_deserialization && FLAG_serialize_toplevel && | 1313 if (FLAG_profile_deserialization && FLAG_serialize_toplevel && |
1315 compile_options == ScriptCompiler::kProduceCodeCache) { | 1314 compile_options == ScriptCompiler::kProduceCodeCache) { |
1316 timer.Start(); | 1315 timer.Start(); |
1317 } | 1316 } |
1318 | 1317 |
1319 if (!maybe_result.ToHandle(&result)) { | 1318 if (!maybe_result.ToHandle(&result)) { |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1584 AllowHandleDereference allow_deref; | 1583 AllowHandleDereference allow_deref; |
1585 bool tracing_on = info()->IsStub() | 1584 bool tracing_on = info()->IsStub() |
1586 ? FLAG_trace_hydrogen_stubs | 1585 ? FLAG_trace_hydrogen_stubs |
1587 : (FLAG_trace_hydrogen && | 1586 : (FLAG_trace_hydrogen && |
1588 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); | 1587 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); |
1589 return (tracing_on && | 1588 return (tracing_on && |
1590 base::OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); | 1589 base::OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); |
1591 } | 1590 } |
1592 | 1591 |
1593 } } // namespace v8::internal | 1592 } } // namespace v8::internal |
OLD | NEW |