| Index: runtime/vm/compiler.h
|
| diff --git a/runtime/vm/compiler.h b/runtime/vm/compiler.h
|
| index 28732f4ccbfe27b6305f0343e705594930722e67..70c436f846de029977616079320fc3d504c30de5 100644
|
| --- a/runtime/vm/compiler.h
|
| +++ b/runtime/vm/compiler.h
|
| @@ -14,6 +14,7 @@ namespace dart {
|
|
|
| // Forward declarations.
|
| class Class;
|
| +class Code;
|
| class Function;
|
| class Library;
|
| class ParsedFunction;
|
| @@ -23,6 +24,8 @@ class SequenceNode;
|
|
|
| class Compiler : public AllStatic {
|
| public:
|
| + static const intptr_t kNoOSRDeoptId = Thread::kNoDeoptId;
|
| +
|
| // Extracts top level entities from the script and populates
|
| // the class dictionary of the library.
|
| //
|
| @@ -47,10 +50,13 @@ class Compiler : public AllStatic {
|
| // Generates optimized code for function.
|
| //
|
| // Returns Error::null() if there is no compilation error.
|
| + // If 'result_code' is not NULL, then the generated code is returned but
|
| + // not installed.
|
| static RawError* CompileOptimizedFunction(
|
| Thread* thread,
|
| const Function& function,
|
| - intptr_t osr_id = Thread::kNoDeoptId);
|
| + intptr_t osr_id = kNoOSRDeoptId,
|
| + Code* result_code = NULL);
|
|
|
| // Generates code for given parsed function (without parsing it again) and
|
| // sets its code field.
|
| @@ -104,26 +110,39 @@ class Compiler : public AllStatic {
|
| // Class to run optimizing compilation in a background thread.
|
| // Current implementation: one task per isolate, it dies with the owning
|
| // isolate.
|
| +// No OSR compilation in the background compiler.
|
| class BackgroundCompiler : public ThreadPool::Task {
|
| public:
|
| static void EnsureInit(Thread* thread);
|
|
|
| static void Stop(BackgroundCompiler* task);
|
|
|
| + // Call to optimize a function in the background, enters the function in the
|
| + // compilation queue.
|
| void CompileOptimized(const Function& function);
|
|
|
| + // Call to activate/install optimized code (must occur in the mutator thread).
|
| + void InstallGeneratedCode();
|
| +
|
| // Access to queue length is guarded with queue_monitor_;
|
| - intptr_t queue_length() const { return queue_length_; }
|
| - void set_queue_length(intptr_t value) { queue_length_ = value; }
|
| + intptr_t function_queue_length() const { return function_queue_length_; }
|
| + void set_function_queue_length(intptr_t value) {
|
| + function_queue_length_ = value;
|
| + }
|
|
|
| private:
|
| explicit BackgroundCompiler(Isolate* isolate);
|
|
|
| + GrowableObjectArray* FunctionsQueue() const;
|
| + GrowableObjectArray* CodesQueue() const;
|
| +
|
| virtual void Run();
|
|
|
| - void Add(const Function& f);
|
| - RawFunction* RemoveOrNull();
|
| - RawFunction* LastOrNull() const;
|
| + void AddFunction(const Function& f);
|
| + RawFunction* RemoveFunctionOrNull();
|
| + RawFunction* LastFunctionOrNull() const;
|
| +
|
| + void AddCode(const Code& c);
|
|
|
| Isolate* isolate_;
|
| bool running_; // While true, will try to read queue and compile.
|
| @@ -131,7 +150,8 @@ class BackgroundCompiler : public ThreadPool::Task {
|
| Monitor* queue_monitor_; // Controls access to the queue.
|
| Monitor* done_monitor_; // Notify/wait that the thread is done.
|
|
|
| - intptr_t queue_length_; // Lightweight access to length of compiler queue.
|
| + // Lightweight access to length of compiler queue.
|
| + intptr_t function_queue_length_;
|
|
|
| DISALLOW_IMPLICIT_CONSTRUCTORS(BackgroundCompiler);
|
| };
|
|
|