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

Side by Side Diff: runtime/vm/compiler.h

Issue 1409173002: More work for background compilation; move pending_functions_ from ObjectStore to Thread. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Better code. Created 5 years, 2 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 unified diff | Download patch
« no previous file with comments | « no previous file | runtime/vm/compiler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef VM_COMPILER_H_ 5 #ifndef VM_COMPILER_H_
6 #define VM_COMPILER_H_ 6 #define VM_COMPILER_H_
7 7
8 #include "vm/allocation.h" 8 #include "vm/allocation.h"
9 #include "vm/growable_array.h" 9 #include "vm/growable_array.h"
10 #include "vm/runtime_entry.h" 10 #include "vm/runtime_entry.h"
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 // Current implementation: one task per isolate, it dies with the owning 105 // Current implementation: one task per isolate, it dies with the owning
106 // isolate. 106 // isolate.
107 class BackgroundCompiler : public ThreadPool::Task { 107 class BackgroundCompiler : public ThreadPool::Task {
108 public: 108 public:
109 static void EnsureInit(Isolate* isolate); 109 static void EnsureInit(Isolate* isolate);
110 110
111 static void Stop(BackgroundCompiler* task); 111 static void Stop(BackgroundCompiler* task);
112 112
113 void CompileOptimized(const Function& function); 113 void CompileOptimized(const Function& function);
114 114
115 // Access to queue length is guarded with queue_monitor_;
116 intptr_t queue_length() const { return queue_length_; }
117 void set_queue_length(intptr_t value) { queue_length_ = value; }
118
115 private: 119 private:
116 explicit BackgroundCompiler(Isolate* isolate); 120 explicit BackgroundCompiler(Isolate* isolate);
117 121
118 virtual void Run(); 122 virtual void Run();
119 123
120 void Add(const Function& f) const; 124 void Add(const Function& f);
121 RawFunction* RemoveOrNull() const; 125 RawFunction* RemoveOrNull();
126 RawFunction* LastOrNull() const;
122 127
123 Isolate* isolate_; 128 Isolate* isolate_;
124 bool running_; 129 bool running_; // While true, will try to read queue and compile.
125 bool* done_; 130 bool* done_; // True if the thread is done.
126 Monitor* monitor_; 131 Monitor* queue_monitor_; // Controls access to the queue.
127 Monitor* done_monitor_; 132 Monitor* done_monitor_; // Notify/wait that the thread is done.
133
134 intptr_t queue_length_; // Lightweight access to length of compiler queue.
128 135
129 DISALLOW_IMPLICIT_CONSTRUCTORS(BackgroundCompiler); 136 DISALLOW_IMPLICIT_CONSTRUCTORS(BackgroundCompiler);
130 }; 137 };
131 138
132 } // namespace dart 139 } // namespace dart
133 140
134 #endif // VM_COMPILER_H_ 141 #endif // VM_COMPILER_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698