From 3481344df8cf6e4e0cbc4463b0cce2458a4b38c8 Mon Sep 17 00:00:00 2001 From: "bmeurer@chromium.org" Date: Mon, 24 Jun 2013 13:25:44 +0000 Subject: [PATCH] Drop (mis)use of HPhase in full code gen. The full code generator is not a proper Hydrogen phase. The full code gen ticks are tracked in a special member of HStatistics, so HPhase is most probably misused at this point. R=danno@chromium.org BUG= Review URL: https://codereview.chromium.org/17590005 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15291 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/compiler.cc | 9 ++++++++- src/hydrogen.cc | 25 +++++++++---------------- src/hydrogen.h | 6 ++++-- 3 files changed, 21 insertions(+), 19 deletions(-) diff --git a/src/compiler.cc b/src/compiler.cc index 7d5fd93..2539f7d 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; + 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 diff --git a/src/hydrogen.cc b/src/hydrogen.cc index 546f02a..ab44e65 100644 --- a/src/hydrogen.cc +++ b/src/hydrogen.cc @@ -11499,27 +11499,20 @@ void HStatistics::Print() { void HStatistics::SaveTiming(const char* name, int64_t ticks, unsigned size) { - if (name == HPhase::kFullCodeGen) { - full_code_gen_ += ticks; - } else { - total_size_ += size; - for (int i = 0; i < names_.length(); ++i) { - if (strcmp(names_[i], name) == 0) { - timing_[i] += ticks; - sizes_[i] += size; - return; - } + total_size_ += size; + for (int i = 0; i < names_.length(); ++i) { + if (strcmp(names_[i], name) == 0) { + timing_[i] += ticks; + sizes_[i] += size; + return; } - names_.Add(name); - timing_.Add(ticks); - sizes_.Add(size); } + names_.Add(name); + timing_.Add(ticks); + sizes_.Add(size); } -const char* const HPhase::kFullCodeGen = "Full code generator"; - - HPhase::HPhase(const char* name, Isolate* isolate, Zone* zone) { Init(isolate, name, zone, NULL, NULL, NULL); } diff --git a/src/hydrogen.h b/src/hydrogen.h index 6a49e57..3a0ded5 100644 --- a/src/hydrogen.h +++ b/src/hydrogen.h @@ -1923,6 +1923,10 @@ class HStatistics: public Malloced { void Print(); void SaveTiming(const char* name, int64_t ticks, unsigned size); + void IncrementFullCodeGen(int64_t full_code_gen) { + full_code_gen_ += full_code_gen; + } + void IncrementSubtotals(int64_t create_graph, int64_t optimize_graph, int64_t generate_code) { @@ -1946,8 +1950,6 @@ class HStatistics: public Malloced { class HPhase BASE_EMBEDDED { public: - static const char* const kFullCodeGen; - HPhase(const char* name, Isolate* isolate, Zone* zone); HPhase(const char* name, HGraph* graph); HPhase(const char* name, LChunk* chunk); -- 2.7.4