Chromium Code Reviews| Index: src/compiler.h |
| diff --git a/src/compiler.h b/src/compiler.h |
| index 135904860eaea42e4790182d113bcd173b29bd2c..eb0e99d60e75f6171353421f111317552e77505e 100644 |
| --- a/src/compiler.h |
| +++ b/src/compiler.h |
| @@ -312,6 +312,85 @@ class CompilationHandleScope BASE_EMBEDDED { |
| }; |
| +class HGraph; |
| +class HGraphBuilder; |
| +class LChunk; |
| + |
| +// A helper class that calls the three phases in Crankshaft and keeps |
|
danno
2012/07/16 12:19:09
nit: compilation phases
maybe you should list what
sanjoy
2012/07/16 13:46:46
Done.
|
| +// track of its state. |
| +class OptimizingCompiler: public ZoneObject { |
| + public: |
| + explicit OptimizingCompiler(CompilationInfo* info) |
| + : info_(info), |
| + oracle_(NULL), |
| + graph_builder_(NULL), |
| + graph_(NULL), |
| + chunk_(NULL), |
| + total_time_taken_(0), |
| + is_inline_bailout_(false), |
| + last_status_(FAILED) { } |
| + |
| + enum Status { |
| + FAILED, BAILED_OUT, SUCCEEDED |
| + }; |
| + |
| + Status CreateHGraph() { |
|
danno
2012/07/16 12:19:09
Just call this CreateGraph()
sanjoy
2012/07/16 13:46:46
Done.
|
| + last_status_ = InnerCreateHGraph(); |
| + return last_status_; |
| + } |
| + Status OptimizeHGraph() { |
|
danno
2012/07/16 12:19:09
OptimizeGraph
sanjoy
2012/07/16 13:46:46
Done.
|
| + last_status_ = InnerOptimizeHGraph(); |
| + return last_status_; |
| + } |
| + Status GenerateAndInstallCode() { |
| + last_status_ = InnerGenerateAndInstallCode(); |
| + if (last_status_ == SUCCEEDED) RecordOptimizationStats(); |
| + return last_status_; |
| + } |
| + |
| + Status last_status() const { return last_status_; } |
| + CompilationInfo* info() const { return info_; } |
| + |
| + private: |
| + CompilationInfo* info_; |
| + TypeFeedbackOracle* oracle_; |
| + HGraphBuilder* graph_builder_; |
| + HGraph* graph_; |
| + LChunk* chunk_; |
| + int64_t total_time_taken_; |
| + bool is_inline_bailout_; |
| + Status last_status_; |
| + |
| + Status InnerCreateHGraph(); |
|
danno
2012/07/16 12:19:09
I don't understand why you need these "Inner" meth
sanjoy
2012/07/16 13:46:46
I wanted to have a central place to set last_statu
|
| + Status InnerOptimizeHGraph(); |
| + Status InnerGenerateAndInstallCode(); |
| + |
| + void RecordOptimizationStats(); |
| + |
| + void AbortCrankshaft() { |
| + info_->AbortOptimization(); |
| + if (!is_inline_bailout_) { |
| + // Mark the shared code as unoptimizable unless it was an inlined |
| + // function that bailed out. |
| + info_->shared_info()->DisableOptimization(); |
| + } |
| + } |
| + |
| + struct Timer { |
| + explicit Timer(OptimizingCompiler* compiler) |
| + : compiler_(compiler), |
| + start_(OS::Ticks()) { } |
| + |
| + ~Timer() { |
| + compiler_->total_time_taken_ += (OS::Ticks() - start_); |
|
danno
2012/07/16 12:19:09
Perhaps divide this up into three counters, one fo
sanjoy
2012/07/16 13:46:46
Done.
|
| + } |
| + |
| + OptimizingCompiler* compiler_; |
| + int64_t start_; |
| + }; |
| +}; |
| + |
| + |
| // The V8 compiler |
| // |
| // General strategy: Source code is translated into an anonymous function w/o |