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

Side by Side Diff: Source/platform/Timer.cpp

Issue 1120943002: Various ASan exemptions to allow Oilpan pre-sweep poisoning of unmarkeds. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebased Created 5 years, 7 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2009 Google Inc. All rights reserved. 3 * Copyright (C) 2009 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 11 matching lines...) Expand all
22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */ 25 */
26 26
27 #include "config.h" 27 #include "config.h"
28 #include "platform/Timer.h" 28 #include "platform/Timer.h"
29 29
30 #include "platform/PlatformThreadData.h" 30 #include "platform/PlatformThreadData.h"
31 #include "platform/ThreadTimers.h" 31 #include "platform/ThreadTimers.h"
32 #include "platform/heap/AddressSanitizer.h"
32 #include "wtf/Atomics.h" 33 #include "wtf/Atomics.h"
33 #include "wtf/CurrentTime.h" 34 #include "wtf/CurrentTime.h"
34 #include "wtf/HashSet.h" 35 #include "wtf/HashSet.h"
35 #include <algorithm> 36 #include <algorithm>
36 #include <limits.h> 37 #include <limits.h>
37 #include <limits> 38 #include <limits>
38 #include <math.h> 39 #include <math.h>
39 40
40 namespace blink { 41 namespace blink {
41 42
(...skipping 28 matching lines...) Expand all
70 TimerHeapReference& operator=(TimerHeapReference); 71 TimerHeapReference& operator=(TimerHeapReference);
71 private: 72 private:
72 TimerBase*& m_reference; 73 TimerBase*& m_reference;
73 }; 74 };
74 75
75 inline TimerHeapReference TimerHeapPointer::operator*() const 76 inline TimerHeapReference TimerHeapPointer::operator*() const
76 { 77 {
77 return *m_pointer; 78 return *m_pointer;
78 } 79 }
79 80
81 NO_LAZY_SWEEP_SANITIZE_ADDRESS
80 inline TimerHeapReference& TimerHeapReference::operator=(TimerBase* timer) 82 inline TimerHeapReference& TimerHeapReference::operator=(TimerBase* timer)
81 { 83 {
82 m_reference = timer; 84 m_reference = timer;
83 Vector<TimerBase*>& heap = timer->timerHeap(); 85 Vector<TimerBase*>& heap = timer->timerHeap();
84 if (&m_reference >= heap.data() && &m_reference < heap.data() + heap.size()) 86 if (&m_reference >= heap.data() && &m_reference < heap.data() + heap.size())
85 timer->m_heapIndex = &m_reference - heap.data(); 87 timer->m_heapIndex = &m_reference - heap.data();
86 return *this; 88 return *this;
87 } 89 }
88 90
91 NO_LAZY_SWEEP_SANITIZE_ADDRESS
89 inline TimerHeapReference& TimerHeapReference::operator=(TimerHeapReference b) 92 inline TimerHeapReference& TimerHeapReference::operator=(TimerHeapReference b)
90 { 93 {
91 TimerBase* timer = b; 94 TimerBase* timer = b;
92 return *this = timer; 95 return *this = timer;
93 } 96 }
94 97
95 inline void swap(TimerHeapReference a, TimerHeapReference b) 98 inline void swap(TimerHeapReference a, TimerHeapReference b)
96 { 99 {
97 TimerBase* timerA = a; 100 TimerBase* timerA = a;
98 TimerBase* timerB = b; 101 TimerBase* timerB = b;
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 inline TimerHeapIterator operator-(TimerHeapIterator a, size_t b) { return Timer HeapIterator(a.m_pointer - b); } 164 inline TimerHeapIterator operator-(TimerHeapIterator a, size_t b) { return Timer HeapIterator(a.m_pointer - b); }
162 inline ptrdiff_t operator-(TimerHeapIterator a, TimerHeapIterator b) { return a. m_pointer - b.m_pointer; } 165 inline ptrdiff_t operator-(TimerHeapIterator a, TimerHeapIterator b) { return a. m_pointer - b.m_pointer; }
163 166
164 // ---------------- 167 // ----------------
165 168
166 class TimerHeapLessThanFunction { 169 class TimerHeapLessThanFunction {
167 public: 170 public:
168 bool operator()(const TimerBase*, const TimerBase*) const; 171 bool operator()(const TimerBase*, const TimerBase*) const;
169 }; 172 };
170 173
174 NO_LAZY_SWEEP_SANITIZE_ADDRESS
171 inline bool TimerHeapLessThanFunction::operator()(const TimerBase* a, const Time rBase* b) const 175 inline bool TimerHeapLessThanFunction::operator()(const TimerBase* a, const Time rBase* b) const
172 { 176 {
173 // The comparisons below are "backwards" because the heap puts the largest 177 // The comparisons below are "backwards" because the heap puts the largest
174 // element first and we want the lowest time to be the first one in the heap . 178 // element first and we want the lowest time to be the first one in the heap .
175 double aFireTime = a->m_nextFireTime; 179 double aFireTime = a->m_nextFireTime;
176 double bFireTime = b->m_nextFireTime; 180 double bFireTime = b->m_nextFireTime;
177 if (bFireTime != aFireTime) 181 if (bFireTime != aFireTime)
178 return bFireTime < aFireTime; 182 return bFireTime < aFireTime;
179 183
180 // We need to look at the difference of the insertion orders instead of comp aring the two 184 // We need to look at the difference of the insertion orders instead of comp aring the two
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 } 287 }
284 288
285 inline void TimerBase::heapInsert() 289 inline void TimerBase::heapInsert()
286 { 290 {
287 ASSERT(!inHeap()); 291 ASSERT(!inHeap());
288 timerHeap().append(this); 292 timerHeap().append(this);
289 m_heapIndex = timerHeap().size() - 1; 293 m_heapIndex = timerHeap().size() - 1;
290 heapDecreaseKey(); 294 heapDecreaseKey();
291 } 295 }
292 296
297 NO_LAZY_SWEEP_SANITIZE_ADDRESS
293 inline void TimerBase::heapPop() 298 inline void TimerBase::heapPop()
294 { 299 {
295 // Temporarily force this timer to have the minimum key so we can pop it. 300 // Temporarily force this timer to have the minimum key so we can pop it.
296 double fireTime = m_nextFireTime; 301 double fireTime = m_nextFireTime;
297 m_nextFireTime = -std::numeric_limits<double>::infinity(); 302 m_nextFireTime = -std::numeric_limits<double>::infinity();
298 heapDecreaseKey(); 303 heapDecreaseKey();
299 heapPopMin(); 304 heapPopMin();
300 m_nextFireTime = fireTime; 305 m_nextFireTime = fireTime;
301 } 306 }
302 307
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 setNextFireTime(m_unalignedNextFireTime); 405 setNextFireTime(m_unalignedNextFireTime);
401 } 406 }
402 407
403 double TimerBase::nextUnalignedFireInterval() const 408 double TimerBase::nextUnalignedFireInterval() const
404 { 409 {
405 ASSERT(isActive()); 410 ASSERT(isActive());
406 return std::max(m_unalignedNextFireTime - monotonicallyIncreasingTime(), 0.0 ); 411 return std::max(m_unalignedNextFireTime - monotonicallyIncreasingTime(), 0.0 );
407 } 412 }
408 413
409 } // namespace blink 414 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698