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