OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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/hydrogen.h" | 5 #include "src/hydrogen.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "src/v8.h" | 9 #include "src/v8.h" |
10 | 10 |
(...skipping 12388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12399 trace_.Reset(); | 12399 trace_.Reset(); |
12400 } | 12400 } |
12401 | 12401 |
12402 | 12402 |
12403 void HStatistics::Initialize(CompilationInfo* info) { | 12403 void HStatistics::Initialize(CompilationInfo* info) { |
12404 if (info->shared_info().is_null()) return; | 12404 if (info->shared_info().is_null()) return; |
12405 source_size_ += info->shared_info()->SourceSize(); | 12405 source_size_ += info->shared_info()->SourceSize(); |
12406 } | 12406 } |
12407 | 12407 |
12408 | 12408 |
12409 void HStatistics::Print() { | 12409 void HStatistics::Print(const char* stats_name) { |
12410 PrintF("Timing results:\n"); | 12410 PrintF("\n" |
| 12411 "----------------------------------------" |
| 12412 "----------------------------------------\n" |
| 12413 "--- %s timing results:\n" |
| 12414 "----------------------------------------" |
| 12415 "----------------------------------------\n", stats_name); |
12411 base::TimeDelta sum; | 12416 base::TimeDelta sum; |
12412 for (int i = 0; i < times_.length(); ++i) { | 12417 for (int i = 0; i < times_.length(); ++i) { |
12413 sum += times_[i]; | 12418 sum += times_[i]; |
12414 } | 12419 } |
12415 | 12420 |
12416 for (int i = 0; i < names_.length(); ++i) { | 12421 for (int i = 0; i < names_.length(); ++i) { |
12417 PrintF("%32s", names_[i]); | 12422 PrintF("%33s", names_[i]); |
12418 double ms = times_[i].InMillisecondsF(); | 12423 double ms = times_[i].InMillisecondsF(); |
12419 double percent = times_[i].PercentOf(sum); | 12424 double percent = times_[i].PercentOf(sum); |
12420 PrintF(" %8.3f ms / %4.1f %% ", ms, percent); | 12425 PrintF(" %8.3f ms / %4.1f %% ", ms, percent); |
12421 | 12426 |
12422 unsigned size = sizes_[i]; | 12427 unsigned size = sizes_[i]; |
12423 double size_percent = static_cast<double>(size) * 100 / total_size_; | 12428 double size_percent = static_cast<double>(size) * 100 / total_size_; |
12424 PrintF(" %9u bytes / %4.1f %%\n", size, size_percent); | 12429 PrintF(" %9u bytes / %4.1f %%\n", size, size_percent); |
12425 } | 12430 } |
12426 | 12431 |
12427 PrintF("----------------------------------------" | 12432 PrintF("----------------------------------------" |
12428 "---------------------------------------\n"); | 12433 "----------------------------------------\n"); |
12429 base::TimeDelta total = create_graph_ + optimize_graph_ + generate_code_; | 12434 base::TimeDelta total = create_graph_ + optimize_graph_ + generate_code_; |
12430 PrintF("%32s %8.3f ms / %4.1f %% \n", | 12435 PrintF("%33s %8.3f ms / %4.1f %% \n", |
12431 "Create graph", | 12436 "Create graph", |
12432 create_graph_.InMillisecondsF(), | 12437 create_graph_.InMillisecondsF(), |
12433 create_graph_.PercentOf(total)); | 12438 create_graph_.PercentOf(total)); |
12434 PrintF("%32s %8.3f ms / %4.1f %% \n", | 12439 PrintF("%33s %8.3f ms / %4.1f %% \n", |
12435 "Optimize graph", | 12440 "Optimize graph", |
12436 optimize_graph_.InMillisecondsF(), | 12441 optimize_graph_.InMillisecondsF(), |
12437 optimize_graph_.PercentOf(total)); | 12442 optimize_graph_.PercentOf(total)); |
12438 PrintF("%32s %8.3f ms / %4.1f %% \n", | 12443 PrintF("%33s %8.3f ms / %4.1f %% \n", |
12439 "Generate and install code", | 12444 "Generate and install code", |
12440 generate_code_.InMillisecondsF(), | 12445 generate_code_.InMillisecondsF(), |
12441 generate_code_.PercentOf(total)); | 12446 generate_code_.PercentOf(total)); |
12442 PrintF("----------------------------------------" | 12447 PrintF("----------------------------------------" |
12443 "---------------------------------------\n"); | 12448 "----------------------------------------\n"); |
12444 PrintF("%32s %8.3f ms (%.1f times slower than full code gen)\n", | 12449 PrintF("%33s %8.3f ms %9u bytes\n", |
12445 "Total", | 12450 "Total", |
12446 total.InMillisecondsF(), | 12451 total.InMillisecondsF(), |
| 12452 total_size_); |
| 12453 PrintF("%33s (%.1f times slower than full code gen)\n", |
| 12454 "", |
12447 total.TimesOf(full_code_gen_)); | 12455 total.TimesOf(full_code_gen_)); |
12448 | 12456 |
12449 double source_size_in_kb = static_cast<double>(source_size_) / 1024; | 12457 double source_size_in_kb = static_cast<double>(source_size_) / 1024; |
12450 double normalized_time = source_size_in_kb > 0 | 12458 double normalized_time = source_size_in_kb > 0 |
12451 ? total.InMillisecondsF() / source_size_in_kb | 12459 ? total.InMillisecondsF() / source_size_in_kb |
12452 : 0; | 12460 : 0; |
12453 double normalized_size_in_kb = source_size_in_kb > 0 | 12461 double normalized_size_in_kb = source_size_in_kb > 0 |
12454 ? total_size_ / 1024 / source_size_in_kb | 12462 ? total_size_ / 1024 / source_size_in_kb |
12455 : 0; | 12463 : 0; |
12456 PrintF("%32s %8.3f ms %7.3f kB allocated\n", | 12464 PrintF("%33s %8.3f ms %7.3f kB allocated\n", |
12457 "Average per kB source", | 12465 "Average per kB source", |
12458 normalized_time, normalized_size_in_kb); | 12466 normalized_time, normalized_size_in_kb); |
12459 } | 12467 } |
12460 | 12468 |
12461 | 12469 |
12462 void HStatistics::SaveTiming(const char* name, base::TimeDelta time, | 12470 void HStatistics::SaveTiming(const char* name, base::TimeDelta time, |
12463 unsigned size) { | 12471 unsigned size) { |
12464 total_size_ += size; | 12472 total_size_ += size; |
12465 for (int i = 0; i < names_.length(); ++i) { | 12473 for (int i = 0; i < names_.length(); ++i) { |
12466 if (strcmp(names_[i], name) == 0) { | 12474 if (strcmp(names_[i], name) == 0) { |
(...skipping 12 matching lines...) Expand all Loading... |
12479 if (ShouldProduceTraceOutput()) { | 12487 if (ShouldProduceTraceOutput()) { |
12480 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 12488 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
12481 } | 12489 } |
12482 | 12490 |
12483 #ifdef DEBUG | 12491 #ifdef DEBUG |
12484 graph_->Verify(false); // No full verify. | 12492 graph_->Verify(false); // No full verify. |
12485 #endif | 12493 #endif |
12486 } | 12494 } |
12487 | 12495 |
12488 } } // namespace v8::internal | 12496 } } // namespace v8::internal |
OLD | NEW |