Revision: 7128
Author: [email protected]
Date: Thu Mar 10 05:26:51 2011
Log: Normalize statistics about compilation time and allocation size.
Now we print compilation time and zone allocation per KB of compiled
source code to better compare with previous revisions.
Review URL: http://codereview.chromium.org/6646015
http://code.google.com/p/v8/source/detail?r=7128
Modified:
/branches/bleeding_edge/src/compiler.cc
/branches/bleeding_edge/src/flag-definitions.h
/branches/bleeding_edge/src/hydrogen.cc
/branches/bleeding_edge/src/hydrogen.h
/branches/bleeding_edge/src/v8.cc
=======================================
--- /branches/bleeding_edge/src/compiler.cc Mon Mar 7 03:52:36 2011
+++ /branches/bleeding_edge/src/compiler.cc Thu Mar 10 05:26:51 2011
@@ -248,7 +248,7 @@
// performance of the hydrogen-based compiler.
int64_t start = OS::Ticks();
bool should_recompile
= !info->shared_info()->has_deoptimization_support();
- if (should_recompile || FLAG_time_hydrogen) {
+ if (should_recompile || FLAG_hydrogen_stats) {
HPhase phase(HPhase::kFullCodeGen);
CompilationInfo unoptimized(info->shared_info());
// Note that we use the same AST that we will use for generating the
=======================================
--- /branches/bleeding_edge/src/flag-definitions.h Thu Mar 3 00:43:55 2011
+++ /branches/bleeding_edge/src/flag-definitions.h Thu Mar 10 05:26:51 2011
@@ -111,7 +111,7 @@
DEFINE_bool(limit_inlining, true, "limit code size growth from inlining")
DEFINE_bool(eliminate_empty_blocks, true, "eliminate empty blocks")
DEFINE_bool(loop_invariant_code_motion, true, "loop invariant code motion")
-DEFINE_bool(time_hydrogen, false, "timing for hydrogen")
+DEFINE_bool(hydrogen_stats, false, "print statistics for hydrogen")
DEFINE_bool(trace_hydrogen, false, "trace generated hydrogen to file")
DEFINE_bool(trace_inlining, false, "trace inlining decisions")
DEFINE_bool(trace_alloc, false, "trace register allocator")
=======================================
--- /branches/bleeding_edge/src/hydrogen.cc Thu Mar 10 03:54:55 2011
+++ /branches/bleeding_edge/src/hydrogen.cc Thu Mar 10 05:26:51 2011
@@ -2134,6 +2134,8 @@
HGraph* HGraphBuilder::CreateGraph() {
graph_ = new HGraph(info());
+ if (FLAG_hydrogen_stats) HStatistics::Instance()->Initialize(info());
+
{
HPhase phase("Block building");
current_block_ = graph()->entry_block();
@@ -5808,6 +5810,11 @@
AppendChars(filename_, *trace_.ToCString(), trace_.length(), false);
trace_.Reset();
}
+
+
+void HStatistics::Initialize(CompilationInfo* info) {
+ source_size_ += info->shared_info()->SourceSize();
+}
void HStatistics::Print() {
@@ -5827,9 +5834,10 @@
double size_percent = static_cast<double>(size) * 100 / total_size_;
PrintF(" %8u bytes / %4.1f %%\n", size, size_percent);
}
- PrintF("%30s - %7.3f ms %8u bytes\n", "Sum",
- static_cast<double>(sum) / 1000,
- total_size_);
+ double source_size_in_kb = static_cast<double>(source_size_) / 1024;
+ PrintF("%30s - %7.3f ms %7.3f bytes\n", "Sum",
+ (static_cast<double>(sum) / 1000) / source_size_in_kb,
+ total_size_ / source_size_in_kb);
PrintF("---------------------------------------------------------------\n");
PrintF("%30s - %7.3f ms (%.1f times slower than full code gen)\n",
"Total",
@@ -5874,13 +5882,13 @@
if (allocator != NULL && chunk_ == NULL) {
chunk_ = allocator->chunk();
}
- if (FLAG_time_hydrogen) start_ = OS::Ticks();
+ if (FLAG_hydrogen_stats) start_ = OS::Ticks();
start_allocation_size_ = Zone::allocation_size_;
}
void HPhase::End() const {
- if (FLAG_time_hydrogen) {
+ if (FLAG_hydrogen_stats) {
int64_t end = OS::Ticks();
unsigned size = Zone::allocation_size_ - start_allocation_size_;
HStatistics::Instance()->SaveTiming(name_, end - start_, size);
=======================================
--- /branches/bleeding_edge/src/hydrogen.h Wed Mar 9 07:50:24 2011
+++ /branches/bleeding_edge/src/hydrogen.h Thu Mar 10 05:26:51 2011
@@ -939,6 +939,7 @@
class HStatistics: public Malloced {
public:
+ void Initialize(CompilationInfo* info);
void Print();
void SaveTiming(const char* name, int64_t ticks, unsigned size);
static HStatistics* Instance() {
@@ -957,7 +958,8 @@
sizes_(5),
total_(0),
total_size_(0),
- full_code_gen_(0) { }
+ full_code_gen_(0),
+ source_size_(0) { }
List<int64_t> timing_;
List<const char*> names_;
@@ -965,6 +967,7 @@
int64_t total_;
unsigned total_size_;
int64_t full_code_gen_;
+ double source_size_;
};
=======================================
--- /branches/bleeding_edge/src/v8.cc Wed Feb 23 02:41:13 2011
+++ /branches/bleeding_edge/src/v8.cc Thu Mar 10 05:26:51 2011
@@ -158,7 +158,7 @@
void V8::TearDown() {
if (!has_been_setup_ || has_been_disposed_) return;
- if (FLAG_time_hydrogen) HStatistics::Instance()->Print();
+ if (FLAG_hydrogen_stats) HStatistics::Instance()->Print();
// We must stop the logger before we tear down other components.
Logger::EnsureTickerStopped();
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev