| 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 ASSERT(!m_firstUnsweptPage); | 119 ASSERT(!m_firstUnsweptPage); |
| 120 } | 120 } |
| 121 | 121 |
| 122 void BaseHeap::cleanupPages() | 122 void BaseHeap::cleanupPages() |
| 123 { | 123 { |
| 124 clearFreeLists(); | 124 clearFreeLists(); |
| 125 | 125 |
| 126 ASSERT(!m_firstUnsweptPage); | 126 ASSERT(!m_firstUnsweptPage); |
| 127 // Add the BaseHeap's pages to the orphanedPagePool. | 127 // Add the BaseHeap's pages to the orphanedPagePool. |
| 128 for (BasePage* page = m_firstPage; page; page = page->next()) { | 128 for (BasePage* page = m_firstPage; page; page = page->next()) { |
| 129 Heap::decreaseAllocatedSpace(page->size()); | 129 threadState()->decreaseAllocatedSpace(page->size()); |
| 130 Heap::orphanedPagePool()->addOrphanedPage(heapIndex(), page); | 130 Heap::orphanedPagePool()->addOrphanedPage(heapIndex(), page); |
| 131 } | 131 } |
| 132 m_firstPage = nullptr; | 132 m_firstPage = nullptr; |
| 133 } | 133 } |
| 134 | 134 |
| 135 void BaseHeap::takeSnapshot(const String& dumpBaseName, ThreadState::GCSnapshotI
nfo& info) | 135 void BaseHeap::takeSnapshot(const String& dumpBaseName, ThreadState::GCSnapshotI
nfo& info) |
| 136 { | 136 { |
| 137 // |dumpBaseName| at this point is "blink_gc/thread_X/heaps/HeapName" | 137 // |dumpBaseName| at this point is "blink_gc/thread_X/heaps/HeapName" |
| 138 WebMemoryAllocatorDump* allocatorDump = BlinkGCMemoryDumpProvider::instance(
)->createMemoryAllocatorDumpForCurrentGC(dumpBaseName); | 138 WebMemoryAllocatorDump* allocatorDump = BlinkGCMemoryDumpProvider::instance(
)->createMemoryAllocatorDumpForCurrentGC(dumpBaseName); |
| 139 size_t pageIndex = 0; | 139 size_t pageIndex = 0; |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 if (threadState()->sweepForbidden()) | 296 if (threadState()->sweepForbidden()) |
| 297 return nullptr; | 297 return nullptr; |
| 298 | 298 |
| 299 TRACE_EVENT0("blink_gc", "BaseHeap::lazySweepPages"); | 299 TRACE_EVENT0("blink_gc", "BaseHeap::lazySweepPages"); |
| 300 ThreadState::SweepForbiddenScope sweepForbidden(threadState()); | 300 ThreadState::SweepForbiddenScope sweepForbidden(threadState()); |
| 301 ScriptForbiddenIfMainThreadScope scriptForbidden; | 301 ScriptForbiddenIfMainThreadScope scriptForbidden; |
| 302 | 302 |
| 303 double startTime = WTF::currentTimeMS(); | 303 double startTime = WTF::currentTimeMS(); |
| 304 Address result = lazySweepPages(allocationSize, gcInfoIndex); | 304 Address result = lazySweepPages(allocationSize, gcInfoIndex); |
| 305 threadState()->accumulateSweepingTime(WTF::currentTimeMS() - startTime); | 305 threadState()->accumulateSweepingTime(WTF::currentTimeMS() - startTime); |
| 306 Heap::reportMemoryUsageForTracing(); | 306 threadState()->reportMemoryUsageForTracing(); |
| 307 | 307 |
| 308 return result; | 308 return result; |
| 309 } | 309 } |
| 310 | 310 |
| 311 void BaseHeap::sweepUnsweptPage() | 311 void BaseHeap::sweepUnsweptPage() |
| 312 { | 312 { |
| 313 BasePage* page = m_firstUnsweptPage; | 313 BasePage* page = m_firstUnsweptPage; |
| 314 if (page->isEmpty()) { | 314 if (page->isEmpty()) { |
| 315 page->unlink(&m_firstUnsweptPage); | 315 page->unlink(&m_firstUnsweptPage); |
| 316 page->removeFromHeap(); | 316 page->removeFromHeap(); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 334 RELEASE_ASSERT(threadState()->isSweepingInProgress()); | 334 RELEASE_ASSERT(threadState()->isSweepingInProgress()); |
| 335 ASSERT(threadState()->sweepForbidden()); | 335 ASSERT(threadState()->sweepForbidden()); |
| 336 ASSERT(!threadState()->isMainThread() || ScriptForbiddenScope::isScriptForbi
dden()); | 336 ASSERT(!threadState()->isMainThread() || ScriptForbiddenScope::isScriptForbi
dden()); |
| 337 | 337 |
| 338 int pageCount = 1; | 338 int pageCount = 1; |
| 339 while (m_firstUnsweptPage) { | 339 while (m_firstUnsweptPage) { |
| 340 sweepUnsweptPage(); | 340 sweepUnsweptPage(); |
| 341 if (pageCount % deadlineCheckInterval == 0) { | 341 if (pageCount % deadlineCheckInterval == 0) { |
| 342 if (deadlineSeconds <= Platform::current()->monotonicallyIncreasingT
imeSeconds()) { | 342 if (deadlineSeconds <= Platform::current()->monotonicallyIncreasingT
imeSeconds()) { |
| 343 // Deadline has come. | 343 // Deadline has come. |
| 344 Heap::reportMemoryUsageForTracing(); | 344 threadState()->reportMemoryUsageForTracing(); |
| 345 return !m_firstUnsweptPage; | 345 return !m_firstUnsweptPage; |
| 346 } | 346 } |
| 347 } | 347 } |
| 348 pageCount++; | 348 pageCount++; |
| 349 } | 349 } |
| 350 Heap::reportMemoryUsageForTracing(); | 350 threadState()->reportMemoryUsageForTracing(); |
| 351 return true; | 351 return true; |
| 352 } | 352 } |
| 353 | 353 |
| 354 void BaseHeap::completeSweep() | 354 void BaseHeap::completeSweep() |
| 355 { | 355 { |
| 356 RELEASE_ASSERT(threadState()->isSweepingInProgress()); | 356 RELEASE_ASSERT(threadState()->isSweepingInProgress()); |
| 357 ASSERT(threadState()->sweepForbidden()); | 357 ASSERT(threadState()->sweepForbidden()); |
| 358 ASSERT(!threadState()->isMainThread() || ScriptForbiddenScope::isScriptForbi
dden()); | 358 ASSERT(!threadState()->isMainThread() || ScriptForbiddenScope::isScriptForbi
dden()); |
| 359 | 359 |
| 360 while (m_firstUnsweptPage) { | 360 while (m_firstUnsweptPage) { |
| 361 sweepUnsweptPage(); | 361 sweepUnsweptPage(); |
| 362 } | 362 } |
| 363 Heap::reportMemoryUsageForTracing(); | 363 threadState()->reportMemoryUsageForTracing(); |
| 364 } | 364 } |
| 365 | 365 |
| 366 NormalPageHeap::NormalPageHeap(ThreadState* state, int index) | 366 NormalPageHeap::NormalPageHeap(ThreadState* state, int index) |
| 367 : BaseHeap(state, index) | 367 : BaseHeap(state, index) |
| 368 , m_currentAllocationPoint(nullptr) | 368 , m_currentAllocationPoint(nullptr) |
| 369 , m_remainingAllocationSize(0) | 369 , m_remainingAllocationSize(0) |
| 370 , m_lastRemainingAllocationSize(0) | 370 , m_lastRemainingAllocationSize(0) |
| 371 , m_promptlyFreedSize(0) | 371 , m_promptlyFreedSize(0) |
| 372 { | 372 { |
| 373 clearFreeLists(); | 373 clearFreeLists(); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 pageMemory = memory; | 443 pageMemory = memory; |
| 444 } else { | 444 } else { |
| 445 Heap::freePagePool()->addFreePage(heapIndex(), memory); | 445 Heap::freePagePool()->addFreePage(heapIndex(), memory); |
| 446 } | 446 } |
| 447 } | 447 } |
| 448 } | 448 } |
| 449 | 449 |
| 450 NormalPage* page = new (pageMemory->writableStart()) NormalPage(pageMemory,
this); | 450 NormalPage* page = new (pageMemory->writableStart()) NormalPage(pageMemory,
this); |
| 451 page->link(&m_firstPage); | 451 page->link(&m_firstPage); |
| 452 | 452 |
| 453 Heap::increaseAllocatedSpace(page->size()); | 453 threadState()->increaseAllocatedSpace(page->size()); |
| 454 #if ENABLE(ASSERT) || defined(LEAK_SANITIZER) || defined(ADDRESS_SANITIZER) | 454 #if ENABLE(ASSERT) || defined(LEAK_SANITIZER) || defined(ADDRESS_SANITIZER) |
| 455 // Allow the following addToFreeList() to add the newly allocated memory | 455 // Allow the following addToFreeList() to add the newly allocated memory |
| 456 // to the free list. | 456 // to the free list. |
| 457 ASAN_UNPOISON_MEMORY_REGION(page->payload(), page->payloadSize()); | 457 ASAN_UNPOISON_MEMORY_REGION(page->payload(), page->payloadSize()); |
| 458 Address address = page->payload(); | 458 Address address = page->payload(); |
| 459 for (size_t i = 0; i < page->payloadSize(); i++) | 459 for (size_t i = 0; i < page->payloadSize(); i++) |
| 460 address[i] = reuseAllowedZapValue; | 460 address[i] = reuseAllowedZapValue; |
| 461 ASAN_POISON_MEMORY_REGION(page->payload(), page->payloadSize()); | 461 ASAN_POISON_MEMORY_REGION(page->payload(), page->payloadSize()); |
| 462 #endif | 462 #endif |
| 463 addToFreeList(page->payload(), page->payloadSize()); | 463 addToFreeList(page->payload(), page->payloadSize()); |
| 464 } | 464 } |
| 465 | 465 |
| 466 void NormalPageHeap::freePage(NormalPage* page) | 466 void NormalPageHeap::freePage(NormalPage* page) |
| 467 { | 467 { |
| 468 Heap::decreaseAllocatedSpace(page->size()); | 468 ThreadState::current()->decreaseAllocatedSpace(page->size()); |
| 469 | 469 |
| 470 if (page->terminating()) { | 470 if (page->terminating()) { |
| 471 // The thread is shutting down and this page is being removed as a part | 471 // The thread is shutting down and this page is being removed as a part |
| 472 // of the thread local GC. In that case the object could be traced in | 472 // of the thread local GC. In that case the object could be traced in |
| 473 // the next global GC if there is a dangling pointer from a live thread | 473 // the next global GC if there is a dangling pointer from a live thread |
| 474 // heap to this dead thread heap. To guard against this, we put the | 474 // heap to this dead thread heap. To guard against this, we put the |
| 475 // page into the orphaned page pool and zap the page memory. This | 475 // page into the orphaned page pool and zap the page memory. This |
| 476 // ensures that tracing the dangling pointer in the next global GC just | 476 // ensures that tracing the dangling pointer in the next global GC just |
| 477 // crashes instead of causing use-after-frees. After the next global | 477 // crashes instead of causing use-after-frees. After the next global |
| 478 // GC, the orphaned pages are removed. | 478 // GC, the orphaned pages are removed. |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 if (startOfGap != headerAddress) | 538 if (startOfGap != headerAddress) |
| 539 addToFreeList(startOfGap, headerAddress - startOfGap); | 539 addToFreeList(startOfGap, headerAddress - startOfGap); |
| 540 | 540 |
| 541 headerAddress += size; | 541 headerAddress += size; |
| 542 startOfGap = headerAddress; | 542 startOfGap = headerAddress; |
| 543 } | 543 } |
| 544 | 544 |
| 545 if (startOfGap != page->payloadEnd()) | 545 if (startOfGap != page->payloadEnd()) |
| 546 addToFreeList(startOfGap, page->payloadEnd() - startOfGap); | 546 addToFreeList(startOfGap, page->payloadEnd() - startOfGap); |
| 547 } | 547 } |
| 548 Heap::decreaseAllocatedObjectSize(freedSize); | 548 threadState()->decreaseAllocatedObjectSize(freedSize); |
| 549 ASSERT(m_promptlyFreedSize == freedSize); | 549 ASSERT(m_promptlyFreedSize == freedSize); |
| 550 m_promptlyFreedSize = 0; | 550 m_promptlyFreedSize = 0; |
| 551 return true; | 551 return true; |
| 552 } | 552 } |
| 553 | 553 |
| 554 void NormalPageHeap::promptlyFreeObject(HeapObjectHeader* header) | 554 void NormalPageHeap::promptlyFreeObject(HeapObjectHeader* header) |
| 555 { | 555 { |
| 556 ASSERT(!threadState()->sweepForbidden()); | 556 ASSERT(!threadState()->sweepForbidden()); |
| 557 ASSERT(header->checkHeader()); | 557 ASSERT(header->checkHeader()); |
| 558 Address address = reinterpret_cast<Address>(header); | 558 Address address = reinterpret_cast<Address>(header); |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 656 } | 656 } |
| 657 | 657 |
| 658 void NormalPageHeap::setRemainingAllocationSize(size_t newRemainingAllocationSiz
e) | 658 void NormalPageHeap::setRemainingAllocationSize(size_t newRemainingAllocationSiz
e) |
| 659 { | 659 { |
| 660 m_remainingAllocationSize = newRemainingAllocationSize; | 660 m_remainingAllocationSize = newRemainingAllocationSize; |
| 661 | 661 |
| 662 // Sync recorded allocated-object size: | 662 // Sync recorded allocated-object size: |
| 663 // - if previous alloc checkpoint is larger, allocation size has increased. | 663 // - if previous alloc checkpoint is larger, allocation size has increased. |
| 664 // - if smaller, a net reduction in size since last call to updateRemaining
AllocationSize(). | 664 // - if smaller, a net reduction in size since last call to updateRemaining
AllocationSize(). |
| 665 if (m_lastRemainingAllocationSize > m_remainingAllocationSize) | 665 if (m_lastRemainingAllocationSize > m_remainingAllocationSize) |
| 666 Heap::increaseAllocatedObjectSize(m_lastRemainingAllocationSize - m_rema
iningAllocationSize); | 666 threadState()->increaseAllocatedObjectSize(m_lastRemainingAllocationSize
- m_remainingAllocationSize); |
| 667 else if (m_lastRemainingAllocationSize != m_remainingAllocationSize) | 667 else if (m_lastRemainingAllocationSize != m_remainingAllocationSize) |
| 668 Heap::decreaseAllocatedObjectSize(m_remainingAllocationSize - m_lastRema
iningAllocationSize); | 668 threadState()->decreaseAllocatedObjectSize(m_remainingAllocationSize - m
_lastRemainingAllocationSize); |
| 669 m_lastRemainingAllocationSize = m_remainingAllocationSize; | 669 m_lastRemainingAllocationSize = m_remainingAllocationSize; |
| 670 } | 670 } |
| 671 | 671 |
| 672 void NormalPageHeap::updateRemainingAllocationSize() | 672 void NormalPageHeap::updateRemainingAllocationSize() |
| 673 { | 673 { |
| 674 if (m_lastRemainingAllocationSize > remainingAllocationSize()) { | 674 if (m_lastRemainingAllocationSize > remainingAllocationSize()) { |
| 675 Heap::increaseAllocatedObjectSize(m_lastRemainingAllocationSize - remain
ingAllocationSize()); | 675 threadState()->increaseAllocatedObjectSize(m_lastRemainingAllocationSize
- remainingAllocationSize()); |
| 676 m_lastRemainingAllocationSize = remainingAllocationSize(); | 676 m_lastRemainingAllocationSize = remainingAllocationSize(); |
| 677 } | 677 } |
| 678 ASSERT(m_lastRemainingAllocationSize == remainingAllocationSize()); | 678 ASSERT(m_lastRemainingAllocationSize == remainingAllocationSize()); |
| 679 } | 679 } |
| 680 | 680 |
| 681 void NormalPageHeap::setAllocationPoint(Address point, size_t size) | 681 void NormalPageHeap::setAllocationPoint(Address point, size_t size) |
| 682 { | 682 { |
| 683 #if ENABLE(ASSERT) | 683 #if ENABLE(ASSERT) |
| 684 if (point) { | 684 if (point) { |
| 685 ASSERT(size); | 685 ASSERT(size); |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 831 ASSERT(!(reinterpret_cast<uintptr_t>(result) & allocationMask)); | 831 ASSERT(!(reinterpret_cast<uintptr_t>(result) & allocationMask)); |
| 832 LargeObjectPage* largeObject = new (largeObjectAddress) LargeObjectPage(page
Memory, this, allocationSize); | 832 LargeObjectPage* largeObject = new (largeObjectAddress) LargeObjectPage(page
Memory, this, allocationSize); |
| 833 ASSERT(header->checkHeader()); | 833 ASSERT(header->checkHeader()); |
| 834 | 834 |
| 835 // Poison the object header and allocationGranularity bytes after the object | 835 // Poison the object header and allocationGranularity bytes after the object |
| 836 ASAN_POISON_MEMORY_REGION(header, sizeof(*header)); | 836 ASAN_POISON_MEMORY_REGION(header, sizeof(*header)); |
| 837 ASAN_POISON_MEMORY_REGION(largeObject->address() + largeObject->size(), allo
cationGranularity); | 837 ASAN_POISON_MEMORY_REGION(largeObject->address() + largeObject->size(), allo
cationGranularity); |
| 838 | 838 |
| 839 largeObject->link(&m_firstPage); | 839 largeObject->link(&m_firstPage); |
| 840 | 840 |
| 841 Heap::increaseAllocatedSpace(largeObject->size()); | 841 threadState()->increaseAllocatedSpace(largeObject->size()); |
| 842 Heap::increaseAllocatedObjectSize(largeObject->size()); | 842 threadState()->increaseAllocatedObjectSize(largeObject->size()); |
| 843 return result; | 843 return result; |
| 844 } | 844 } |
| 845 | 845 |
| 846 void LargeObjectHeap::freeLargeObjectPage(LargeObjectPage* object) | 846 void LargeObjectHeap::freeLargeObjectPage(LargeObjectPage* object) |
| 847 { | 847 { |
| 848 ASAN_UNPOISON_MEMORY_REGION(object->payload(), object->payloadSize()); | 848 ASAN_UNPOISON_MEMORY_REGION(object->payload(), object->payloadSize()); |
| 849 object->heapObjectHeader()->finalize(object->payload(), object->payloadSize(
)); | 849 object->heapObjectHeader()->finalize(object->payload(), object->payloadSize(
)); |
| 850 Heap::decreaseAllocatedSpace(object->size()); | 850 ThreadState::current()->decreaseAllocatedSpace(object->size()); |
| 851 | 851 |
| 852 // Unpoison the object header and allocationGranularity bytes after the | 852 // Unpoison the object header and allocationGranularity bytes after the |
| 853 // object before freeing. | 853 // object before freeing. |
| 854 ASAN_UNPOISON_MEMORY_REGION(object->heapObjectHeader(), sizeof(HeapObjectHea
der)); | 854 ASAN_UNPOISON_MEMORY_REGION(object->heapObjectHeader(), sizeof(HeapObjectHea
der)); |
| 855 ASAN_UNPOISON_MEMORY_REGION(object->address() + object->size(), allocationGr
anularity); | 855 ASAN_UNPOISON_MEMORY_REGION(object->address() + object->size(), allocationGr
anularity); |
| 856 | 856 |
| 857 if (object->terminating()) { | 857 if (object->terminating()) { |
| 858 ASSERT(ThreadState::current()->isTerminating()); | 858 ASSERT(ThreadState::current()->isTerminating()); |
| 859 // The thread is shutting down and this page is being removed as a part | 859 // The thread is shutting down and this page is being removed as a part |
| 860 // of the thread local GC. In that case the object could be traced in | 860 // of the thread local GC. In that case the object could be traced in |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1150 heapForNormalPage()->addToFreeList(startOfGap, headerAddress - start
OfGap); | 1150 heapForNormalPage()->addToFreeList(startOfGap, headerAddress - start
OfGap); |
| 1151 header->unmark(); | 1151 header->unmark(); |
| 1152 headerAddress += header->size(); | 1152 headerAddress += header->size(); |
| 1153 markedObjectSize += header->size(); | 1153 markedObjectSize += header->size(); |
| 1154 startOfGap = headerAddress; | 1154 startOfGap = headerAddress; |
| 1155 } | 1155 } |
| 1156 if (startOfGap != payloadEnd()) | 1156 if (startOfGap != payloadEnd()) |
| 1157 heapForNormalPage()->addToFreeList(startOfGap, payloadEnd() - startOfGap
); | 1157 heapForNormalPage()->addToFreeList(startOfGap, payloadEnd() - startOfGap
); |
| 1158 | 1158 |
| 1159 if (markedObjectSize) | 1159 if (markedObjectSize) |
| 1160 Heap::increaseMarkedObjectSize(markedObjectSize); | 1160 ThreadState::current()->increaseMarkedObjectSize(markedObjectSize); |
| 1161 } | 1161 } |
| 1162 | 1162 |
| 1163 void NormalPage::makeConsistentForGC() | 1163 void NormalPage::makeConsistentForGC() |
| 1164 { | 1164 { |
| 1165 size_t markedObjectSize = 0; | 1165 size_t markedObjectSize = 0; |
| 1166 for (Address headerAddress = payload(); headerAddress < payloadEnd();) { | 1166 for (Address headerAddress = payload(); headerAddress < payloadEnd();) { |
| 1167 HeapObjectHeader* header = reinterpret_cast<HeapObjectHeader*>(headerAdd
ress); | 1167 HeapObjectHeader* header = reinterpret_cast<HeapObjectHeader*>(headerAdd
ress); |
| 1168 ASSERT(header->size() < blinkPagePayloadSize()); | 1168 ASSERT(header->size() < blinkPagePayloadSize()); |
| 1169 // Check if a free list entry first since we cannot call | 1169 // Check if a free list entry first since we cannot call |
| 1170 // isMarked on a free list entry. | 1170 // isMarked on a free list entry. |
| 1171 if (header->isFree()) { | 1171 if (header->isFree()) { |
| 1172 headerAddress += header->size(); | 1172 headerAddress += header->size(); |
| 1173 continue; | 1173 continue; |
| 1174 } | 1174 } |
| 1175 ASSERT(header->checkHeader()); | 1175 ASSERT(header->checkHeader()); |
| 1176 if (header->isMarked()) { | 1176 if (header->isMarked()) { |
| 1177 header->unmark(); | 1177 header->unmark(); |
| 1178 markedObjectSize += header->size(); | 1178 markedObjectSize += header->size(); |
| 1179 } else { | 1179 } else { |
| 1180 header->markDead(); | 1180 header->markDead(); |
| 1181 } | 1181 } |
| 1182 headerAddress += header->size(); | 1182 headerAddress += header->size(); |
| 1183 } | 1183 } |
| 1184 if (markedObjectSize) | 1184 if (markedObjectSize) |
| 1185 Heap::increaseMarkedObjectSize(markedObjectSize); | 1185 ThreadState::current()->increaseMarkedObjectSize(markedObjectSize); |
| 1186 } | 1186 } |
| 1187 | 1187 |
| 1188 void NormalPage::makeConsistentForMutator() | 1188 void NormalPage::makeConsistentForMutator() |
| 1189 { | 1189 { |
| 1190 Address startOfGap = payload(); | 1190 Address startOfGap = payload(); |
| 1191 for (Address headerAddress = payload(); headerAddress < payloadEnd();) { | 1191 for (Address headerAddress = payload(); headerAddress < payloadEnd();) { |
| 1192 HeapObjectHeader* header = reinterpret_cast<HeapObjectHeader*>(headerAdd
ress); | 1192 HeapObjectHeader* header = reinterpret_cast<HeapObjectHeader*>(headerAdd
ress); |
| 1193 size_t size = header->size(); | 1193 size_t size = header->size(); |
| 1194 ASSERT(size < blinkPagePayloadSize()); | 1194 ASSERT(size < blinkPagePayloadSize()); |
| 1195 if (header->isPromptlyFreed()) | 1195 if (header->isPromptlyFreed()) |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1442 } | 1442 } |
| 1443 | 1443 |
| 1444 void LargeObjectPage::removeFromHeap() | 1444 void LargeObjectPage::removeFromHeap() |
| 1445 { | 1445 { |
| 1446 static_cast<LargeObjectHeap*>(heap())->freeLargeObjectPage(this); | 1446 static_cast<LargeObjectHeap*>(heap())->freeLargeObjectPage(this); |
| 1447 } | 1447 } |
| 1448 | 1448 |
| 1449 void LargeObjectPage::sweep() | 1449 void LargeObjectPage::sweep() |
| 1450 { | 1450 { |
| 1451 heapObjectHeader()->unmark(); | 1451 heapObjectHeader()->unmark(); |
| 1452 Heap::increaseMarkedObjectSize(size()); | 1452 ThreadState::current()->increaseMarkedObjectSize(size()); |
| 1453 } | 1453 } |
| 1454 | 1454 |
| 1455 void LargeObjectPage::makeConsistentForGC() | 1455 void LargeObjectPage::makeConsistentForGC() |
| 1456 { | 1456 { |
| 1457 HeapObjectHeader* header = heapObjectHeader(); | 1457 HeapObjectHeader* header = heapObjectHeader(); |
| 1458 if (header->isMarked()) { | 1458 if (header->isMarked()) { |
| 1459 header->unmark(); | 1459 header->unmark(); |
| 1460 Heap::increaseMarkedObjectSize(size()); | 1460 ThreadState::current()->increaseMarkedObjectSize(size()); |
| 1461 } else { | 1461 } else { |
| 1462 header->markDead(); | 1462 header->markDead(); |
| 1463 } | 1463 } |
| 1464 } | 1464 } |
| 1465 | 1465 |
| 1466 void LargeObjectPage::makeConsistentForMutator() | 1466 void LargeObjectPage::makeConsistentForMutator() |
| 1467 { | 1467 { |
| 1468 HeapObjectHeader* header = heapObjectHeader(); | 1468 HeapObjectHeader* header = heapObjectHeader(); |
| 1469 if (header->isMarked()) | 1469 if (header->isMarked()) |
| 1470 header->unmark(); | 1470 header->unmark(); |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1573 | 1573 |
| 1574 m_hasEntries = true; | 1574 m_hasEntries = true; |
| 1575 size_t index = hash(address); | 1575 size_t index = hash(address); |
| 1576 ASSERT(!(index & 1)); | 1576 ASSERT(!(index & 1)); |
| 1577 Address cachePage = roundToBlinkPageStart(address); | 1577 Address cachePage = roundToBlinkPageStart(address); |
| 1578 m_entries[index + 1] = m_entries[index]; | 1578 m_entries[index + 1] = m_entries[index]; |
| 1579 m_entries[index] = cachePage; | 1579 m_entries[index] = cachePage; |
| 1580 } | 1580 } |
| 1581 | 1581 |
| 1582 } // namespace blink | 1582 } // namespace blink |
| OLD | NEW |