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

Unified Diff: src/optimizing-compiler-thread.h

Issue 153953005: A64: Synchronize with r16993. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 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/objects-inl.h ('k') | src/optimizing-compiler-thread.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/optimizing-compiler-thread.h
diff --git a/src/optimizing-compiler-thread.h b/src/optimizing-compiler-thread.h
index 42317657024fbc3ced25ec8381d231225728e29c..2165a4fba20bf74bf6458941be4330fefb633554 100644
--- a/src/optimizing-compiler-thread.h
+++ b/src/optimizing-compiler-thread.h
@@ -40,7 +40,7 @@ namespace v8 {
namespace internal {
class HOptimizedGraphBuilder;
-class OptimizingCompiler;
+class RecompileJob;
class SharedFunctionInfo;
class OptimizingCompilerThread : public Thread {
@@ -53,22 +53,29 @@ class OptimizingCompilerThread : public Thread {
isolate_(isolate),
stop_semaphore_(0),
input_queue_semaphore_(0),
- osr_candidates_(2),
- ready_for_osr_(2),
+ osr_cursor_(0),
osr_hits_(0),
osr_attempts_(0) {
NoBarrier_Store(&stop_thread_, static_cast<AtomicWord>(CONTINUE));
NoBarrier_Store(&queue_length_, static_cast<AtomicWord>(0));
+ if (FLAG_concurrent_osr) {
+ osr_buffer_size_ = FLAG_concurrent_recompilation_queue_length + 4;
+ osr_buffer_ = NewArray<RecompileJob*>(osr_buffer_size_);
+ for (int i = 0; i < osr_buffer_size_; i++) osr_buffer_[i] = NULL;
+ }
+ }
+
+ ~OptimizingCompilerThread() {
+ if (FLAG_concurrent_osr) DeleteArray(osr_buffer_);
}
- ~OptimizingCompilerThread() {}
void Run();
void Stop();
void Flush();
- void QueueForOptimization(OptimizingCompiler* optimizing_compiler);
+ void QueueForOptimization(RecompileJob* optimizing_compiler);
void InstallOptimizedFunctions();
- OptimizingCompiler* FindReadyOSRCandidate(Handle<JSFunction> function,
- uint32_t osr_pc_offset);
+ RecompileJob* FindReadyOSRCandidate(Handle<JSFunction> function,
+ uint32_t osr_pc_offset);
bool IsQueuedForOSR(Handle<JSFunction> function, uint32_t osr_pc_offset);
bool IsQueuedForOSR(JSFunction* function);
@@ -94,14 +101,18 @@ class OptimizingCompilerThread : public Thread {
private:
enum StopFlag { CONTINUE, STOP, FLUSH };
- // Remove the oldest OSR candidates that are ready so that we
- // only have |limit| left waiting.
- void RemoveStaleOSRCandidates(int limit = kReadyForOSRLimit);
-
void FlushInputQueue(bool restore_function_code);
void FlushOutputQueue(bool restore_function_code);
+ void FlushOsrBuffer(bool restore_function_code);
void CompileNext();
+ // Add a recompilation task for OSR to the cyclic buffer, awaiting OSR entry.
+ // Tasks evicted from the cyclic buffer are discarded.
+ void AddToOsrBuffer(RecompileJob* compiler);
+ void AdvanceOsrCursor() {
+ osr_cursor_ = (osr_cursor_ + 1) % osr_buffer_size_;
+ }
+
#ifdef DEBUG
int thread_id_;
Mutex thread_id_mutex_;
@@ -112,13 +123,16 @@ class OptimizingCompilerThread : public Thread {
Semaphore input_queue_semaphore_;
// Queue of incoming recompilation tasks (including OSR).
- UnboundQueue<OptimizingCompiler*> input_queue_;
+ UnboundQueue<RecompileJob*> input_queue_;
// Queue of recompilation tasks ready to be installed (excluding OSR).
- UnboundQueue<OptimizingCompiler*> output_queue_;
- // List of recompilation tasks for OSR in the input queue.
- List<OptimizingCompiler*> osr_candidates_;
- // List of recompilation tasks ready for OSR.
- List<OptimizingCompiler*> ready_for_osr_;
+ UnboundQueue<RecompileJob*> output_queue_;
+ // Cyclic buffer of recompilation tasks for OSR.
+ // TODO(yangguo): This may keep zombie tasks indefinitely, holding on to
+ // a lot of memory. Fix this.
+ RecompileJob** osr_buffer_;
+ // Cursor for the cyclic buffer.
+ int osr_cursor_;
+ int osr_buffer_size_;
volatile AtomicWord stop_thread_;
volatile Atomic32 queue_length_;
@@ -127,11 +141,8 @@ class OptimizingCompilerThread : public Thread {
// TODO(yangguo): remove this once the memory leak has been figured out.
Mutex queue_mutex_;
- Mutex osr_list_mutex_;
int osr_hits_;
int osr_attempts_;
-
- static const int kReadyForOSRLimit = 4;
};
} } // namespace v8::internal
« no previous file with comments | « src/objects-inl.h ('k') | src/optimizing-compiler-thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698