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 1484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1495 compact->relocate(payload, compactFrontier + sizeof(HeapObjectHeader)); | 1495 compact->relocate(payload, compactFrontier + sizeof(HeapObjectHeader)); |
1496 } | 1496 } |
1497 headerAddress += size; | 1497 headerAddress += size; |
1498 markedObjectSize += size; | 1498 markedObjectSize += size; |
1499 allocationPoint += size; | 1499 allocationPoint += size; |
1500 DCHECK(allocationPoint <= currentPage->payloadSize()); | 1500 DCHECK(allocationPoint <= currentPage->payloadSize()); |
1501 } | 1501 } |
1502 if (markedObjectSize) | 1502 if (markedObjectSize) |
1503 pageArena->getThreadState()->increaseMarkedObjectSize(markedObjectSize); | 1503 pageArena->getThreadState()->increaseMarkedObjectSize(markedObjectSize); |
1504 | 1504 |
| 1505 Address unusedStart; |
| 1506 size_t unusedSize; |
| 1507 if (currentPage != this) { |
| 1508 unusedStart = payload(); |
| 1509 unusedSize = payloadSize(); |
| 1510 } else { |
| 1511 unusedStart = payload() + allocationPoint; |
| 1512 unusedSize = payloadSize() - allocationPoint; |
| 1513 } |
1505 #if ENABLE(ASSERT) || defined(LEAK_SANITIZER) || defined(ADDRESS_SANITIZER) || \ | 1514 #if ENABLE(ASSERT) || defined(LEAK_SANITIZER) || defined(ADDRESS_SANITIZER) || \ |
1506 defined(MEMORY_SANITIZER) | 1515 defined(MEMORY_SANITIZER) |
1507 // Zap the page, which is now available and will either be compacted into | 1516 // Zap the page, which is now available and will either be compacted into |
1508 // or freed. | 1517 // or freed. |
1509 if (currentPage != this) { | 1518 FreeList::zapFreedMemory(unusedStart, unusedSize); |
1510 FreeList::zapFreedMemory(payload(), payloadSize()); | 1519 #else |
1511 } else { | 1520 memset(unusedStart, 0, unusedSize); |
1512 FreeList::zapFreedMemory(payload() + allocationPoint, | |
1513 payloadSize() - allocationPoint); | |
1514 } | |
1515 #endif | 1521 #endif |
1516 } | 1522 } |
1517 | 1523 |
1518 void NormalPage::makeConsistentForGC() { | 1524 void NormalPage::makeConsistentForGC() { |
1519 size_t markedObjectSize = 0; | 1525 size_t markedObjectSize = 0; |
1520 for (Address headerAddress = payload(); headerAddress < payloadEnd();) { | 1526 for (Address headerAddress = payload(); headerAddress < payloadEnd();) { |
1521 HeapObjectHeader* header = | 1527 HeapObjectHeader* header = |
1522 reinterpret_cast<HeapObjectHeader*>(headerAddress); | 1528 reinterpret_cast<HeapObjectHeader*>(headerAddress); |
1523 ASSERT(header->size() < blinkPagePayloadSize()); | 1529 ASSERT(header->size() < blinkPagePayloadSize()); |
1524 // Check if a free list entry first since we cannot call | 1530 // Check if a free list entry first since we cannot call |
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1900 | 1906 |
1901 m_hasEntries = true; | 1907 m_hasEntries = true; |
1902 size_t index = hash(address); | 1908 size_t index = hash(address); |
1903 ASSERT(!(index & 1)); | 1909 ASSERT(!(index & 1)); |
1904 Address cachePage = roundToBlinkPageStart(address); | 1910 Address cachePage = roundToBlinkPageStart(address); |
1905 m_entries[index + 1] = m_entries[index]; | 1911 m_entries[index + 1] = m_entries[index]; |
1906 m_entries[index] = cachePage; | 1912 m_entries[index] = cachePage; |
1907 } | 1913 } |
1908 | 1914 |
1909 } // namespace blink | 1915 } // namespace blink |
OLD | NEW |