v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
circular-queue-inl.h
Go to the documentation of this file.
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
3// found in the LICENSE file.
4
5#ifndef V8_PROFILER_CIRCULAR_QUEUE_INL_H_
6#define V8_PROFILER_CIRCULAR_QUEUE_INL_H_
7
9// Include the non-inl header before the rest of the headers.
10
11namespace v8 {
12namespace internal {
13
14template<typename T, unsigned L>
16 : enqueue_pos_(buffer_),
17 dequeue_pos_(buffer_) {
18}
19
20template <typename T, unsigned L>
22
23template<typename T, unsigned L>
26 if (base::Acquire_Load(&dequeue_pos_->marker) == kFull) {
27 return &dequeue_pos_->record;
28 }
29 return nullptr;
30}
32
33template<typename T, unsigned L>
35 base::Release_Store(&dequeue_pos_->marker, kEmpty);
36 dequeue_pos_ = Next(dequeue_pos_);
37}
38
39
40template<typename T, unsigned L>
43 if (base::Acquire_Load(&enqueue_pos_->marker) == kEmpty) {
44 return &enqueue_pos_->record;
45 }
46 return nullptr;
47}
48
49
50template<typename T, unsigned L>
52 base::Release_Store(&enqueue_pos_->marker, kFull);
53 enqueue_pos_ = Next(enqueue_pos_);
54}
55
56
57template<typename T, unsigned L>
59 Entry* entry) {
60 Entry* next = entry + 1;
61 if (next == &buffer_[L]) return buffer_;
62 return next;
63}
64
65} // namespace internal
66} // namespace v8
67
68#endif // V8_PROFILER_CIRCULAR_QUEUE_INL_H_
base::OwnedVector< uint8_t > buffer_
Definition assembler.cc:111
Atomic8 Acquire_Load(volatile const Atomic8 *ptr)
Definition atomicops.h:249
void SeqCst_MemoryFence()
Definition atomicops.h:91
void Release_Store(volatile Atomic8 *ptr, Atomic8 value)
Definition atomicops.h:204
constexpr int L