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

Unified Diff: src/compiler.h

Issue 1872483002: [compiler] Make OptimizedCompileJob agnostic from backend. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Prevent endless recompile. Created 4 years, 8 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 | « src/bailout-reason.h ('k') | src/compiler.cc » ('j') | no next file with comments »
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 2fcd01aa9029dc5c21a1073ec39ada12728b0c80..73b98321cdc8f80d55a741d2cf709f74877b112b 100644
--- a/src/compiler.h
+++ b/src/compiler.h
@@ -568,20 +568,21 @@ class CompilationInfo {
DISALLOW_COPY_AND_ASSIGN(CompilationInfo);
};
-
-class HGraph;
-class LChunk;
-
-// A helper class that calls the three compilation phases in
-// Crankshaft and keeps track of its state. The three phases
-// CreateGraph, OptimizeGraph and GenerateAndInstallCode can either
-// fail, bail-out to the full code generator or succeed. Apart from
-// their return value, the status of the phase last run can be checked
-// using last_status().
+// A base class for compilation jobs intended to run concurrent to the main
+// thread. The job is split into three phases which are called in sequence on
+// different threads and with different limitations:
+// 1) CreateGraph: Runs on main thread. No major limitations.
+// 2) OptimizeGraph: Runs concurrently. No heap allocation or handle derefs.
+// 3) GenerateCode: Runs on main thread. No dependency changes.
+//
+// Each of the three phases can either fail, bail-out to full code generator or
+// succeed. Apart from their return value, the status of the phase last run can
+// be checked using {last_status()} as well.
class OptimizedCompileJob: public ZoneObject {
public:
explicit OptimizedCompileJob(CompilationInfo* info)
- : info_(info), graph_(NULL), chunk_(NULL), last_status_(FAILED) {}
+ : info_(info), last_status_(SUCCEEDED) {}
+ virtual ~OptimizedCompileJob() {}
enum Status {
FAILED, BAILED_OUT, SUCCEEDED
@@ -605,10 +606,18 @@ class OptimizedCompileJob: public ZoneObject {
return SetLastStatus(BAILED_OUT);
}
+ void RecordOptimizationStats();
+
+ protected:
+ void RegisterWeakObjectsInOptimizedCode(Handle<Code> code);
+
+ // Overridden by the actual implementation.
+ virtual Status CreateGraphImpl() = 0;
+ virtual Status OptimizeGraphImpl() = 0;
+ virtual Status GenerateCodeImpl() = 0;
+
private:
CompilationInfo* info_;
- HGraph* graph_;
- LChunk* chunk_;
base::TimeDelta time_taken_to_create_graph_;
base::TimeDelta time_taken_to_optimize_;
base::TimeDelta time_taken_to_codegen_;
@@ -618,23 +627,6 @@ class OptimizedCompileJob: public ZoneObject {
last_status_ = status;
return last_status_;
}
- void RecordOptimizationStats();
-
- struct Timer {
- Timer(OptimizedCompileJob* job, base::TimeDelta* location)
- : job_(job), location_(location) {
- DCHECK(location_ != NULL);
- timer_.Start();
- }
-
- ~Timer() {
- *location_ += timer_.Elapsed();
- }
-
- OptimizedCompileJob* job_;
- base::ElapsedTimer timer_;
- base::TimeDelta* location_;
- };
};
} // namespace internal
« no previous file with comments | « src/bailout-reason.h ('k') | src/compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698