Index: src/compiler.cc |
diff --git a/src/compiler.cc b/src/compiler.cc |
index 7d5fd930f844de4a632cdfcdae5c0810f925cd14..770ef658534a1774235841fe471dd77ef2512a79 100644 |
--- a/src/compiler.cc |
+++ b/src/compiler.cc |
@@ -367,7 +367,10 @@ OptimizingCompiler::Status OptimizingCompiler::CreateGraph() { |
// performance of the hydrogen-based compiler. |
bool should_recompile = !info()->shared_info()->has_deoptimization_support(); |
if (should_recompile || FLAG_hydrogen_stats) { |
- HPhase phase(HPhase::kFullCodeGen, isolate(), info()->zone()); |
+ int64_t start_ticks = 0; |
danno
2013/06/24 12:21:22
Seems like you have more than one patch in this CL
Benedikt Meurer
2013/06/24 13:04:08
Done.
|
+ if (FLAG_hydrogen_stats) { |
+ start_ticks = OS::Ticks(); |
+ } |
CompilationInfoWithZone unoptimized(info()->shared_info()); |
// Note that we use the same AST that we will use for generating the |
// optimized code. |
@@ -384,6 +387,10 @@ OptimizingCompiler::Status OptimizingCompiler::CreateGraph() { |
Compiler::RecordFunctionCompilation( |
Logger::LAZY_COMPILE_TAG, &unoptimized, shared); |
} |
+ if (FLAG_hydrogen_stats) { |
+ int64_t ticks = OS::Ticks() - start_ticks; |
+ isolate()->GetHStatistics()->IncrementFullCodeGen(ticks); |
+ } |
} |
// Check that the unoptimized, shared code is ready for |
@@ -1206,4 +1213,32 @@ void Compiler::RecordFunctionCompilation(Logger::LogEventsAndTags tag, |
info)); |
} |
+ |
+CompilationPhase::CompilationPhase(const char* name, |
+ Isolate* isolate, |
+ Zone* zone) |
+ : name_(name), isolate_(isolate), zone_(zone) { |
+ if (FLAG_hydrogen_stats) { |
+ start_allocation_size_ = zone->allocation_size(); |
+ start_ticks_ = OS::Ticks(); |
+ } |
+} |
+ |
+ |
+CompilationPhase::~CompilationPhase() { |
+ if (FLAG_hydrogen_stats) { |
+ unsigned size = zone_->allocation_size() - start_allocation_size_; |
+ int64_t ticks = OS::Ticks() - start_ticks_; |
+ isolate_->GetHStatistics()->SaveTiming(name_, ticks, size); |
+ } |
+} |
+ |
+ |
+bool CompilationPhase::ShouldProduceTraceOutput() const { |
+ // Produce trace output if flag is set so that the first letter of the |
+ // phase name matches the command line parameter FLAG_trace_phase. |
+ return (FLAG_trace_hydrogen && |
+ OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); |
+} |
+ |
} } // namespace v8::internal |