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

Unified Diff: src/interpreter/interpreter.cc

Issue 2577263002: [Compiler] Track Ignition background compilation separately in RuntimeStats. (Closed)
Patch Set: Fix crash on accessing compilationinfo in constructor Created 3 years, 12 months 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
« no previous file with comments | « src/counters.h ('k') | tools/callstats.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/interpreter/interpreter.cc
diff --git a/src/interpreter/interpreter.cc b/src/interpreter/interpreter.cc
index 724c159c5eeedd1bae69eef33e932490aa58d540..a0e92f345b5b89d13d61e95020809ab0c2b09998 100644
--- a/src/interpreter/interpreter.cc
+++ b/src/interpreter/interpreter.cc
@@ -41,9 +41,41 @@ class InterpreterCompilationJob final : public CompilationJob {
Status FinalizeJobImpl() final;
private:
+ class TimerScope final {
+ public:
+ TimerScope(RuntimeCallStats* stats, RuntimeCallStats::CounterId counter_id)
+ : stats_(stats) {
+ if (V8_UNLIKELY(FLAG_runtime_stats)) {
+ RuntimeCallStats::Enter(stats_, &timer_, counter_id);
+ }
+ }
+
+ explicit TimerScope(RuntimeCallCounter* counter) : stats_(nullptr) {
+ if (V8_UNLIKELY(FLAG_runtime_stats)) {
+ timer_.Start(counter, nullptr);
+ }
+ }
+
+ ~TimerScope() {
+ if (V8_UNLIKELY(FLAG_runtime_stats)) {
+ if (stats_) {
+ RuntimeCallStats::Leave(stats_, &timer_);
+ } else {
+ timer_.Stop();
+ }
+ }
+ }
+
+ private:
+ RuntimeCallStats* stats_;
+ RuntimeCallTimer timer_;
+ };
+
BytecodeGenerator* generator() { return &generator_; }
BytecodeGenerator generator_;
+ RuntimeCallStats* runtime_call_stats_;
+ RuntimeCallCounter background_execute_counter_;
DISALLOW_COPY_AND_ASSIGN(InterpreterCompilationJob);
};
@@ -162,7 +194,9 @@ int Interpreter::InterruptBudget() {
InterpreterCompilationJob::InterpreterCompilationJob(CompilationInfo* info,
LazyCompilationMode mode)
: CompilationJob(info->isolate(), info, "Ignition"),
- generator_(info, mode) {}
+ generator_(info, mode),
+ runtime_call_stats_(info->isolate()->counters()->runtime_call_stats()),
+ background_execute_counter_("CompileBackgroundIgnition") {}
InterpreterCompilationJob::Status InterpreterCompilationJob::PrepareJobImpl() {
CodeGenerator::MakeCodePrologue(info(), "interpreter");
@@ -178,11 +212,11 @@ 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());
+ TimerScope runtimeTimer =
+ executed_on_background_thread()
+ ? TimerScope(&background_execute_counter_)
+ : TimerScope(runtime_call_stats_, &RuntimeCallStats::CompileIgnition);
+ // TODO(lpy): add support for background compilation RCS trace.
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.CompileIgnition");
generator()->GenerateBytecode(stack_limit());
@@ -194,6 +228,15 @@ InterpreterCompilationJob::Status InterpreterCompilationJob::ExecuteJobImpl() {
}
InterpreterCompilationJob::Status InterpreterCompilationJob::FinalizeJobImpl() {
+ // Add background runtime call stats.
+ if (V8_UNLIKELY(FLAG_runtime_stats && executed_on_background_thread())) {
+ runtime_call_stats_->CompileBackgroundIgnition.Add(
+ &background_execute_counter_);
+ }
+
+ RuntimeCallTimerScope runtimeTimer(
+ runtime_call_stats_, &RuntimeCallStats::CompileIgnitionFinalization);
+
Handle<BytecodeArray> bytecodes = generator()->FinalizeBytecode(isolate());
if (generator()->HasStackOverflow()) {
return FAILED;
« no previous file with comments | « src/counters.h ('k') | tools/callstats.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698