Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(449)

Unified Diff: src/interpreter/interpreter.cc

Issue 2577263002: [Compiler] Track Ignition background compilation separately in RuntimeStats. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/interpreter/interpreter.cc
diff --git a/src/interpreter/interpreter.cc b/src/interpreter/interpreter.cc
index 5b484cca78e1558c880bbf89b5f219243eb04ee6..5642a2c08e9c17ea1eb17e48fdb42184a20cd78c 100644
--- a/src/interpreter/interpreter.cc
+++ b/src/interpreter/interpreter.cc
@@ -44,6 +44,7 @@ class InterpreterCompilationJob final : public CompilationJob {
BytecodeGenerator* generator() { return &generator_; }
BytecodeGenerator generator_;
+ RuntimeCallStats* runtime_call_stats_;
DISALLOW_COPY_AND_ASSIGN(InterpreterCompilationJob);
};
@@ -160,7 +161,9 @@ int Interpreter::InterruptBudget() {
}
InterpreterCompilationJob::InterpreterCompilationJob(CompilationInfo* info)
- : CompilationJob(info->isolate(), info, "Ignition"), generator_(info) {}
+ : CompilationJob(info->isolate(), info, "Ignition"),
+ generator_(info),
+ runtime_call_stats_(info->isolate()->counters()->runtime_call_stats()) {}
InterpreterCompilationJob::Status InterpreterCompilationJob::PrepareJobImpl() {
CodeGenerator::MakeCodePrologue(info(), "interpreter");
@@ -176,11 +179,14 @@ InterpreterCompilationJob::Status InterpreterCompilationJob::PrepareJobImpl() {
}
InterpreterCompilationJob::Status InterpreterCompilationJob::ExecuteJobImpl() {
- // TODO(5203): These timers aren't thread safe, move to using the CompilerJob
- // timers.
- RuntimeCallTimerScope runtimeTimer(info()->isolate(),
- &RuntimeCallStats::CompileIgnition);
- TimerEventScope<TimerEventCompileIgnition> timer(info()->isolate());
+ if (FLAG_runtime_stats && executed_on_background_thread()) {
+ // Create separate runtime stats for background compilation.
+ runtime_call_stats_ = new (info()->zone()) RuntimeCallStats();
jochen (gone - plz use gerrit) 2016/12/16 10:47:38 this allocates a potentially pretty large object e
Camillo Bruni 2016/12/16 11:42:54 I think we initially discussed to do exactly that,
rmcilroy 2016/12/16 23:48:05 Yeah good point. I was basing this on the approach
+ }
+ RuntimeCallTimerScope runtimeTimer(
+ runtime_call_stats_, executed_on_background_thread()
+ ? &RuntimeCallStats::CompileBackgroundIgnition
+ : &RuntimeCallStats::CompileIgnition);
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.CompileIgnition");
Camillo Bruni 2016/12/16 09:25:05 Please add: TODO(lpy): add support for background
rmcilroy 2016/12/16 23:48:05 Done.
generator()->GenerateBytecode(stack_limit());
@@ -192,6 +198,19 @@ InterpreterCompilationJob::Status InterpreterCompilationJob::ExecuteJobImpl() {
}
InterpreterCompilationJob::Status InterpreterCompilationJob::FinalizeJobImpl() {
+ // Add background runtime call stats.
+ if (executed_on_background_thread() &&
+ FLAG_runtime_stats ==
+ v8::tracing::TracingCategoryObserver::ENABLED_BY_NATIVE) {
+ info()->isolate()->counters()->runtime_call_stats()->Add(
+ runtime_call_stats_);
+ // Reset runtime_call_stats_.
+ runtime_call_stats_ = info()->isolate()->counters()->runtime_call_stats();
+ }
+
+ RuntimeCallTimerScope runtimeTimer(
+ runtime_call_stats_, &RuntimeCallStats::CompileIgnitionFinalization);
+
Handle<BytecodeArray> bytecodes = generator()->FinalizeBytecode(isolate());
if (generator()->HasStackOverflow()) {
return FAILED;

Powered by Google App Engine
This is Rietveld 408576698