OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 29 matching lines...) Expand all Loading... |
40 // http://www.ddj.com/high-performance-computing/210604448 | 40 // http://www.ddj.com/high-performance-computing/210604448 |
41 template<typename Record> | 41 template<typename Record> |
42 class UnboundQueue BASE_EMBEDDED { | 42 class UnboundQueue BASE_EMBEDDED { |
43 public: | 43 public: |
44 inline UnboundQueue(); | 44 inline UnboundQueue(); |
45 inline ~UnboundQueue(); | 45 inline ~UnboundQueue(); |
46 | 46 |
47 INLINE(void Dequeue(Record* rec)); | 47 INLINE(void Dequeue(Record* rec)); |
48 INLINE(void Enqueue(const Record& rec)); | 48 INLINE(void Enqueue(const Record& rec)); |
49 INLINE(bool IsEmpty()) { return divider_ == last_; } | 49 INLINE(bool IsEmpty()) { return divider_ == last_; } |
| 50 INLINE(Record* Peek()); |
50 | 51 |
51 private: | 52 private: |
52 INLINE(void DeleteFirst()); | 53 INLINE(void DeleteFirst()); |
53 | 54 |
54 struct Node; | 55 struct Node; |
55 | 56 |
56 Node* first_; | 57 Node* first_; |
57 AtomicWord divider_; // Node* | 58 AtomicWord divider_; // Node* |
58 AtomicWord last_; // Node* | 59 AtomicWord last_; // Node* |
59 | 60 |
60 DISALLOW_COPY_AND_ASSIGN(UnboundQueue); | 61 DISALLOW_COPY_AND_ASSIGN(UnboundQueue); |
61 }; | 62 }; |
62 | 63 |
63 | 64 |
64 } } // namespace v8::internal | 65 } } // namespace v8::internal |
65 | 66 |
66 #endif // V8_UNBOUND_QUEUE_ | 67 #endif // V8_UNBOUND_QUEUE_ |
OLD | NEW |