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 27 matching lines...) Expand all Loading... |
38 | 38 |
39 class HGraphBuilder; | 39 class HGraphBuilder; |
40 class OptimizingCompiler; | 40 class OptimizingCompiler; |
41 | 41 |
42 class OptimizingCompilerThread : public Thread { | 42 class OptimizingCompilerThread : public Thread { |
43 public: | 43 public: |
44 explicit OptimizingCompilerThread(Isolate *isolate) : | 44 explicit OptimizingCompilerThread(Isolate *isolate) : |
45 Thread("OptimizingCompilerThread"), | 45 Thread("OptimizingCompilerThread"), |
46 isolate_(isolate), | 46 isolate_(isolate), |
47 stop_semaphore_(OS::CreateSemaphore(0)), | 47 stop_semaphore_(OS::CreateSemaphore(0)), |
48 input_queue_semaphore_(OS::CreateSemaphore(0)) { | 48 input_queue_semaphore_(OS::CreateSemaphore(0)), |
| 49 time_spent_compiling_(0), |
| 50 time_spent_total_(0) { |
49 NoBarrier_Store(&stop_thread_, static_cast<AtomicWord>(false)); | 51 NoBarrier_Store(&stop_thread_, static_cast<AtomicWord>(false)); |
50 NoBarrier_Store(&queue_length_, static_cast<AtomicWord>(0)); | 52 NoBarrier_Store(&queue_length_, static_cast<AtomicWord>(0)); |
51 } | 53 } |
52 | 54 |
53 void Run(); | 55 void Run(); |
54 void Stop(); | 56 void Stop(); |
55 void QueueForOptimization(OptimizingCompiler* optimizing_compiler); | 57 void QueueForOptimization(OptimizingCompiler* optimizing_compiler); |
56 void InstallOptimizedFunctions(); | 58 void InstallOptimizedFunctions(); |
57 | 59 |
58 inline bool IsQueueAvailable() { | 60 inline bool IsQueueAvailable() { |
(...skipping 20 matching lines...) Expand all Loading... |
79 } | 81 } |
80 | 82 |
81 private: | 83 private: |
82 Isolate* isolate_; | 84 Isolate* isolate_; |
83 Semaphore* stop_semaphore_; | 85 Semaphore* stop_semaphore_; |
84 Semaphore* input_queue_semaphore_; | 86 Semaphore* input_queue_semaphore_; |
85 UnboundQueue<OptimizingCompiler*> input_queue_; | 87 UnboundQueue<OptimizingCompiler*> input_queue_; |
86 UnboundQueue<OptimizingCompiler*> output_queue_; | 88 UnboundQueue<OptimizingCompiler*> output_queue_; |
87 volatile AtomicWord stop_thread_; | 89 volatile AtomicWord stop_thread_; |
88 volatile Atomic32 queue_length_; | 90 volatile Atomic32 queue_length_; |
| 91 int64_t time_spent_compiling_; |
| 92 int64_t time_spent_total_; |
89 | 93 |
90 #ifdef DEBUG | 94 #ifdef DEBUG |
91 int thread_id_; | 95 int thread_id_; |
92 #endif | 96 #endif |
93 }; | 97 }; |
94 | 98 |
95 } } // namespace v8::internal | 99 } } // namespace v8::internal |
96 | 100 |
97 #endif // V8_OPTIMIZING_COMPILER_THREAD_H_ | 101 #endif // V8_OPTIMIZING_COMPILER_THREAD_H_ |
OLD | NEW |