| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 size_t BaseArena::objectPayloadSizeForTesting() { | 218 size_t BaseArena::objectPayloadSizeForTesting() { |
| 219 ASSERT(isConsistentForGC()); | 219 ASSERT(isConsistentForGC()); |
| 220 ASSERT(!m_firstUnsweptPage); | 220 ASSERT(!m_firstUnsweptPage); |
| 221 | 221 |
| 222 size_t objectPayloadSize = 0; | 222 size_t objectPayloadSize = 0; |
| 223 for (BasePage* page = m_firstPage; page; page = page->next()) | 223 for (BasePage* page = m_firstPage; page; page = page->next()) |
| 224 objectPayloadSize += page->objectPayloadSizeForTesting(); | 224 objectPayloadSize += page->objectPayloadSizeForTesting(); |
| 225 return objectPayloadSize; | 225 return objectPayloadSize; |
| 226 } | 226 } |
| 227 | 227 |
| 228 void BaseArena::prepareHeapForTermination() { | |
| 229 ASSERT(!m_firstUnsweptPage); | |
| 230 for (BasePage* page = m_firstPage; page; page = page->next()) { | |
| 231 page->setTerminating(); | |
| 232 } | |
| 233 } | |
| 234 | |
| 235 void BaseArena::prepareForSweep() { | 228 void BaseArena::prepareForSweep() { |
| 236 ASSERT(getThreadState()->isInGC()); | 229 ASSERT(getThreadState()->isInGC()); |
| 237 ASSERT(!m_firstUnsweptPage); | 230 ASSERT(!m_firstUnsweptPage); |
| 238 | 231 |
| 239 // Move all pages to a list of unswept pages. | 232 // Move all pages to a list of unswept pages. |
| 240 m_firstUnsweptPage = m_firstPage; | 233 m_firstUnsweptPage = m_firstPage; |
| 241 m_firstPage = nullptr; | 234 m_firstPage = nullptr; |
| 242 } | 235 } |
| 243 | 236 |
| 244 #if defined(ADDRESS_SANITIZER) | 237 #if defined(ADDRESS_SANITIZER) |
| (...skipping 990 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1235 bucketDump->AddScalar("free_size", "bytes", freeSize); | 1228 bucketDump->AddScalar("free_size", "bytes", freeSize); |
| 1236 didDumpBucketStats = true; | 1229 didDumpBucketStats = true; |
| 1237 } | 1230 } |
| 1238 return didDumpBucketStats; | 1231 return didDumpBucketStats; |
| 1239 } | 1232 } |
| 1240 | 1233 |
| 1241 BasePage::BasePage(PageMemory* storage, BaseArena* arena) | 1234 BasePage::BasePage(PageMemory* storage, BaseArena* arena) |
| 1242 : m_storage(storage), | 1235 : m_storage(storage), |
| 1243 m_arena(arena), | 1236 m_arena(arena), |
| 1244 m_next(nullptr), | 1237 m_next(nullptr), |
| 1245 m_terminating(false), | |
| 1246 m_swept(true) { | 1238 m_swept(true) { |
| 1247 ASSERT(isPageHeaderAddress(reinterpret_cast<Address>(this))); | 1239 ASSERT(isPageHeaderAddress(reinterpret_cast<Address>(this))); |
| 1248 } | 1240 } |
| 1249 | 1241 |
| 1250 NormalPage::NormalPage(PageMemory* storage, BaseArena* arena) | 1242 NormalPage::NormalPage(PageMemory* storage, BaseArena* arena) |
| 1251 : BasePage(storage, arena), m_objectStartBitMapComputed(false) { | 1243 : BasePage(storage, arena), m_objectStartBitMapComputed(false) { |
| 1252 ASSERT(isPageHeaderAddress(reinterpret_cast<Address>(this))); | 1244 ASSERT(isPageHeaderAddress(reinterpret_cast<Address>(this))); |
| 1253 } | 1245 } |
| 1254 | 1246 |
| 1255 size_t NormalPage::objectPayloadSizeForTesting() { | 1247 size_t NormalPage::objectPayloadSizeForTesting() { |
| (...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1826 | 1818 |
| 1827 m_hasEntries = true; | 1819 m_hasEntries = true; |
| 1828 size_t index = hash(address); | 1820 size_t index = hash(address); |
| 1829 ASSERT(!(index & 1)); | 1821 ASSERT(!(index & 1)); |
| 1830 Address cachePage = roundToBlinkPageStart(address); | 1822 Address cachePage = roundToBlinkPageStart(address); |
| 1831 m_entries[index + 1] = m_entries[index]; | 1823 m_entries[index + 1] = m_entries[index]; |
| 1832 m_entries[index] = cachePage; | 1824 m_entries[index] = cachePage; |
| 1833 } | 1825 } |
| 1834 | 1826 |
| 1835 } // namespace blink | 1827 } // namespace blink |
| OLD | NEW |