OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 28 matching lines...) Expand all Loading... |
39 dequeue_pos_(buffer_) { | 39 dequeue_pos_(buffer_) { |
40 } | 40 } |
41 | 41 |
42 | 42 |
43 template<typename T, unsigned L> | 43 template<typename T, unsigned L> |
44 SamplingCircularQueue<T, L>::~SamplingCircularQueue() { | 44 SamplingCircularQueue<T, L>::~SamplingCircularQueue() { |
45 } | 45 } |
46 | 46 |
47 | 47 |
48 template<typename T, unsigned L> | 48 template<typename T, unsigned L> |
49 T* SamplingCircularQueue<T, L>::StartDequeue() { | 49 T* SamplingCircularQueue<T, L>::Peek() { |
50 MemoryBarrier(); | 50 MemoryBarrier(); |
51 if (Acquire_Load(&dequeue_pos_->marker) == kFull) { | 51 if (Acquire_Load(&dequeue_pos_->marker) == kFull) { |
52 return &dequeue_pos_->record; | 52 return &dequeue_pos_->record; |
53 } | 53 } |
54 return NULL; | 54 return NULL; |
55 } | 55 } |
56 | 56 |
57 | 57 |
58 template<typename T, unsigned L> | 58 template<typename T, unsigned L> |
59 void SamplingCircularQueue<T, L>::FinishDequeue() { | 59 void SamplingCircularQueue<T, L>::Remove() { |
60 Release_Store(&dequeue_pos_->marker, kEmpty); | 60 Release_Store(&dequeue_pos_->marker, kEmpty); |
61 dequeue_pos_ = Next(dequeue_pos_); | 61 dequeue_pos_ = Next(dequeue_pos_); |
62 } | 62 } |
63 | 63 |
64 | 64 |
65 template<typename T, unsigned L> | 65 template<typename T, unsigned L> |
66 T* SamplingCircularQueue<T, L>::StartEnqueue() { | 66 T* SamplingCircularQueue<T, L>::StartEnqueue() { |
67 MemoryBarrier(); | 67 MemoryBarrier(); |
68 if (Acquire_Load(&enqueue_pos_->marker) == kEmpty) { | 68 if (Acquire_Load(&enqueue_pos_->marker) == kEmpty) { |
69 return &enqueue_pos_->record; | 69 return &enqueue_pos_->record; |
(...skipping 13 matching lines...) Expand all Loading... |
83 typename SamplingCircularQueue<T, L>::Entry* SamplingCircularQueue<T, L>::Next( | 83 typename SamplingCircularQueue<T, L>::Entry* SamplingCircularQueue<T, L>::Next( |
84 Entry* entry) { | 84 Entry* entry) { |
85 Entry* next = entry + 1; | 85 Entry* next = entry + 1; |
86 if (next == &buffer_[L]) return buffer_; | 86 if (next == &buffer_[L]) return buffer_; |
87 return next; | 87 return next; |
88 } | 88 } |
89 | 89 |
90 } } // namespace v8::internal | 90 } } // namespace v8::internal |
91 | 91 |
92 #endif // V8_CIRCULAR_QUEUE_INL_H_ | 92 #endif // V8_CIRCULAR_QUEUE_INL_H_ |
OLD | NEW |