| 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.h" | 9 #include "src/ast.h" |
| 10 #include "src/zone.h" | 10 #include "src/zone.h" |
| (...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 577 awaiting_install_ = true; | 577 awaiting_install_ = true; |
| 578 } | 578 } |
| 579 | 579 |
| 580 bool IsWaitingForInstall() { return awaiting_install_; } | 580 bool IsWaitingForInstall() { return awaiting_install_; } |
| 581 | 581 |
| 582 private: | 582 private: |
| 583 CompilationInfo* info_; | 583 CompilationInfo* info_; |
| 584 HOptimizedGraphBuilder* graph_builder_; | 584 HOptimizedGraphBuilder* graph_builder_; |
| 585 HGraph* graph_; | 585 HGraph* graph_; |
| 586 LChunk* chunk_; | 586 LChunk* chunk_; |
| 587 TimeDelta time_taken_to_create_graph_; | 587 base::TimeDelta time_taken_to_create_graph_; |
| 588 TimeDelta time_taken_to_optimize_; | 588 base::TimeDelta time_taken_to_optimize_; |
| 589 TimeDelta time_taken_to_codegen_; | 589 base::TimeDelta time_taken_to_codegen_; |
| 590 Status last_status_; | 590 Status last_status_; |
| 591 bool awaiting_install_; | 591 bool awaiting_install_; |
| 592 | 592 |
| 593 MUST_USE_RESULT Status SetLastStatus(Status status) { | 593 MUST_USE_RESULT Status SetLastStatus(Status status) { |
| 594 last_status_ = status; | 594 last_status_ = status; |
| 595 return last_status_; | 595 return last_status_; |
| 596 } | 596 } |
| 597 void RecordOptimizationStats(); | 597 void RecordOptimizationStats(); |
| 598 | 598 |
| 599 struct Timer { | 599 struct Timer { |
| 600 Timer(OptimizedCompileJob* job, TimeDelta* location) | 600 Timer(OptimizedCompileJob* job, base::TimeDelta* location) |
| 601 : job_(job), location_(location) { | 601 : job_(job), location_(location) { |
| 602 ASSERT(location_ != NULL); | 602 ASSERT(location_ != NULL); |
| 603 timer_.Start(); | 603 timer_.Start(); |
| 604 } | 604 } |
| 605 | 605 |
| 606 ~Timer() { | 606 ~Timer() { |
| 607 *location_ += timer_.Elapsed(); | 607 *location_ += timer_.Elapsed(); |
| 608 } | 608 } |
| 609 | 609 |
| 610 OptimizedCompileJob* job_; | 610 OptimizedCompileJob* job_; |
| 611 ElapsedTimer timer_; | 611 base::ElapsedTimer timer_; |
| 612 TimeDelta* location_; | 612 base::TimeDelta* location_; |
| 613 }; | 613 }; |
| 614 }; | 614 }; |
| 615 | 615 |
| 616 | 616 |
| 617 // The V8 compiler | 617 // The V8 compiler |
| 618 // | 618 // |
| 619 // General strategy: Source code is translated into an anonymous function w/o | 619 // General strategy: Source code is translated into an anonymous function w/o |
| 620 // parameters which then can be executed. If the source code contains other | 620 // parameters which then can be executed. If the source code contains other |
| 621 // functions, they will be compiled and allocated as part of the compilation | 621 // functions, they will be compiled and allocated as part of the compilation |
| 622 // of the source code. | 622 // of the source code. |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 695 const char* name() const { return name_; } | 695 const char* name() const { return name_; } |
| 696 CompilationInfo* info() const { return info_; } | 696 CompilationInfo* info() const { return info_; } |
| 697 Isolate* isolate() const { return info()->isolate(); } | 697 Isolate* isolate() const { return info()->isolate(); } |
| 698 Zone* zone() { return &zone_; } | 698 Zone* zone() { return &zone_; } |
| 699 | 699 |
| 700 private: | 700 private: |
| 701 const char* name_; | 701 const char* name_; |
| 702 CompilationInfo* info_; | 702 CompilationInfo* info_; |
| 703 Zone zone_; | 703 Zone zone_; |
| 704 unsigned info_zone_start_allocation_size_; | 704 unsigned info_zone_start_allocation_size_; |
| 705 ElapsedTimer timer_; | 705 base::ElapsedTimer timer_; |
| 706 | 706 |
| 707 DISALLOW_COPY_AND_ASSIGN(CompilationPhase); | 707 DISALLOW_COPY_AND_ASSIGN(CompilationPhase); |
| 708 }; | 708 }; |
| 709 | 709 |
| 710 | 710 |
| 711 } } // namespace v8::internal | 711 } } // namespace v8::internal |
| 712 | 712 |
| 713 #endif // V8_COMPILER_H_ | 713 #endif // V8_COMPILER_H_ |
| OLD | NEW |