OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_PROFILER_CIRCULAR_QUEUE_INL_H_ | 5 #ifndef V8_PROFILER_CIRCULAR_QUEUE_INL_H_ |
6 #define V8_PROFILER_CIRCULAR_QUEUE_INL_H_ | 6 #define V8_PROFILER_CIRCULAR_QUEUE_INL_H_ |
7 | 7 |
8 #include "src/profiler/circular-queue.h" | 8 #include "src/profiler/circular-queue.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 return NULL; | 48 return NULL; |
49 } | 49 } |
50 | 50 |
51 | 51 |
52 template<typename T, unsigned L> | 52 template<typename T, unsigned L> |
53 void SamplingCircularQueue<T, L>::FinishEnqueue() { | 53 void SamplingCircularQueue<T, L>::FinishEnqueue() { |
54 base::Release_Store(&enqueue_pos_->marker, kFull); | 54 base::Release_Store(&enqueue_pos_->marker, kFull); |
55 enqueue_pos_ = Next(enqueue_pos_); | 55 enqueue_pos_ = Next(enqueue_pos_); |
56 } | 56 } |
57 | 57 |
| 58 template <typename T, unsigned L> |
| 59 T* SamplingCircularQueue<T, L>::CurrentEnqueue() { |
| 60 base::MemoryBarrier(); |
| 61 return &enqueue_pos_->record; |
| 62 } |
58 | 63 |
59 template<typename T, unsigned L> | 64 template<typename T, unsigned L> |
60 typename SamplingCircularQueue<T, L>::Entry* SamplingCircularQueue<T, L>::Next( | 65 typename SamplingCircularQueue<T, L>::Entry* SamplingCircularQueue<T, L>::Next( |
61 Entry* entry) { | 66 Entry* entry) { |
62 Entry* next = entry + 1; | 67 Entry* next = entry + 1; |
63 if (next == &buffer_[L]) return buffer_; | 68 if (next == &buffer_[L]) return buffer_; |
64 return next; | 69 return next; |
65 } | 70 } |
66 | 71 |
67 } // namespace internal | 72 } // namespace internal |
68 } // namespace v8 | 73 } // namespace v8 |
69 | 74 |
70 #endif // V8_PROFILER_CIRCULAR_QUEUE_INL_H_ | 75 #endif // V8_PROFILER_CIRCULAR_QUEUE_INL_H_ |
OLD | NEW |