Chromium Code Reviews| 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 #if DCHECK_IS_ON() | |
| 178 // Check that in-use page isn't also marked as being a non-heap page | |
| 179 // by the current heap's negative cache. That cache is invalidated | |
| 180 // when allocating new pages, but crbug.com/649485 suggests that | |
| 181 // we do get out of sync somehow. | |
| 182 // | |
| 183 // TODO(sof): consider removing check once bug has been diagnosed | |
| 184 // and addressed. | |
| 185 DCHECK(!ThreadState::current()->isAddressInHeapDoesNotContainCache( | |
|
haraken
2017/02/24 13:21:22
I'm fine with using a CHECK given that commit() wo
sof
2017/02/24 13:54:37
good idea, let's do that and try to flush out the
| |
| 186 writableStart())); | |
| 187 #endif | |
| 177 return m_writable.commit(); | 188 return m_writable.commit(); |
| 178 } | 189 } |
| 179 | 190 |
| 180 void decommit() { | 191 void decommit() { |
| 181 m_reserved->markPageUnused(writableStart()); | 192 m_reserved->markPageUnused(writableStart()); |
| 182 m_writable.decommit(); | 193 m_writable.decommit(); |
| 183 } | 194 } |
| 184 | 195 |
| 185 void markUnused() { m_reserved->markPageUnused(writableStart()); } | 196 void markUnused() { m_reserved->markPageUnused(writableStart()); } |
| 186 | 197 |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 205 private: | 216 private: |
| 206 PageMemory(PageMemoryRegion* reserved, const MemoryRegion& writable); | 217 PageMemory(PageMemoryRegion* reserved, const MemoryRegion& writable); |
| 207 | 218 |
| 208 PageMemoryRegion* m_reserved; | 219 PageMemoryRegion* m_reserved; |
| 209 MemoryRegion m_writable; | 220 MemoryRegion m_writable; |
| 210 }; | 221 }; |
| 211 | 222 |
| 212 } // namespace blink | 223 } // namespace blink |
| 213 | 224 |
| 214 #endif | 225 #endif |
| OLD | NEW |