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

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

Issue 10417010: Run Crankshaft on a separate thread. (Closed) Base URL: https://chromiumcodereview.appspot.com/10387157
Patch Set: Set optimize_in_parallel to false by default. Created 8 years, 7 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-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/test/mjsunit/count-based-osr.js b/src/optimizing-compiler-thread.h
similarity index 61%
copy from test/mjsunit/count-based-osr.js
copy to src/optimizing-compiler-thread.h
index 125c4e26d5c641b947def268f236876eb9f3e6c1..3a1eee785877a34f09bff7fd04475cbaacb9a314 100644
--- a/test/mjsunit/count-based-osr.js
+++ b/src/optimizing-compiler-thread.h
@@ -25,14 +25,45 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-// Flags: --count-based-interrupts --interrupt-budget=10 --weighted-back-edges --allow-natives-syntax
+#ifndef V8_OPTIMIZING_COMPILER_THREAD_H_
+#define V8_OPTIMIZING_COMPILER_THREAD_H_
-// Test that OSR works properly when using count-based interrupting/profiling.
+#include "v8.h"
-function osr_this() {
- var a = 1;
- // Trigger OSR.
- while (%GetOptimizationStatus(osr_this) == 2) {}
- return a;
-}
-assertEquals(1, osr_this());
+#include "atomicops.h"
+#include "objects.h"
+#include "platform.h"
+#include "unbound-queue.h"
+
+namespace v8 {
+namespace internal {
+
+class OptimizingCompilerThread : public Thread {
+ public:
+ explicit OptimizingCompilerThread(Isolate *i) :
+ Thread("OptimizingCompilerThread"), isolate_(i) {
+ queue_semaphore_ = OS::CreateSemaphore(0);
+ queue_mutex_ = OS::CreateMutex();
+ NoBarrier_Store(&stop_thread_, static_cast<AtomicWord>(false));
+ }
+
+ void Run();
+ void StopThread();
+ void QueueForOptimization(Handle<JSFunction> function);
+
+ ~OptimizingCompilerThread() {
+ delete queue_semaphore_;
+ delete queue_mutex_;
+ }
+
+ private:
+ Isolate* isolate_;
+ Mutex* queue_mutex_;
+ UnboundQueue<Handle<JSFunction> > queue_;
+ Semaphore* queue_semaphore_;
+ volatile AtomicWord stop_thread_;
+};
+
+} } // namespace v8::internal
+
+#endif // V8_OPTIMIZING_COMPILER_THREAD_H_
« no previous file with comments | « src/objects.cc ('k') | src/optimizing-compiler-thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698