| 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( |
| 12411 "\n" |
| 12412 "----------------------------------------" |
| 12413 "----------------------------------------\n" |
| 12414 "--- %s timing results:\n" |
| 12415 "----------------------------------------" |
| 12416 "----------------------------------------\n", |
| 12417 stats_name); |
| 12411 base::TimeDelta sum; | 12418 base::TimeDelta sum; |
| 12412 for (int i = 0; i < times_.length(); ++i) { | 12419 for (int i = 0; i < times_.length(); ++i) { |
| 12413 sum += times_[i]; | 12420 sum += times_[i]; |
| 12414 } | 12421 } |
| 12415 | 12422 |
| 12416 for (int i = 0; i < names_.length(); ++i) { | 12423 for (int i = 0; i < names_.length(); ++i) { |
| 12417 PrintF("%32s", names_[i]); | 12424 PrintF("%33s", names_[i]); |
| 12418 double ms = times_[i].InMillisecondsF(); | 12425 double ms = times_[i].InMillisecondsF(); |
| 12419 double percent = times_[i].PercentOf(sum); | 12426 double percent = times_[i].PercentOf(sum); |
| 12420 PrintF(" %8.3f ms / %4.1f %% ", ms, percent); | 12427 PrintF(" %8.3f ms / %4.1f %% ", ms, percent); |
| 12421 | 12428 |
| 12422 unsigned size = sizes_[i]; | 12429 unsigned size = sizes_[i]; |
| 12423 double size_percent = static_cast<double>(size) * 100 / total_size_; | 12430 double size_percent = static_cast<double>(size) * 100 / total_size_; |
| 12424 PrintF(" %9u bytes / %4.1f %%\n", size, size_percent); | 12431 PrintF(" %9u bytes / %4.1f %%\n", size, size_percent); |
| 12425 } | 12432 } |
| 12426 | 12433 |
| 12427 PrintF("----------------------------------------" | 12434 PrintF( |
| 12428 "---------------------------------------\n"); | 12435 "----------------------------------------" |
| 12436 "----------------------------------------\n"); |
| 12429 base::TimeDelta total = create_graph_ + optimize_graph_ + generate_code_; | 12437 base::TimeDelta total = create_graph_ + optimize_graph_ + generate_code_; |
| 12430 PrintF("%32s %8.3f ms / %4.1f %% \n", | 12438 PrintF("%33s %8.3f ms / %4.1f %% \n", "Create graph", |
| 12431 "Create graph", | 12439 create_graph_.InMillisecondsF(), create_graph_.PercentOf(total)); |
| 12432 create_graph_.InMillisecondsF(), | 12440 PrintF("%33s %8.3f ms / %4.1f %% \n", "Optimize graph", |
| 12433 create_graph_.PercentOf(total)); | 12441 optimize_graph_.InMillisecondsF(), optimize_graph_.PercentOf(total)); |
| 12434 PrintF("%32s %8.3f ms / %4.1f %% \n", | 12442 PrintF("%33s %8.3f ms / %4.1f %% \n", "Generate and install code", |
| 12435 "Optimize graph", | 12443 generate_code_.InMillisecondsF(), generate_code_.PercentOf(total)); |
| 12436 optimize_graph_.InMillisecondsF(), | 12444 PrintF( |
| 12437 optimize_graph_.PercentOf(total)); | 12445 "----------------------------------------" |
| 12438 PrintF("%32s %8.3f ms / %4.1f %% \n", | 12446 "----------------------------------------\n"); |
| 12439 "Generate and install code", | 12447 PrintF("%33s %8.3f ms %9u bytes\n", "Total", |
| 12440 generate_code_.InMillisecondsF(), | 12448 total.InMillisecondsF(), total_size_); |
| 12441 generate_code_.PercentOf(total)); | 12449 PrintF("%33s (%.1f times slower than full code gen)\n", "", |
| 12442 PrintF("----------------------------------------" | |
| 12443 "---------------------------------------\n"); | |
| 12444 PrintF("%32s %8.3f ms (%.1f times slower than full code gen)\n", | |
| 12445 "Total", | |
| 12446 total.InMillisecondsF(), | |
| 12447 total.TimesOf(full_code_gen_)); | 12450 total.TimesOf(full_code_gen_)); |
| 12448 | 12451 |
| 12449 double source_size_in_kb = static_cast<double>(source_size_) / 1024; | 12452 double source_size_in_kb = static_cast<double>(source_size_) / 1024; |
| 12450 double normalized_time = source_size_in_kb > 0 | 12453 double normalized_time = source_size_in_kb > 0 |
| 12451 ? total.InMillisecondsF() / source_size_in_kb | 12454 ? total.InMillisecondsF() / source_size_in_kb |
| 12452 : 0; | 12455 : 0; |
| 12453 double normalized_size_in_kb = source_size_in_kb > 0 | 12456 double normalized_size_in_kb = source_size_in_kb > 0 |
| 12454 ? total_size_ / 1024 / source_size_in_kb | 12457 ? total_size_ / 1024 / source_size_in_kb |
| 12455 : 0; | 12458 : 0; |
| 12456 PrintF("%32s %8.3f ms %7.3f kB allocated\n", | 12459 PrintF("%33s %8.3f ms %7.3f kB allocated\n", |
| 12457 "Average per kB source", | 12460 "Average per kB source", normalized_time, normalized_size_in_kb); |
| 12458 normalized_time, normalized_size_in_kb); | |
| 12459 } | 12461 } |
| 12460 | 12462 |
| 12461 | 12463 |
| 12462 void HStatistics::SaveTiming(const char* name, base::TimeDelta time, | 12464 void HStatistics::SaveTiming(const char* name, base::TimeDelta time, |
| 12463 unsigned size) { | 12465 unsigned size) { |
| 12464 total_size_ += size; | 12466 total_size_ += size; |
| 12465 for (int i = 0; i < names_.length(); ++i) { | 12467 for (int i = 0; i < names_.length(); ++i) { |
| 12466 if (strcmp(names_[i], name) == 0) { | 12468 if (strcmp(names_[i], name) == 0) { |
| 12467 times_[i] += time; | 12469 times_[i] += time; |
| 12468 sizes_[i] += size; | 12470 sizes_[i] += size; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 12479 if (ShouldProduceTraceOutput()) { | 12481 if (ShouldProduceTraceOutput()) { |
| 12480 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 12482 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
| 12481 } | 12483 } |
| 12482 | 12484 |
| 12483 #ifdef DEBUG | 12485 #ifdef DEBUG |
| 12484 graph_->Verify(false); // No full verify. | 12486 graph_->Verify(false); // No full verify. |
| 12485 #endif | 12487 #endif |
| 12486 } | 12488 } |
| 12487 | 12489 |
| 12488 } } // namespace v8::internal | 12490 } } // namespace v8::internal |
| OLD | NEW |