OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef PageMemory_h | 5 #ifndef PageMemory_h |
6 #define PageMemory_h | 6 #define PageMemory_h |
7 | 7 |
8 #include "platform/heap/HeapPage.h" | 8 #include "platform/heap/HeapPage.h" |
9 #include "wtf/Allocator.h" | 9 #include "wtf/Allocator.h" |
10 #include "wtf/Assertions.h" | 10 #include "wtf/Assertions.h" |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 USING_FAST_MALLOC(PageMemory); | 167 USING_FAST_MALLOC(PageMemory); |
168 | 168 |
169 public: | 169 public: |
170 ~PageMemory() { | 170 ~PageMemory() { |
171 __lsan_unregister_root_region(m_writable.base(), m_writable.size()); | 171 __lsan_unregister_root_region(m_writable.base(), m_writable.size()); |
172 m_reserved->pageDeleted(writableStart()); | 172 m_reserved->pageDeleted(writableStart()); |
173 } | 173 } |
174 | 174 |
175 WARN_UNUSED_RESULT bool commit() { | 175 WARN_UNUSED_RESULT bool commit() { |
176 m_reserved->markPageUsed(writableStart()); | 176 m_reserved->markPageUsed(writableStart()); |
| 177 // Check that in-use page isn't also marked as being a non-heap page |
| 178 // by the current heap's negative cache. That cache is invalidated |
| 179 // when allocating new pages, but crbug.com/649485 suggests that |
| 180 // we do get out of sync somehow. |
| 181 // |
| 182 // TODO(sof): consider removing check once bug has been diagnosed |
| 183 // and addressed. |
| 184 CHECK(!ThreadState::current()->isAddressInHeapDoesNotContainCache( |
| 185 writableStart())); |
177 return m_writable.commit(); | 186 return m_writable.commit(); |
178 } | 187 } |
179 | 188 |
180 void decommit() { | 189 void decommit() { |
181 m_reserved->markPageUnused(writableStart()); | 190 m_reserved->markPageUnused(writableStart()); |
182 m_writable.decommit(); | 191 m_writable.decommit(); |
183 } | 192 } |
184 | 193 |
185 void markUnused() { m_reserved->markPageUnused(writableStart()); } | 194 void markUnused() { m_reserved->markPageUnused(writableStart()); } |
186 | 195 |
(...skipping 18 matching lines...) Expand all Loading... |
205 private: | 214 private: |
206 PageMemory(PageMemoryRegion* reserved, const MemoryRegion& writable); | 215 PageMemory(PageMemoryRegion* reserved, const MemoryRegion& writable); |
207 | 216 |
208 PageMemoryRegion* m_reserved; | 217 PageMemoryRegion* m_reserved; |
209 MemoryRegion m_writable; | 218 MemoryRegion m_writable; |
210 }; | 219 }; |
211 | 220 |
212 } // namespace blink | 221 } // namespace blink |
213 | 222 |
214 #endif | 223 #endif |
OLD | NEW |