OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 class OptimizingCompilerThread : public Thread { | 43 class OptimizingCompilerThread : public Thread { |
44 public: | 44 public: |
45 explicit OptimizingCompilerThread(Isolate *isolate) : | 45 explicit OptimizingCompilerThread(Isolate *isolate) : |
46 Thread("OptimizingCompilerThread"), | 46 Thread("OptimizingCompilerThread"), |
47 #ifdef DEBUG | 47 #ifdef DEBUG |
48 thread_id_(0), | 48 thread_id_(0), |
49 #endif | 49 #endif |
50 isolate_(isolate), | 50 isolate_(isolate), |
51 stop_semaphore_(OS::CreateSemaphore(0)), | 51 stop_semaphore_(OS::CreateSemaphore(0)), |
52 input_queue_semaphore_(OS::CreateSemaphore(0)), | 52 input_queue_semaphore_(OS::CreateSemaphore(0)), |
| 53 install_mutex_(OS::CreateMutex()), |
53 time_spent_compiling_(0), | 54 time_spent_compiling_(0), |
54 time_spent_total_(0) { | 55 time_spent_total_(0) { |
55 NoBarrier_Store(&stop_thread_, static_cast<AtomicWord>(false)); | 56 NoBarrier_Store(&stop_thread_, static_cast<AtomicWord>(false)); |
56 NoBarrier_Store(&queue_length_, static_cast<AtomicWord>(0)); | 57 NoBarrier_Store(&queue_length_, static_cast<AtomicWord>(0)); |
57 } | 58 } |
58 | 59 |
59 void Run(); | 60 void Run(); |
60 void Stop(); | 61 void Stop(); |
61 void CompileNext(); | 62 void CompileNext(); |
62 void QueueForOptimization(OptimizingCompiler* optimizing_compiler); | 63 void QueueForOptimization(OptimizingCompiler* optimizing_compiler); |
(...skipping 25 matching lines...) Expand all Loading... |
88 private: | 89 private: |
89 #ifdef DEBUG | 90 #ifdef DEBUG |
90 int thread_id_; | 91 int thread_id_; |
91 #endif | 92 #endif |
92 | 93 |
93 Isolate* isolate_; | 94 Isolate* isolate_; |
94 Semaphore* stop_semaphore_; | 95 Semaphore* stop_semaphore_; |
95 Semaphore* input_queue_semaphore_; | 96 Semaphore* input_queue_semaphore_; |
96 UnboundQueue<OptimizingCompiler*> input_queue_; | 97 UnboundQueue<OptimizingCompiler*> input_queue_; |
97 UnboundQueue<OptimizingCompiler*> output_queue_; | 98 UnboundQueue<OptimizingCompiler*> output_queue_; |
| 99 Mutex* install_mutex_; |
98 volatile AtomicWord stop_thread_; | 100 volatile AtomicWord stop_thread_; |
99 volatile Atomic32 queue_length_; | 101 volatile Atomic32 queue_length_; |
100 int64_t time_spent_compiling_; | 102 int64_t time_spent_compiling_; |
101 int64_t time_spent_total_; | 103 int64_t time_spent_total_; |
102 }; | 104 }; |
103 | 105 |
104 } } // namespace v8::internal | 106 } } // namespace v8::internal |
105 | 107 |
106 #endif // V8_OPTIMIZING_COMPILER_THREAD_H_ | 108 #endif // V8_OPTIMIZING_COMPILER_THREAD_H_ |
OLD | NEW |