Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(67)

Side by Side Diff: src/hydrogen.cc

Issue 6646015: Normalize statistics about compilation time and allocation size.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/hydrogen.h ('k') | src/v8.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 2116 matching lines...) Expand 10 before | Expand all | Expand 10 after
2127 2127
2128 void HGraphBuilder::VisitExpressions(ZoneList<Expression*>* exprs) { 2128 void HGraphBuilder::VisitExpressions(ZoneList<Expression*>* exprs) {
2129 for (int i = 0; i < exprs->length(); ++i) { 2129 for (int i = 0; i < exprs->length(); ++i) {
2130 VISIT_FOR_VALUE(exprs->at(i)); 2130 VISIT_FOR_VALUE(exprs->at(i));
2131 } 2131 }
2132 } 2132 }
2133 2133
2134 2134
2135 HGraph* HGraphBuilder::CreateGraph() { 2135 HGraph* HGraphBuilder::CreateGraph() {
2136 graph_ = new HGraph(info()); 2136 graph_ = new HGraph(info());
2137 if (FLAG_hydrogen_stats) HStatistics::Instance()->Initialize(info());
2138
2137 { 2139 {
2138 HPhase phase("Block building"); 2140 HPhase phase("Block building");
2139 current_block_ = graph()->entry_block(); 2141 current_block_ = graph()->entry_block();
2140 2142
2141 Scope* scope = info()->scope(); 2143 Scope* scope = info()->scope();
2142 if (scope->HasIllegalRedeclaration()) { 2144 if (scope->HasIllegalRedeclaration()) {
2143 Bailout("function with illegal redeclaration"); 2145 Bailout("function with illegal redeclaration");
2144 return NULL; 2146 return NULL;
2145 } 2147 }
2146 SetupScope(scope); 2148 SetupScope(scope);
(...skipping 3656 matching lines...) Expand 10 before | Expand all | Expand 10 after
5803 } 5805 }
5804 } 5806 }
5805 5807
5806 5808
5807 void HTracer::FlushToFile() { 5809 void HTracer::FlushToFile() {
5808 AppendChars(filename_, *trace_.ToCString(), trace_.length(), false); 5810 AppendChars(filename_, *trace_.ToCString(), trace_.length(), false);
5809 trace_.Reset(); 5811 trace_.Reset();
5810 } 5812 }
5811 5813
5812 5814
5815 void HStatistics::Initialize(CompilationInfo* info) {
5816 source_size_ += info->shared_info()->SourceSize();
5817 }
5818
5819
5813 void HStatistics::Print() { 5820 void HStatistics::Print() {
5814 PrintF("Timing results:\n"); 5821 PrintF("Timing results:\n");
5815 int64_t sum = 0; 5822 int64_t sum = 0;
5816 for (int i = 0; i < timing_.length(); ++i) { 5823 for (int i = 0; i < timing_.length(); ++i) {
5817 sum += timing_[i]; 5824 sum += timing_[i];
5818 } 5825 }
5819 5826
5820 for (int i = 0; i < names_.length(); ++i) { 5827 for (int i = 0; i < names_.length(); ++i) {
5821 PrintF("%30s", names_[i]); 5828 PrintF("%30s", names_[i]);
5822 double ms = static_cast<double>(timing_[i]) / 1000; 5829 double ms = static_cast<double>(timing_[i]) / 1000;
5823 double percent = static_cast<double>(timing_[i]) * 100 / sum; 5830 double percent = static_cast<double>(timing_[i]) * 100 / sum;
5824 PrintF(" - %7.3f ms / %4.1f %% ", ms, percent); 5831 PrintF(" - %7.3f ms / %4.1f %% ", ms, percent);
5825 5832
5826 unsigned size = sizes_[i]; 5833 unsigned size = sizes_[i];
5827 double size_percent = static_cast<double>(size) * 100 / total_size_; 5834 double size_percent = static_cast<double>(size) * 100 / total_size_;
5828 PrintF(" %8u bytes / %4.1f %%\n", size, size_percent); 5835 PrintF(" %8u bytes / %4.1f %%\n", size, size_percent);
5829 } 5836 }
5830 PrintF("%30s - %7.3f ms %8u bytes\n", "Sum", 5837 double source_size_in_kb = static_cast<double>(source_size_) / 1024;
5831 static_cast<double>(sum) / 1000, 5838 PrintF("%30s - %7.3f ms %7.3f bytes\n", "Sum",
5832 total_size_); 5839 (static_cast<double>(sum) / 1000) / source_size_in_kb,
5840 total_size_ / source_size_in_kb);
5833 PrintF("---------------------------------------------------------------\n"); 5841 PrintF("---------------------------------------------------------------\n");
5834 PrintF("%30s - %7.3f ms (%.1f times slower than full code gen)\n", 5842 PrintF("%30s - %7.3f ms (%.1f times slower than full code gen)\n",
5835 "Total", 5843 "Total",
5836 static_cast<double>(total_) / 1000, 5844 static_cast<double>(total_) / 1000,
5837 static_cast<double>(total_) / full_code_gen_); 5845 static_cast<double>(total_) / full_code_gen_);
5838 } 5846 }
5839 5847
5840 5848
5841 void HStatistics::SaveTiming(const char* name, int64_t ticks, unsigned size) { 5849 void HStatistics::SaveTiming(const char* name, int64_t ticks, unsigned size) {
5842 if (name == HPhase::kFullCodeGen) { 5850 if (name == HPhase::kFullCodeGen) {
(...skipping 24 matching lines...) Expand all
5867 HGraph* graph, 5875 HGraph* graph,
5868 LChunk* chunk, 5876 LChunk* chunk,
5869 LAllocator* allocator) { 5877 LAllocator* allocator) {
5870 name_ = name; 5878 name_ = name;
5871 graph_ = graph; 5879 graph_ = graph;
5872 chunk_ = chunk; 5880 chunk_ = chunk;
5873 allocator_ = allocator; 5881 allocator_ = allocator;
5874 if (allocator != NULL && chunk_ == NULL) { 5882 if (allocator != NULL && chunk_ == NULL) {
5875 chunk_ = allocator->chunk(); 5883 chunk_ = allocator->chunk();
5876 } 5884 }
5877 if (FLAG_time_hydrogen) start_ = OS::Ticks(); 5885 if (FLAG_hydrogen_stats) start_ = OS::Ticks();
5878 start_allocation_size_ = Zone::allocation_size_; 5886 start_allocation_size_ = Zone::allocation_size_;
5879 } 5887 }
5880 5888
5881 5889
5882 void HPhase::End() const { 5890 void HPhase::End() const {
5883 if (FLAG_time_hydrogen) { 5891 if (FLAG_hydrogen_stats) {
5884 int64_t end = OS::Ticks(); 5892 int64_t end = OS::Ticks();
5885 unsigned size = Zone::allocation_size_ - start_allocation_size_; 5893 unsigned size = Zone::allocation_size_ - start_allocation_size_;
5886 HStatistics::Instance()->SaveTiming(name_, end - start_, size); 5894 HStatistics::Instance()->SaveTiming(name_, end - start_, size);
5887 } 5895 }
5888 5896
5889 if (FLAG_trace_hydrogen) { 5897 if (FLAG_trace_hydrogen) {
5890 if (graph_ != NULL) HTracer::Instance()->TraceHydrogen(name_, graph_); 5898 if (graph_ != NULL) HTracer::Instance()->TraceHydrogen(name_, graph_);
5891 if (chunk_ != NULL) HTracer::Instance()->TraceLithium(name_, chunk_); 5899 if (chunk_ != NULL) HTracer::Instance()->TraceLithium(name_, chunk_);
5892 if (allocator_ != NULL) { 5900 if (allocator_ != NULL) {
5893 HTracer::Instance()->TraceLiveRanges(name_, allocator_); 5901 HTracer::Instance()->TraceLiveRanges(name_, allocator_);
5894 } 5902 }
5895 } 5903 }
5896 5904
5897 #ifdef DEBUG 5905 #ifdef DEBUG
5898 if (graph_ != NULL) graph_->Verify(); 5906 if (graph_ != NULL) graph_->Verify();
5899 if (allocator_ != NULL) allocator_->Verify(); 5907 if (allocator_ != NULL) allocator_->Verify();
5900 #endif 5908 #endif
5901 } 5909 }
5902 5910
5903 } } // namespace v8::internal 5911 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen.h ('k') | src/v8.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698