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 26 matching lines...) Expand all Loading... | |
37 namespace internal { | 37 namespace internal { |
38 | 38 |
39 class HGraphBuilder; | 39 class HGraphBuilder; |
40 class OptimizingCompiler; | 40 class OptimizingCompiler; |
41 class SharedFunctionInfo; | 41 class SharedFunctionInfo; |
42 | 42 |
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 | |
48 thread_id_(0), | |
Yang
2012/11/23 15:46:20
Initialize this to make valgrind happy.
| |
49 #endif | |
47 isolate_(isolate), | 50 isolate_(isolate), |
48 stop_semaphore_(OS::CreateSemaphore(0)), | 51 stop_semaphore_(OS::CreateSemaphore(0)), |
49 input_queue_semaphore_(OS::CreateSemaphore(0)), | 52 input_queue_semaphore_(OS::CreateSemaphore(0)), |
50 output_queue_semaphore_(OS::CreateSemaphore(0)), | 53 output_queue_semaphore_(OS::CreateSemaphore(0)), |
51 time_spent_compiling_(0), | 54 time_spent_compiling_(0), |
52 time_spent_total_(0) { | 55 time_spent_total_(0) { |
53 NoBarrier_Store(&stop_thread_, static_cast<AtomicWord>(false)); | 56 NoBarrier_Store(&stop_thread_, static_cast<AtomicWord>(false)); |
54 NoBarrier_Store(&queue_length_, static_cast<AtomicWord>(0)); | 57 NoBarrier_Store(&queue_length_, static_cast<AtomicWord>(0)); |
55 } | 58 } |
56 | 59 |
(...skipping 17 matching lines...) Expand all Loading... | |
74 // doesn't introduce a race -- queue_length_ may decreased in | 77 // doesn't introduce a race -- queue_length_ may decreased in |
75 // meantime, but not increased. | 78 // meantime, but not increased. |
76 return (current_length < FLAG_parallel_recompilation_queue_length); | 79 return (current_length < FLAG_parallel_recompilation_queue_length); |
77 } | 80 } |
78 | 81 |
79 #ifdef DEBUG | 82 #ifdef DEBUG |
80 bool IsOptimizerThread(); | 83 bool IsOptimizerThread(); |
81 #endif | 84 #endif |
82 | 85 |
83 ~OptimizingCompilerThread() { | 86 ~OptimizingCompilerThread() { |
87 delete output_queue_semaphore_; // Only used for manual mode. | |
84 delete input_queue_semaphore_; | 88 delete input_queue_semaphore_; |
85 delete output_queue_semaphore_; // Only used for manual mode. | |
86 delete stop_semaphore_; | 89 delete stop_semaphore_; |
87 } | 90 } |
88 | 91 |
89 private: | 92 private: |
93 #ifdef DEBUG | |
94 int thread_id_; | |
95 #endif | |
96 | |
90 Isolate* isolate_; | 97 Isolate* isolate_; |
91 Semaphore* stop_semaphore_; | 98 Semaphore* stop_semaphore_; |
92 Semaphore* input_queue_semaphore_; | 99 Semaphore* input_queue_semaphore_; |
93 Semaphore* output_queue_semaphore_; | 100 Semaphore* output_queue_semaphore_; |
94 UnboundQueue<OptimizingCompiler*> input_queue_; | 101 UnboundQueue<OptimizingCompiler*> input_queue_; |
95 UnboundQueue<OptimizingCompiler*> output_queue_; | 102 UnboundQueue<OptimizingCompiler*> output_queue_; |
96 volatile AtomicWord stop_thread_; | 103 volatile AtomicWord stop_thread_; |
97 volatile Atomic32 queue_length_; | 104 volatile Atomic32 queue_length_; |
98 int64_t time_spent_compiling_; | 105 int64_t time_spent_compiling_; |
99 int64_t time_spent_total_; | 106 int64_t time_spent_total_; |
100 | |
101 #ifdef DEBUG | |
102 int thread_id_; | |
103 #endif | |
104 }; | 107 }; |
105 | 108 |
106 } } // namespace v8::internal | 109 } } // namespace v8::internal |
107 | 110 |
108 #endif // V8_OPTIMIZING_COMPILER_THREAD_H_ | 111 #endif // V8_OPTIMIZING_COMPILER_THREAD_H_ |
OLD | NEW |