Add more detailed timers of the various compilation passes. The

aggregate compilation time timer is the same as it was before.

Review URL: http://codereview.chromium.org/115344

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@1946 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 7bfae7d9
...@@ -161,7 +161,9 @@ Handle<Code> CodeGenerator::MakeCode(FunctionLiteral* flit, ...@@ -161,7 +161,9 @@ Handle<Code> CodeGenerator::MakeCode(FunctionLiteral* flit,
return Handle<Code>::null(); return Handle<Code>::null();
} }
// Allocate and install the code. // Allocate and install the code. Time the rest of this function as
// code creation.
HistogramTimerScope timer(&Counters::code_creation);
CodeDesc desc; CodeDesc desc;
cgen.masm()->GetCode(&desc); cgen.masm()->GetCode(&desc);
ScopeInfo<> sinfo(flit->scope()); ScopeInfo<> sinfo(flit->scope());
......
...@@ -52,12 +52,15 @@ static Handle<Code> MakeCode(FunctionLiteral* literal, ...@@ -52,12 +52,15 @@ static Handle<Code> MakeCode(FunctionLiteral* literal,
return Handle<Code>::null(); return Handle<Code>::null();
} }
// Compute top scope and allocate variables. For lazy compilation {
// the top scope only contains the single lazily compiled function, // Compute top scope and allocate variables. For lazy compilation
// so this doesn't re-allocate variables repeatedly. // the top scope only contains the single lazily compiled function,
Scope* top = literal->scope(); // so this doesn't re-allocate variables repeatedly.
while (top->outer_scope() != NULL) top = top->outer_scope(); HistogramTimerScope timer(&Counters::variable_allocation);
top->AllocateVariables(context); Scope* top = literal->scope();
while (top->outer_scope() != NULL) top = top->outer_scope();
top->AllocateVariables(context);
}
#ifdef DEBUG #ifdef DEBUG
if (Bootstrapper::IsActive() ? if (Bootstrapper::IsActive() ?
......
...@@ -116,6 +116,7 @@ void CodeGenerator::GenCode(FunctionLiteral* fun) { ...@@ -116,6 +116,7 @@ void CodeGenerator::GenCode(FunctionLiteral* fun) {
JumpTarget::set_compiling_deferred_code(false); JumpTarget::set_compiling_deferred_code(false);
{ {
HistogramTimerScope codegen_timer(&Counters::code_generation);
CodeGenState state(this); CodeGenState state(this);
// Entry: // Entry:
...@@ -318,6 +319,7 @@ void CodeGenerator::GenCode(FunctionLiteral* fun) { ...@@ -318,6 +319,7 @@ void CodeGenerator::GenCode(FunctionLiteral* fun) {
if (HasStackOverflow()) { if (HasStackOverflow()) {
ClearDeferred(); ClearDeferred();
} else { } else {
HistogramTimerScope deferred_timer(&Counters::deferred_code_generation);
JumpTarget::set_compiling_deferred_code(true); JumpTarget::set_compiling_deferred_code(true);
ProcessDeferred(); ProcessDeferred();
JumpTarget::set_compiling_deferred_code(false); JumpTarget::set_compiling_deferred_code(false);
......
...@@ -803,6 +803,7 @@ void Processor::VisitThisFunction(ThisFunction* node) { ...@@ -803,6 +803,7 @@ void Processor::VisitThisFunction(ThisFunction* node) {
bool Rewriter::Process(FunctionLiteral* function) { bool Rewriter::Process(FunctionLiteral* function) {
HistogramTimerScope timer(&Counters::rewriting);
Scope* scope = function->scope(); Scope* scope = function->scope();
if (scope->is_function_scope()) return true; if (scope->is_function_scope()) return true;
...@@ -823,6 +824,7 @@ bool Rewriter::Optimize(FunctionLiteral* function) { ...@@ -823,6 +824,7 @@ bool Rewriter::Optimize(FunctionLiteral* function) {
ZoneList<Statement*>* body = function->body(); ZoneList<Statement*>* body = function->body();
if (FLAG_optimize_ast && !body->is_empty()) { if (FLAG_optimize_ast && !body->is_empty()) {
HistogramTimerScope timer(&Counters::ast_optimization);
AstOptimizer optimizer(function->name()); AstOptimizer optimizer(function->name());
optimizer.Optimize(body); optimizer.Optimize(body);
if (optimizer.HasStackOverflow()) { if (optimizer.HasStackOverflow()) {
......
...@@ -444,6 +444,7 @@ WeightScaler::~WeightScaler() { ...@@ -444,6 +444,7 @@ WeightScaler::~WeightScaler() {
bool AnalyzeVariableUsage(FunctionLiteral* lit) { bool AnalyzeVariableUsage(FunctionLiteral* lit) {
if (!FLAG_usage_computation) return true; if (!FLAG_usage_computation) return true;
HistogramTimerScope timer(&Counters::usage_analysis);
return UsageComputer::Traverse(lit); return UsageComputer::Traverse(lit);
} }
......
...@@ -32,16 +32,27 @@ ...@@ -32,16 +32,27 @@
namespace v8 { namespace internal { namespace v8 { namespace internal {
#define HISTOGRAM_TIMER_LIST(HT) \ #define HISTOGRAM_TIMER_LIST(HT) \
HT(gc_compactor, V8.GCCompactor) /* GC Compactor time */ \ /* Garbage collection timers. */ \
HT(gc_scavenger, V8.GCScavenger) /* GC Scavenger time */ \ HT(gc_compactor, V8.GCCompactor) \
HT(gc_context, V8.GCContext) /* GC context cleanup time */ \ HT(gc_scavenger, V8.GCScavenger) \
HT(compile, V8.Compile) /* Compile time*/ \ HT(gc_context, V8.GCContext) /* GC context cleanup time */ \
HT(compile_eval, V8.CompileEval) /* Eval compile time */ \ /* Parsing timers. */ \
HT(compile_lazy, V8.CompileLazy) /* Lazy compile time */ \ HT(parse, V8.Parse) \
HT(parse, V8.Parse) /* Parse time */ \ HT(parse_lazy, V8.ParseLazy) \
HT(parse_lazy, V8.ParseLazy) /* Lazy parse time */ \ HT(pre_parse, V8.PreParse) \
HT(pre_parse, V8.PreParse) /* Pre-parse time */ /* Total compilation times. */ \
HT(compile, V8.Compile) \
HT(compile_eval, V8.CompileEval) \
HT(compile_lazy, V8.CompileLazy) \
/* Individual compiler passes. */ \
HT(rewriting, V8.Rewriting) \
HT(usage_analysis, V8.UsageAnalysis) \
HT(variable_allocation, V8.VariableAllocation) \
HT(ast_optimization, V8.ASTOptimization) \
HT(code_generation, V8.CodeGeneration) \
HT(deferred_code_generation, V8.DeferredCodeGeneration) \
HT(code_creation, V8.CodeCreation)
// WARNING: STATS_COUNTER_LIST_* is a very large macro that is causing MSVC // WARNING: STATS_COUNTER_LIST_* is a very large macro that is causing MSVC
// Intellisense to crash. It was broken into two macros (each of length 40 // Intellisense to crash. It was broken into two macros (each of length 40
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment