OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/compiler-dispatcher/compiler-dispatcher-job.h" | 5 #include "src/compiler-dispatcher/compiler-dispatcher-job.h" |
6 | 6 |
7 #include "src/assert-scope.h" | 7 #include "src/assert-scope.h" |
8 #include "src/compilation-info.h" | 8 #include "src/compilation-info.h" |
9 #include "src/compiler-dispatcher/compiler-dispatcher-tracer.h" | 9 #include "src/compiler-dispatcher/compiler-dispatcher-tracer.h" |
10 #include "src/compiler.h" | 10 #include "src/compiler.h" |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 compile_job_.reset(); | 256 compile_job_.reset(); |
257 | 257 |
258 if (!source_.is_null()) { | 258 if (!source_.is_null()) { |
259 i::GlobalHandles::Destroy(Handle<Object>::cast(source_).location()); | 259 i::GlobalHandles::Destroy(Handle<Object>::cast(source_).location()); |
260 source_ = Handle<String>::null(); | 260 source_ = Handle<String>::null(); |
261 } | 261 } |
262 | 262 |
263 status_ = CompileJobStatus::kInitial; | 263 status_ = CompileJobStatus::kInitial; |
264 } | 264 } |
265 | 265 |
| 266 double CompilerDispatcherJob::EstimateRuntimeOfNextStepInMs() const { |
| 267 switch (status_) { |
| 268 case CompileJobStatus::kInitial: |
| 269 return tracer_->EstimatePrepareToParseInMs(); |
| 270 |
| 271 case CompileJobStatus::kReadyToParse: |
| 272 return tracer_->EstimateParseInMs(parse_info_->end_position() - |
| 273 parse_info_->start_position()); |
| 274 |
| 275 case CompileJobStatus::kParsed: |
| 276 return tracer_->EstimateFinalizeParsingInMs(); |
| 277 |
| 278 case CompileJobStatus::kReadyToAnalyse: |
| 279 return tracer_->EstimatePrepareToCompileInMs(); |
| 280 |
| 281 case CompileJobStatus::kReadyToCompile: |
| 282 return tracer_->EstimateCompileInMs( |
| 283 parse_info_->literal()->ast_node_count()); |
| 284 |
| 285 case CompileJobStatus::kCompiled: |
| 286 return tracer_->EstimateFinalizeCompilingInMs(); |
| 287 |
| 288 case CompileJobStatus::kFailed: |
| 289 case CompileJobStatus::kDone: |
| 290 return 0.0; |
| 291 } |
| 292 |
| 293 UNREACHABLE(); |
| 294 return 0.0; |
| 295 } |
| 296 |
266 } // namespace internal | 297 } // namespace internal |
267 } // namespace v8 | 298 } // namespace v8 |
OLD | NEW |