Commit 6e17ea90 authored by verwaest's avatar verwaest Committed by Commit bot

[counters] Add counter scopes for the Compiler::Analyze phases

BUG=

Review-Url: https://codereview.chromium.org/2579243003
Cr-Commit-Position: refs/heads/master@{#42143}
parent 02ae44b7
......@@ -541,6 +541,8 @@ void DeclarationScope::HoistSloppyBlockFunctions(AstNodeFactory* factory) {
}
void DeclarationScope::Analyze(ParseInfo* info, AnalyzeMode mode) {
RuntimeCallTimerScope runtimeTimer(info->isolate(),
&RuntimeCallStats::CompileScopeAnalysis);
DCHECK(info->literal() != NULL);
DeclarationScope* scope = info->literal()->scope();
......
......@@ -553,6 +553,8 @@ void InsertCodeIntoOptimizedCodeMap(CompilationInfo* info) {
}
bool Renumber(ParseInfo* parse_info) {
RuntimeCallTimerScope runtimeTimer(parse_info->isolate(),
&RuntimeCallStats::CompileRenumber);
if (!AstNumbering::Renumber(parse_info->isolate(), parse_info->zone(),
parse_info->literal())) {
return false;
......@@ -900,6 +902,8 @@ MaybeHandle<Code> GetLazyCode(Handle<JSFunction> function) {
DCHECK(!isolate->has_pending_exception());
DCHECK(!function->is_compiled());
TimerEventScope<TimerEventCompileCode> compile_timer(isolate);
RuntimeCallTimerScope runtimeTimer(isolate,
&RuntimeCallStats::CompileFunction);
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.CompileCode");
AggregatedHistogramTimerScope timer(isolate->counters()->compile_lazy());
......@@ -987,11 +991,15 @@ MaybeHandle<Code> GetLazyCode(Handle<JSFunction> function) {
Handle<SharedFunctionInfo> CompileToplevel(CompilationInfo* info) {
Isolate* isolate = info->isolate();
TimerEventScope<TimerEventCompileCode> timer(isolate);
RuntimeCallTimerScope runtimeTimer(isolate, &RuntimeCallStats::CompileCode);
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.CompileCode");
PostponeInterruptsScope postpone(isolate);
DCHECK(!isolate->native_context().is_null());
ParseInfo* parse_info = info->parse_info();
RuntimeCallTimerScope runtimeTimer(
isolate, parse_info->is_eval() ? &RuntimeCallStats::CompileEval
: &RuntimeCallStats::CompileScript);
Handle<Script> script = parse_info->script();
// TODO(svenpanne) Obscure place for this, perhaps move to OnBeforeCompile?
......@@ -1013,9 +1021,6 @@ Handle<SharedFunctionInfo> CompileToplevel(CompilationInfo* info) {
// Measure how long it takes to do the compilation; only take the
// rest of the function into account to avoid overlap with the
// parsing statistics.
RuntimeCallTimerScope runtimeTimer(
isolate, parse_info->is_eval() ? &RuntimeCallStats::CompileEval
: &RuntimeCallStats::Compile);
HistogramTimer* rate = parse_info->is_eval()
? info->isolate()->counters()->compile_eval()
: info->isolate()->counters()->compile();
......@@ -1649,8 +1654,8 @@ Handle<SharedFunctionInfo> Compiler::GetSharedFunctionInfo(
} else {
// Generate code
TimerEventScope<TimerEventCompileCode> timer(isolate);
RuntimeCallTimerScope runtimeTimer(isolate,
&RuntimeCallStats::CompileCode);
RuntimeCallTimerScope runtimeTimer(
isolate, &RuntimeCallStats::CompileInnerFunction);
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.CompileCode");
if (Renumber(info.parse_info()) && GenerateUnoptimizedCode(&info)) {
// Code generation will ensure that the feedback vector is present and
......
......@@ -685,20 +685,24 @@ class RuntimeCallTimer final {
V(AccessorNameGetterCallback_FunctionPrototype) \
V(AccessorNameGetterCallback_StringLength) \
V(AccessorNameSetterCallback) \
V(Compile) \
V(CompileCode) \
V(CompileCodeLazy) \
V(CompileDeserialize) \
V(CompileEval) \
V(CompileFullCode) \
V(CompileAnalyse) \
V(CompileBackgroundIgnition) \
V(CompileFunction) \
V(CompileGetFromOptimizedCodeMap) \
V(CompileGetUnoptimizedCode) \
V(CompileAnalyse) \
V(CompileIgnition) \
V(CompileBackgroundIgnition) \
V(CompileIgnitionFinalization) \
V(CompilerDispatcher) \
V(CompileInnerFunction) \
V(CompileRenumber) \
V(CompileRewriteReturnResult) \
V(CompileScopeAnalysis) \
V(CompileScript) \
V(CompileSerialize) \
V(CompilerDispatcher) \
V(DeoptimizeCode) \
V(FunctionCallback) \
V(GC) \
......
......@@ -355,6 +355,8 @@ DECLARATION_NODE_LIST(DEF_VISIT)
// Assumes code has been parsed. Mutates the AST, so the AST should not
// continue to be used in the case of failure.
bool Rewriter::Rewrite(ParseInfo* info) {
RuntimeCallTimerScope runtimeTimer(
info->isolate(), &RuntimeCallStats::CompileRewriteReturnResult);
FunctionLiteral* function = info->literal();
DCHECK_NOT_NULL(function);
Scope* scope = function->scope();
......
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