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

Unified Diff: src/optimizing-compile-dispatcher.h

Issue 1059853004: Reland "Remove support for thread-based recompilation" (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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/objects.cc ('k') | src/optimizing-compile-dispatcher.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/optimizing-compile-dispatcher.h
diff --git a/src/optimizing-compiler-thread.h b/src/optimizing-compile-dispatcher.h
similarity index 71%
rename from src/optimizing-compiler-thread.h
rename to src/optimizing-compile-dispatcher.h
index 7d60d9bf74556317754537296059a29f6336757d..822bb40b317ee753dc30619d236fbc54190b9f23 100644
--- a/src/optimizing-compiler-thread.h
+++ b/src/optimizing-compile-dispatcher.h
@@ -2,17 +2,17 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef V8_OPTIMIZING_COMPILER_THREAD_H_
-#define V8_OPTIMIZING_COMPILER_THREAD_H_
+#ifndef V8_OPTIMIZING_COMPILE_DISPATCHER_H_
+#define V8_OPTIMIZING_COMPILE_DISPATCHER_H_
+
+#include <queue>
#include "src/base/atomicops.h"
#include "src/base/platform/condition-variable.h"
#include "src/base/platform/mutex.h"
#include "src/base/platform/platform.h"
-#include "src/base/platform/time.h"
#include "src/flags.h"
#include "src/list.h"
-#include "src/unbound-queue-inl.h"
namespace v8 {
namespace internal {
@@ -21,16 +21,10 @@ class HOptimizedGraphBuilder;
class OptimizedCompileJob;
class SharedFunctionInfo;
-class OptimizingCompilerThread : public base::Thread {
+class OptimizingCompileDispatcher {
public:
- explicit OptimizingCompilerThread(Isolate* isolate)
- : Thread(Options("OptimizingCompilerThread")),
-#ifdef DEBUG
- thread_id_(0),
-#endif
- isolate_(isolate),
- stop_semaphore_(0),
- input_queue_semaphore_(0),
+ explicit OptimizingCompileDispatcher(Isolate* isolate)
+ : isolate_(isolate),
input_queue_capacity_(FLAG_concurrent_recompilation_queue_length),
input_queue_length_(0),
input_queue_shift_(0),
@@ -40,11 +34,8 @@ class OptimizingCompilerThread : public base::Thread {
osr_attempts_(0),
blocked_jobs_(0),
ref_count_(0),
- tracing_enabled_(FLAG_trace_concurrent_recompilation),
- job_based_recompilation_(FLAG_job_based_recompilation),
recompilation_delay_(FLAG_concurrent_recompilation_delay) {
- base::NoBarrier_Store(&stop_thread_,
- static_cast<base::AtomicWord>(CONTINUE));
+ base::NoBarrier_Store(&mode_, static_cast<base::AtomicWord>(COMPILE));
input_queue_ = NewArray<OptimizedCompileJob*>(input_queue_capacity_);
if (FLAG_concurrent_osr) {
// Allocate and mark OSR buffer slots as empty.
@@ -53,7 +44,7 @@ class OptimizingCompilerThread : public base::Thread {
}
}
- ~OptimizingCompilerThread();
+ ~OptimizingCompileDispatcher();
void Run();
void Stop();
@@ -83,17 +74,11 @@ class OptimizingCompilerThread : public base::Thread {
return (FLAG_concurrent_recompilation && max_available > 1);
}
-#ifdef DEBUG
- static bool IsOptimizerThread(Isolate* isolate);
- bool IsOptimizerThread();
-#endif
-
private:
class CompileTask;
- enum StopFlag { CONTINUE, STOP, FLUSH };
+ enum ModeFlag { COMPILE, FLUSH };
- void FlushInputQueue(bool restore_function_code);
void FlushOutputQueue(bool restore_function_code);
void FlushOsrBuffer(bool restore_function_code);
void CompileNext(OptimizedCompileJob* job);
@@ -110,14 +95,7 @@ class OptimizingCompilerThread : public base::Thread {
return result;
}
-#ifdef DEBUG
- int thread_id_;
- base::Mutex thread_id_mutex_;
-#endif
-
Isolate* isolate_;
- base::Semaphore stop_semaphore_;
- base::Semaphore input_queue_semaphore_;
// Circular queue of incoming recompilation tasks (including OSR).
OptimizedCompileJob** input_queue_;
@@ -127,7 +105,7 @@ class OptimizingCompilerThread : public base::Thread {
base::Mutex input_queue_mutex_;
// Queue of recompilation tasks ready to be installed (excluding OSR).
- UnboundQueue<OptimizedCompileJob*> output_queue_;
+ std::queue<OptimizedCompileJob*> output_queue_;
// Used for job based recompilation which has multiple producers on
// different threads.
base::Mutex output_queue_mutex_;
@@ -137,9 +115,7 @@ class OptimizingCompilerThread : public base::Thread {
int osr_buffer_capacity_;
int osr_buffer_cursor_;
- volatile base::AtomicWord stop_thread_;
- base::TimeDelta time_spent_compiling_;
- base::TimeDelta time_spent_total_;
+ volatile base::AtomicWord mode_;
int osr_hits_;
int osr_attempts_;
@@ -150,17 +126,14 @@ class OptimizingCompilerThread : public base::Thread {
base::Mutex ref_count_mutex_;
base::ConditionVariable ref_count_zero_;
- // Copies of FLAG_trace_concurrent_recompilation,
- // FLAG_concurrent_recompilation_delay and
- // FLAG_job_based_recompilation that will be used from the background thread.
+ // Copy of FLAG_concurrent_recompilation_delay that will be used from the
+ // background thread.
//
// Since flags might get modified while the background thread is running, it
// is not safe to access them directly.
- bool tracing_enabled_;
- bool job_based_recompilation_;
int recompilation_delay_;
};
+}
+} // namespace v8::internal
-} } // namespace v8::internal
-
-#endif // V8_OPTIMIZING_COMPILER_THREAD_H_
+#endif // V8_OPTIMIZING_COMPILE_DISPATCHER_H_
« no previous file with comments | « src/objects.cc ('k') | src/optimizing-compile-dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698