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 <sstream> | 7 #include <sstream> |
8 | 8 |
9 #include "src/v8.h" | 9 #include "src/v8.h" |
10 | 10 |
(...skipping 13434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13445 for (int i = 0; i < times_.length(); ++i) { | 13445 for (int i = 0; i < times_.length(); ++i) { |
13446 sum += times_[i]; | 13446 sum += times_[i]; |
13447 } | 13447 } |
13448 | 13448 |
13449 for (int i = 0; i < names_.length(); ++i) { | 13449 for (int i = 0; i < names_.length(); ++i) { |
13450 PrintF("%33s", names_[i]); | 13450 PrintF("%33s", names_[i]); |
13451 double ms = times_[i].InMillisecondsF(); | 13451 double ms = times_[i].InMillisecondsF(); |
13452 double percent = times_[i].PercentOf(sum); | 13452 double percent = times_[i].PercentOf(sum); |
13453 PrintF(" %8.3f ms / %4.1f %% ", ms, percent); | 13453 PrintF(" %8.3f ms / %4.1f %% ", ms, percent); |
13454 | 13454 |
13455 unsigned size = sizes_[i]; | 13455 size_t size = sizes_[i]; |
13456 double size_percent = static_cast<double>(size) * 100 / total_size_; | 13456 double size_percent = static_cast<double>(size) * 100 / total_size_; |
13457 PrintF(" %9u bytes / %4.1f %%\n", size, size_percent); | 13457 PrintF(" %9zu bytes / %4.1f %%\n", size, size_percent); |
13458 } | 13458 } |
13459 | 13459 |
13460 PrintF( | 13460 PrintF( |
13461 "----------------------------------------" | 13461 "----------------------------------------" |
13462 "----------------------------------------\n"); | 13462 "----------------------------------------\n"); |
13463 base::TimeDelta total = create_graph_ + optimize_graph_ + generate_code_; | 13463 base::TimeDelta total = create_graph_ + optimize_graph_ + generate_code_; |
13464 PrintF("%33s %8.3f ms / %4.1f %% \n", "Create graph", | 13464 PrintF("%33s %8.3f ms / %4.1f %% \n", "Create graph", |
13465 create_graph_.InMillisecondsF(), create_graph_.PercentOf(total)); | 13465 create_graph_.InMillisecondsF(), create_graph_.PercentOf(total)); |
13466 PrintF("%33s %8.3f ms / %4.1f %% \n", "Optimize graph", | 13466 PrintF("%33s %8.3f ms / %4.1f %% \n", "Optimize graph", |
13467 optimize_graph_.InMillisecondsF(), optimize_graph_.PercentOf(total)); | 13467 optimize_graph_.InMillisecondsF(), optimize_graph_.PercentOf(total)); |
13468 PrintF("%33s %8.3f ms / %4.1f %% \n", "Generate and install code", | 13468 PrintF("%33s %8.3f ms / %4.1f %% \n", "Generate and install code", |
13469 generate_code_.InMillisecondsF(), generate_code_.PercentOf(total)); | 13469 generate_code_.InMillisecondsF(), generate_code_.PercentOf(total)); |
13470 PrintF( | 13470 PrintF( |
13471 "----------------------------------------" | 13471 "----------------------------------------" |
13472 "----------------------------------------\n"); | 13472 "----------------------------------------\n"); |
13473 PrintF("%33s %8.3f ms %9u bytes\n", "Total", | 13473 PrintF("%33s %8.3f ms %9zu bytes\n", "Total", |
13474 total.InMillisecondsF(), total_size_); | 13474 total.InMillisecondsF(), total_size_); |
13475 PrintF("%33s (%.1f times slower than full code gen)\n", "", | 13475 PrintF("%33s (%.1f times slower than full code gen)\n", "", |
13476 total.TimesOf(full_code_gen_)); | 13476 total.TimesOf(full_code_gen_)); |
13477 | 13477 |
13478 double source_size_in_kb = static_cast<double>(source_size_) / 1024; | 13478 double source_size_in_kb = static_cast<double>(source_size_) / 1024; |
13479 double normalized_time = source_size_in_kb > 0 | 13479 double normalized_time = source_size_in_kb > 0 |
13480 ? total.InMillisecondsF() / source_size_in_kb | 13480 ? total.InMillisecondsF() / source_size_in_kb |
13481 : 0; | 13481 : 0; |
13482 double normalized_size_in_kb = | 13482 double normalized_size_in_kb = |
13483 source_size_in_kb > 0 | 13483 source_size_in_kb > 0 |
13484 ? static_cast<double>(total_size_) / 1024 / source_size_in_kb | 13484 ? static_cast<double>(total_size_) / 1024 / source_size_in_kb |
13485 : 0; | 13485 : 0; |
13486 PrintF("%33s %8.3f ms %7.3f kB allocated\n", | 13486 PrintF("%33s %8.3f ms %7.3f kB allocated\n", |
13487 "Average per kB source", normalized_time, normalized_size_in_kb); | 13487 "Average per kB source", normalized_time, normalized_size_in_kb); |
13488 } | 13488 } |
13489 | 13489 |
13490 | 13490 |
13491 void HStatistics::SaveTiming(const char* name, base::TimeDelta time, | 13491 void HStatistics::SaveTiming(const char* name, base::TimeDelta time, |
13492 unsigned size) { | 13492 size_t size) { |
13493 total_size_ += size; | 13493 total_size_ += size; |
13494 for (int i = 0; i < names_.length(); ++i) { | 13494 for (int i = 0; i < names_.length(); ++i) { |
13495 if (strcmp(names_[i], name) == 0) { | 13495 if (strcmp(names_[i], name) == 0) { |
13496 times_[i] += time; | 13496 times_[i] += time; |
13497 sizes_[i] += size; | 13497 sizes_[i] += size; |
13498 return; | 13498 return; |
13499 } | 13499 } |
13500 } | 13500 } |
13501 names_.Add(name); | 13501 names_.Add(name); |
13502 times_.Add(time); | 13502 times_.Add(time); |
13503 sizes_.Add(size); | 13503 sizes_.Add(size); |
13504 } | 13504 } |
13505 | 13505 |
13506 | 13506 |
13507 HPhase::~HPhase() { | 13507 HPhase::~HPhase() { |
13508 if (ShouldProduceTraceOutput()) { | 13508 if (ShouldProduceTraceOutput()) { |
13509 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13509 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
13510 } | 13510 } |
13511 | 13511 |
13512 #ifdef DEBUG | 13512 #ifdef DEBUG |
13513 graph_->Verify(false); // No full verify. | 13513 graph_->Verify(false); // No full verify. |
13514 #endif | 13514 #endif |
13515 } | 13515 } |
13516 | 13516 |
13517 } } // namespace v8::internal | 13517 } } // namespace v8::internal |
OLD | NEW |