Index: runtime/vm/compiler.h |
diff --git a/runtime/vm/compiler.h b/runtime/vm/compiler.h |
index 0f9eccdcfe863b33b57a5d45c22c7775065f8463..befa53d3d7f6bf733f9f4df73ed571bad53da0c5 100644 |
--- a/runtime/vm/compiler.h |
+++ b/runtime/vm/compiler.h |
@@ -15,6 +15,7 @@ namespace dart { |
// Forward declarations. |
class Class; |
class Code; |
+class CompilationWorkQueue; |
class Function; |
class Library; |
class ParsedFunction; |
@@ -22,6 +23,37 @@ class RawInstance; |
class Script; |
class SequenceNode; |
+class BackgroundCompilationResult : public ValueObject { |
+ public: |
+ BackgroundCompilationResult(); |
+ |
+ // Initializes with current isolate-stored invalidation generations |
siva
2015/10/29 23:42:07
generations.
srdjan
2015/10/30 17:21:12
Done.
|
+ void Init(); |
+ |
+ void set_result_code(const Code& value) { result_code_ = value.raw(); } |
+ const Code& result_code() const { return result_code_; } |
+ |
+ // Returns true if all relevant gen-counts are current and code is valid. |
+ bool IsValid() const; |
+ |
+ // Remove gen-counts from validation check. |
+ void ClearCHAInvalidationGen() { cha_invalidation_gen_ = -1; } |
+ void ClearFieldInnvalidationGen() { field_invalidation_gen_ = -1; } |
+ void ClearPrefixInnvalidationGen() { prefix_invalidation_gen_ = -1; } |
+ |
+ void PushOnQueue(CompilationWorkQueue* queue) const; |
+ void PopFromQueue(CompilationWorkQueue* queue); |
+ |
+ void PrintValidity(); |
+ |
+ private: |
+ Code& result_code_; |
+ intptr_t cha_invalidation_gen_; |
+ intptr_t field_invalidation_gen_; |
+ intptr_t prefix_invalidation_gen_; |
+}; |
+ |
+ |
class Compiler : public AllStatic { |
public: |
static const intptr_t kNoOSRDeoptId = Thread::kNoDeoptId; |
@@ -58,7 +90,7 @@ class Compiler : public AllStatic { |
Thread* thread, |
const Function& function, |
intptr_t osr_id = kNoOSRDeoptId, |
- Code* result_code = NULL); |
+ BackgroundCompilationResult* res = NULL); |
// Generates code for given parsed function (without parsing it again) and |
// sets its code field. |
@@ -136,7 +168,7 @@ class BackgroundCompiler : public ThreadPool::Task { |
explicit BackgroundCompiler(Isolate* isolate); |
GrowableObjectArray* FunctionsQueue() const; |
- GrowableObjectArray* CodesQueue() const; |
+ GrowableObjectArray* ResultQueue() const; |
virtual void Run(); |
@@ -144,7 +176,7 @@ class BackgroundCompiler : public ThreadPool::Task { |
RawFunction* RemoveFunctionOrNull(); |
RawFunction* LastFunctionOrNull() const; |
- void AddCode(const Code& c); |
+ void AddResult(const BackgroundCompilationResult& value); |
Isolate* isolate_; |
bool running_; // While true, will try to read queue and compile. |