Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(139)

Side by Side Diff: src/unbound-queue.h

Issue 17294004: Fix data race in v8::internal::UnboundQueue (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Dmitry's comments addressed: added NoBarrier_Load Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/optimizing-compiler-thread.cc ('k') | src/unbound-queue-inl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 28 matching lines...) Expand all
39 // consumer. Doesn't have restrictions on the number of queued 39 // consumer. Doesn't have restrictions on the number of queued
40 // elements, so producer never blocks. Implemented after Herb 40 // elements, so producer never blocks. Implemented after Herb
41 // Sutter's article: 41 // Sutter's article:
42 // http://www.ddj.com/high-performance-computing/210604448 42 // http://www.ddj.com/high-performance-computing/210604448
43 template<typename Record> 43 template<typename Record>
44 class UnboundQueue BASE_EMBEDDED { 44 class UnboundQueue BASE_EMBEDDED {
45 public: 45 public:
46 inline UnboundQueue(); 46 inline UnboundQueue();
47 inline ~UnboundQueue(); 47 inline ~UnboundQueue();
48 48
49 INLINE(void Dequeue(Record* rec)); 49 INLINE(bool Dequeue(Record* rec));
50 INLINE(void Enqueue(const Record& rec)); 50 INLINE(void Enqueue(const Record& rec));
51 INLINE(bool IsEmpty()) { return divider_ == last_; } 51 INLINE(bool IsEmpty() const);
52 INLINE(Record* Peek()); 52 INLINE(Record* Peek() const);
53 53
54 private: 54 private:
55 INLINE(void DeleteFirst()); 55 INLINE(void DeleteFirst());
56 56
57 struct Node; 57 struct Node;
58 58
59 Node* first_; 59 Node* first_;
60 AtomicWord divider_; // Node* 60 AtomicWord divider_; // Node*
61 AtomicWord last_; // Node* 61 AtomicWord last_; // Node*
62 62
63 DISALLOW_COPY_AND_ASSIGN(UnboundQueue); 63 DISALLOW_COPY_AND_ASSIGN(UnboundQueue);
64 }; 64 };
65 65
66 66
67 } } // namespace v8::internal 67 } } // namespace v8::internal
68 68
69 #endif // V8_UNBOUND_QUEUE_ 69 #endif // V8_UNBOUND_QUEUE_
OLDNEW
« no previous file with comments | « src/optimizing-compiler-thread.cc ('k') | src/unbound-queue-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698