Commit 5a6fece4 authored by Ross McIlroy's avatar Ross McIlroy Committed by Commit Bot

[RuntimeStats] Add some additional RCS events for background events.

Adds some additional RCS counters to correctly account background
compilation to the background thread.

Also adds a ParseBackgroundProgram as a top-level event for background
parsing since otherwise only pre-parsing was being tracked.

Perf Sheriffs: Note this is likely to increase the Parse-Background
bucket in v8.runtime_stats benchmarks as it now accounts all background
parsing correclty.

BUG=v8:5203

Change-Id: I6ff614b725d85b0bc1901a7bf0e2bac8de1f7cff
Reviewed-on: https://chromium-review.googlesource.com/786237Reviewed-by: 's avatarMarja Hölttä <marja@chromium.org>
Commit-Queue: Ross McIlroy <rmcilroy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49603}
parent 01df85e2
...@@ -646,8 +646,11 @@ void DeclarationScope::AttachOuterScopeInfo(ParseInfo* info, Isolate* isolate) { ...@@ -646,8 +646,11 @@ void DeclarationScope::AttachOuterScopeInfo(ParseInfo* info, Isolate* isolate) {
} }
void DeclarationScope::Analyze(ParseInfo* info) { void DeclarationScope::Analyze(ParseInfo* info) {
RuntimeCallTimerScope runtimeTimer(info->runtime_call_stats(), RuntimeCallTimerScope runtimeTimer(
&RuntimeCallStats::CompileScopeAnalysis); info->runtime_call_stats(),
info->on_background_thread()
? &RuntimeCallStats::CompileBackgroundScopeAnalysis
: &RuntimeCallStats::CompileScopeAnalysis);
DCHECK_NOT_NULL(info->literal()); DCHECK_NOT_NULL(info->literal());
DeclarationScope* scope = info->literal()->scope(); DeclarationScope* scope = info->literal()->scope();
......
...@@ -372,8 +372,11 @@ CompilationJob::Status FinalizeUnoptimizedCompilationJob(CompilationJob* job, ...@@ -372,8 +372,11 @@ CompilationJob::Status FinalizeUnoptimizedCompilationJob(CompilationJob* job,
bool Renumber(ParseInfo* parse_info, bool Renumber(ParseInfo* parse_info,
Compiler::EagerInnerFunctionLiterals* eager_literals) { Compiler::EagerInnerFunctionLiterals* eager_literals) {
RuntimeCallTimerScope runtimeTimer(parse_info->runtime_call_stats(), RuntimeCallTimerScope runtimeTimer(
&RuntimeCallStats::CompileRenumber); parse_info->runtime_call_stats(),
parse_info->on_background_thread()
? &RuntimeCallStats::CompileBackgroundRenumber
: &RuntimeCallStats::CompileRenumber);
return AstNumbering::Renumber(parse_info->stack_limit(), parse_info->zone(), return AstNumbering::Renumber(parse_info->stack_limit(), parse_info->zone(),
parse_info->literal(), eager_literals); parse_info->literal(), eager_literals);
} }
......
...@@ -789,6 +789,9 @@ class RuntimeCallTimer final { ...@@ -789,6 +789,9 @@ class RuntimeCallTimer final {
V(CompileBackgroundEval) \ V(CompileBackgroundEval) \
V(CompileBackgroundIgnition) \ V(CompileBackgroundIgnition) \
V(CompileBackgroundScript) \ V(CompileBackgroundScript) \
V(CompileBackgroundRenumber) \
V(CompileBackgroundRewriteReturnResult) \
V(CompileBackgroundScopeAnalysis) \
V(CompileDeserialize) \ V(CompileDeserialize) \
V(CompileEval) \ V(CompileEval) \
V(CompileAnalyse) \ V(CompileAnalyse) \
...@@ -835,6 +838,7 @@ class RuntimeCallTimer final { ...@@ -835,6 +838,7 @@ class RuntimeCallTimer final {
V(ParseArrowFunctionLiteral) \ V(ParseArrowFunctionLiteral) \
V(ParseBackgroundArrowFunctionLiteral) \ V(ParseBackgroundArrowFunctionLiteral) \
V(ParseBackgroundFunctionLiteral) \ V(ParseBackgroundFunctionLiteral) \
V(ParseBackgroundProgram) \
V(ParseEval) \ V(ParseEval) \
V(ParseFunction) \ V(ParseFunction) \
V(ParseFunctionLiteral) \ V(ParseFunctionLiteral) \
......
...@@ -182,14 +182,13 @@ InterpreterCompilationJob::Status InterpreterCompilationJob::ExecuteJobImpl() { ...@@ -182,14 +182,13 @@ InterpreterCompilationJob::Status InterpreterCompilationJob::ExecuteJobImpl() {
parse_info()->on_background_thread() parse_info()->on_background_thread()
? &RuntimeCallStats::CompileBackgroundIgnition ? &RuntimeCallStats::CompileBackgroundIgnition
: &RuntimeCallStats::CompileIgnition); : &RuntimeCallStats::CompileIgnition);
// TODO(lpy): add support for background compilation RCS trace.
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.CompileIgnition");
// Print AST if flag is enabled. Note, if compiling on a background thread // Print AST if flag is enabled. Note, if compiling on a background thread
// then ASTs from different functions may be intersperse when printed. // then ASTs from different functions may be intersperse when printed.
MaybePrintAst(parse_info(), compilation_info()); MaybePrintAst(parse_info(), compilation_info());
// TODO(lpy): add support for background compilation RCS trace.
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.CompileIgnition");
generator()->GenerateBytecode(stack_limit()); generator()->GenerateBytecode(stack_limit());
if (generator()->HasStackOverflow()) { if (generator()->HasStackOverflow()) {
...@@ -203,6 +202,8 @@ InterpreterCompilationJob::Status InterpreterCompilationJob::FinalizeJobImpl( ...@@ -203,6 +202,8 @@ InterpreterCompilationJob::Status InterpreterCompilationJob::FinalizeJobImpl(
RuntimeCallTimerScope runtimeTimerScope( RuntimeCallTimerScope runtimeTimerScope(
parse_info()->runtime_call_stats(), parse_info()->runtime_call_stats(),
&RuntimeCallStats::CompileIgnitionFinalization); &RuntimeCallStats::CompileIgnitionFinalization);
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"),
"V8.CompileIgnitionFinalization");
Handle<BytecodeArray> bytecodes = Handle<BytecodeArray> bytecodes =
generator()->FinalizeBytecode(isolate, parse_info()->script()); generator()->FinalizeBytecode(isolate, parse_info()->script());
......
...@@ -3486,6 +3486,8 @@ void Parser::UpdateStatistics(Isolate* isolate, Handle<Script> script) { ...@@ -3486,6 +3486,8 @@ void Parser::UpdateStatistics(Isolate* isolate, Handle<Script> script) {
} }
void Parser::ParseOnBackground(ParseInfo* info) { void Parser::ParseOnBackground(ParseInfo* info) {
RuntimeCallTimerScope runtimeTimer(runtime_call_stats_,
&RuntimeCallStats::ParseBackgroundProgram);
parsing_on_main_thread_ = false; parsing_on_main_thread_ = false;
if (!info->script().is_null()) { if (!info->script().is_null()) {
set_script_id(info->script()->id()); set_script_id(info->script()->id());
......
...@@ -363,7 +363,9 @@ bool Rewriter::Rewrite(ParseInfo* info) { ...@@ -363,7 +363,9 @@ bool Rewriter::Rewrite(ParseInfo* info) {
RuntimeCallTimerScope runtimeTimer( RuntimeCallTimerScope runtimeTimer(
info->runtime_call_stats(), info->runtime_call_stats(),
&RuntimeCallStats::CompileRewriteReturnResult); info->on_background_thread()
? &RuntimeCallStats::CompileBackgroundRewriteReturnResult
: &RuntimeCallStats::CompileRewriteReturnResult);
FunctionLiteral* function = info->literal(); FunctionLiteral* function = info->literal();
DCHECK_NOT_NULL(function); DCHECK_NOT_NULL(function);
......
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