// 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
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")
HGraph* HGraphBuilder::CreateGraph() {
graph_ = new HGraph(info());
+ if (FLAG_hydrogen_stats) HStatistics::Instance()->Initialize(info());
+
{
HPhase phase("Block building");
current_block_ = graph()->entry_block();
}
+void HStatistics::Initialize(CompilationInfo* info) {
+ source_size_ += info->shared_info()->SourceSize();
+}
+
+
void HStatistics::Print() {
PrintF("Timing results:\n");
int64_t sum = 0;
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",
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);
class HStatistics: public Malloced {
public:
+ void Initialize(CompilationInfo* info);
void Print();
void SaveTiming(const char* name, int64_t ticks, unsigned size);
static HStatistics* Instance() {
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_;
int64_t total_;
unsigned total_size_;
int64_t full_code_gen_;
+ double source_size_;
};