Index: src/compiler-dispatcher/compiler-dispatcher-job.cc |
diff --git a/src/compiler-dispatcher/compiler-dispatcher-job.cc b/src/compiler-dispatcher/compiler-dispatcher-job.cc |
index b9e956caadde172d2c0db335d683f4a7f4c0f521..0513b18499412c115db18a6415522428b87077ff 100644 |
--- a/src/compiler-dispatcher/compiler-dispatcher-job.cc |
+++ b/src/compiler-dispatcher/compiler-dispatcher-job.cc |
@@ -263,5 +263,36 @@ void CompilerDispatcherJob::ResetOnMainThread() { |
status_ = CompileJobStatus::kInitial; |
} |
+double CompilerDispatcherJob::EstimateRuntimeOfNextStepInMs() const { |
+ switch (status_) { |
+ case CompileJobStatus::kInitial: |
+ return tracer_->EstimatePrepareToParseInMs(); |
+ |
+ case CompileJobStatus::kReadyToParse: |
+ return tracer_->EstimateParseInMs(parse_info_->end_position() - |
+ parse_info_->start_position()); |
+ |
+ case CompileJobStatus::kParsed: |
+ return tracer_->EstimateFinalizeParsingInMs(); |
+ |
+ case CompileJobStatus::kReadyToAnalyse: |
+ return tracer_->EstimatePrepareToCompileInMs(); |
+ |
+ case CompileJobStatus::kReadyToCompile: |
+ return tracer_->EstimateCompileInMs( |
+ parse_info_->literal()->ast_node_count()); |
+ |
+ case CompileJobStatus::kCompiled: |
+ return tracer_->EstimateFinalizeCompilingInMs(); |
+ |
+ case CompileJobStatus::kFailed: |
+ case CompileJobStatus::kDone: |
+ return 0.0; |
+ } |
+ |
+ UNREACHABLE(); |
+ return 0.0; |
+} |
+ |
} // namespace internal |
} // namespace v8 |