OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 #ifndef V8_COMPILER_H_ | 5 #ifndef V8_COMPILER_H_ |
6 #define V8_COMPILER_H_ | 6 #define V8_COMPILER_H_ |
7 | 7 |
8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/ast/ast.h" | 9 #include "src/ast/ast.h" |
10 #include "src/bailout-reason.h" | 10 #include "src/bailout-reason.h" |
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
574 // different threads and with different limitations: | 574 // different threads and with different limitations: |
575 // 1) CreateGraph: Runs on main thread. No major limitations. | 575 // 1) CreateGraph: Runs on main thread. No major limitations. |
576 // 2) OptimizeGraph: Runs concurrently. No heap allocation or handle derefs. | 576 // 2) OptimizeGraph: Runs concurrently. No heap allocation or handle derefs. |
577 // 3) GenerateCode: Runs on main thread. No dependency changes. | 577 // 3) GenerateCode: Runs on main thread. No dependency changes. |
578 // | 578 // |
579 // Each of the three phases can either fail, bail-out to full code generator or | 579 // Each of the three phases can either fail, bail-out to full code generator or |
580 // succeed. Apart from their return value, the status of the phase last run can | 580 // succeed. Apart from their return value, the status of the phase last run can |
581 // be checked using {last_status()} as well. | 581 // be checked using {last_status()} as well. |
582 class OptimizedCompileJob: public ZoneObject { | 582 class OptimizedCompileJob: public ZoneObject { |
583 public: | 583 public: |
584 explicit OptimizedCompileJob(CompilationInfo* info) | 584 explicit OptimizedCompileJob(CompilationInfo* info, const char* compiler_name) |
585 : info_(info), last_status_(SUCCEEDED) {} | 585 : info_(info), compiler_name_(compiler_name), last_status_(SUCCEEDED) {} |
586 virtual ~OptimizedCompileJob() {} | 586 virtual ~OptimizedCompileJob() {} |
587 | 587 |
588 enum Status { | 588 enum Status { |
589 FAILED, BAILED_OUT, SUCCEEDED | 589 FAILED, BAILED_OUT, SUCCEEDED |
590 }; | 590 }; |
591 | 591 |
592 MUST_USE_RESULT Status CreateGraph(); | 592 MUST_USE_RESULT Status CreateGraph(); |
593 MUST_USE_RESULT Status OptimizeGraph(); | 593 MUST_USE_RESULT Status OptimizeGraph(); |
594 MUST_USE_RESULT Status GenerateCode(); | 594 MUST_USE_RESULT Status GenerateCode(); |
595 | 595 |
(...skipping 19 matching lines...) Expand all Loading... |
615 // Overridden by the actual implementation. | 615 // Overridden by the actual implementation. |
616 virtual Status CreateGraphImpl() = 0; | 616 virtual Status CreateGraphImpl() = 0; |
617 virtual Status OptimizeGraphImpl() = 0; | 617 virtual Status OptimizeGraphImpl() = 0; |
618 virtual Status GenerateCodeImpl() = 0; | 618 virtual Status GenerateCodeImpl() = 0; |
619 | 619 |
620 private: | 620 private: |
621 CompilationInfo* info_; | 621 CompilationInfo* info_; |
622 base::TimeDelta time_taken_to_create_graph_; | 622 base::TimeDelta time_taken_to_create_graph_; |
623 base::TimeDelta time_taken_to_optimize_; | 623 base::TimeDelta time_taken_to_optimize_; |
624 base::TimeDelta time_taken_to_codegen_; | 624 base::TimeDelta time_taken_to_codegen_; |
| 625 const char* compiler_name_; |
625 Status last_status_; | 626 Status last_status_; |
626 | 627 |
627 MUST_USE_RESULT Status SetLastStatus(Status status) { | 628 MUST_USE_RESULT Status SetLastStatus(Status status) { |
628 last_status_ = status; | 629 last_status_ = status; |
629 return last_status_; | 630 return last_status_; |
630 } | 631 } |
631 }; | 632 }; |
632 | 633 |
633 } // namespace internal | 634 } // namespace internal |
634 } // namespace v8 | 635 } // namespace v8 |
635 | 636 |
636 #endif // V8_COMPILER_H_ | 637 #endif // V8_COMPILER_H_ |
OLD | NEW |