| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 explicit OptimizingCompilerThread(Isolate *isolate) : | 48 explicit OptimizingCompilerThread(Isolate *isolate) : |
| 49 Thread("OptimizingCompilerThread"), | 49 Thread("OptimizingCompilerThread"), |
| 50 #ifdef DEBUG | 50 #ifdef DEBUG |
| 51 thread_id_(0), | 51 thread_id_(0), |
| 52 #endif | 52 #endif |
| 53 isolate_(isolate), | 53 isolate_(isolate), |
| 54 stop_semaphore_(0), | 54 stop_semaphore_(0), |
| 55 input_queue_semaphore_(0), | 55 input_queue_semaphore_(0), |
| 56 osr_cursor_(0), | 56 osr_cursor_(0), |
| 57 osr_hits_(0), | 57 osr_hits_(0), |
| 58 osr_attempts_(0) { | 58 osr_attempts_(0), |
| 59 blocked_jobs_(0) { |
| 59 NoBarrier_Store(&stop_thread_, static_cast<AtomicWord>(CONTINUE)); | 60 NoBarrier_Store(&stop_thread_, static_cast<AtomicWord>(CONTINUE)); |
| 60 NoBarrier_Store(&queue_length_, static_cast<AtomicWord>(0)); | 61 NoBarrier_Store(&queue_length_, static_cast<AtomicWord>(0)); |
| 61 if (FLAG_concurrent_osr) { | 62 if (FLAG_concurrent_osr) { |
| 62 osr_buffer_size_ = FLAG_concurrent_recompilation_queue_length + 4; | 63 osr_buffer_size_ = FLAG_concurrent_recompilation_queue_length + 4; |
| 63 osr_buffer_ = NewArray<RecompileJob*>(osr_buffer_size_); | 64 osr_buffer_ = NewArray<RecompileJob*>(osr_buffer_size_); |
| 64 for (int i = 0; i < osr_buffer_size_; i++) osr_buffer_[i] = NULL; | 65 for (int i = 0; i < osr_buffer_size_; i++) osr_buffer_[i] = NULL; |
| 65 } | 66 } |
| 66 } | 67 } |
| 67 | 68 |
| 68 ~OptimizingCompilerThread() { | 69 ~OptimizingCompilerThread() { |
| 69 if (FLAG_concurrent_osr) DeleteArray(osr_buffer_); | 70 if (FLAG_concurrent_osr) DeleteArray(osr_buffer_); |
| 70 } | 71 } |
| 71 | 72 |
| 72 void Run(); | 73 void Run(); |
| 73 void Stop(); | 74 void Stop(); |
| 74 void Flush(); | 75 void Flush(); |
| 75 void QueueForOptimization(RecompileJob* optimizing_compiler); | 76 void QueueForOptimization(RecompileJob* optimizing_compiler); |
| 77 void Unblock(); |
| 76 void InstallOptimizedFunctions(); | 78 void InstallOptimizedFunctions(); |
| 77 RecompileJob* FindReadyOSRCandidate(Handle<JSFunction> function, | 79 RecompileJob* FindReadyOSRCandidate(Handle<JSFunction> function, |
| 78 uint32_t osr_pc_offset); | 80 uint32_t osr_pc_offset); |
| 79 bool IsQueuedForOSR(Handle<JSFunction> function, uint32_t osr_pc_offset); | 81 bool IsQueuedForOSR(Handle<JSFunction> function, uint32_t osr_pc_offset); |
| 80 | 82 |
| 81 bool IsQueuedForOSR(JSFunction* function); | 83 bool IsQueuedForOSR(JSFunction* function); |
| 82 | 84 |
| 83 inline bool IsQueueAvailable() { | 85 inline bool IsQueueAvailable() { |
| 84 // We don't need a barrier since we have a data dependency right | 86 // We don't need a barrier since we have a data dependency right |
| 85 // after. | 87 // after. |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 int osr_cursor_; | 136 int osr_cursor_; |
| 135 int osr_buffer_size_; | 137 int osr_buffer_size_; |
| 136 | 138 |
| 137 volatile AtomicWord stop_thread_; | 139 volatile AtomicWord stop_thread_; |
| 138 volatile Atomic32 queue_length_; | 140 volatile Atomic32 queue_length_; |
| 139 TimeDelta time_spent_compiling_; | 141 TimeDelta time_spent_compiling_; |
| 140 TimeDelta time_spent_total_; | 142 TimeDelta time_spent_total_; |
| 141 | 143 |
| 142 int osr_hits_; | 144 int osr_hits_; |
| 143 int osr_attempts_; | 145 int osr_attempts_; |
| 146 |
| 147 int blocked_jobs_; |
| 144 }; | 148 }; |
| 145 | 149 |
| 146 } } // namespace v8::internal | 150 } } // namespace v8::internal |
| 147 | 151 |
| 148 #endif // V8_OPTIMIZING_COMPILER_THREAD_H_ | 152 #endif // V8_OPTIMIZING_COMPILER_THREAD_H_ |
| OLD | NEW |