Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(653)

Unified Diff: src/compiler.h

Issue 10700188: Introduce an OptimizingCompiler class, responsible for maintaining the state needed to run Cranksha… (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/compiler.cc » ('j') | src/compiler.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | src/compiler.cc » ('j') | src/compiler.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698