| 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 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 explicit FreeListEntry(size_t size) | 260 explicit FreeListEntry(size_t size) |
| 261 : HeapObjectHeader(size, gcInfoIndexForFreeListHeader) | 261 : HeapObjectHeader(size, gcInfoIndexForFreeListHeader) |
| 262 , m_next(nullptr) | 262 , m_next(nullptr) |
| 263 { | 263 { |
| 264 #if ENABLE(ASSERT) | 264 #if ENABLE(ASSERT) |
| 265 ASSERT(size >= sizeof(HeapObjectHeader)); | 265 ASSERT(size >= sizeof(HeapObjectHeader)); |
| 266 zapMagic(); | 266 zapMagic(); |
| 267 #endif | 267 #endif |
| 268 } | 268 } |
| 269 | 269 |
| 270 Address address() { return reinterpret_cast<Address>(this); } | 270 Address getAddress() { return reinterpret_cast<Address>(this); } |
| 271 | 271 |
| 272 NO_SANITIZE_ADDRESS | 272 NO_SANITIZE_ADDRESS |
| 273 void unlink(FreeListEntry** prevNext) | 273 void unlink(FreeListEntry** prevNext) |
| 274 { | 274 { |
| 275 *prevNext = m_next; | 275 *prevNext = m_next; |
| 276 m_next = nullptr; | 276 m_next = nullptr; |
| 277 } | 277 } |
| 278 | 278 |
| 279 NO_SANITIZE_ADDRESS | 279 NO_SANITIZE_ADDRESS |
| 280 void link(FreeListEntry** prevNext) | 280 void link(FreeListEntry** prevNext) |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 size_t freeSize = 0; | 399 size_t freeSize = 0; |
| 400 }; | 400 }; |
| 401 | 401 |
| 402 virtual void takeSnapshot(WebMemoryAllocatorDump*, ThreadState::GCSnapshotIn
fo&, HeapSnapshotInfo&) = 0; | 402 virtual void takeSnapshot(WebMemoryAllocatorDump*, ThreadState::GCSnapshotIn
fo&, HeapSnapshotInfo&) = 0; |
| 403 #if ENABLE(ASSERT) | 403 #if ENABLE(ASSERT) |
| 404 virtual bool contains(Address) = 0; | 404 virtual bool contains(Address) = 0; |
| 405 #endif | 405 #endif |
| 406 virtual size_t size() = 0; | 406 virtual size_t size() = 0; |
| 407 virtual bool isLargeObjectPage() { return false; } | 407 virtual bool isLargeObjectPage() { return false; } |
| 408 | 408 |
| 409 Address address() { return reinterpret_cast<Address>(this); } | 409 Address getAddress() { return reinterpret_cast<Address>(this); } |
| 410 PageMemory* storage() const { return m_storage; } | 410 PageMemory* storage() const { return m_storage; } |
| 411 BaseHeap* heap() const { return m_heap; } | 411 BaseHeap* heap() const { return m_heap; } |
| 412 bool orphaned() { return !m_heap; } | 412 bool orphaned() { return !m_heap; } |
| 413 bool terminating() { return m_terminating; } | 413 bool terminating() { return m_terminating; } |
| 414 void setTerminating() { m_terminating = true; } | 414 void setTerminating() { m_terminating = true; } |
| 415 | 415 |
| 416 // Returns true if this page has been swept by the ongoing lazy sweep. | 416 // Returns true if this page has been swept by the ongoing lazy sweep. |
| 417 bool hasBeenSwept() const { return m_swept; } | 417 bool hasBeenSwept() const { return m_swept; } |
| 418 | 418 |
| 419 void markAsSwept() | 419 void markAsSwept() |
| (...skipping 23 matching lines...) Expand all Loading... |
| 443 bool m_swept; | 443 bool m_swept; |
| 444 friend class BaseHeap; | 444 friend class BaseHeap; |
| 445 }; | 445 }; |
| 446 | 446 |
| 447 class NormalPage final : public BasePage { | 447 class NormalPage final : public BasePage { |
| 448 public: | 448 public: |
| 449 NormalPage(PageMemory*, BaseHeap*); | 449 NormalPage(PageMemory*, BaseHeap*); |
| 450 | 450 |
| 451 Address payload() | 451 Address payload() |
| 452 { | 452 { |
| 453 return address() + pageHeaderSize(); | 453 return getAddress() + pageHeaderSize(); |
| 454 } | 454 } |
| 455 size_t payloadSize() | 455 size_t payloadSize() |
| 456 { | 456 { |
| 457 return (blinkPagePayloadSize() - pageHeaderSize()) & ~allocationMask; | 457 return (blinkPagePayloadSize() - pageHeaderSize()) & ~allocationMask; |
| 458 } | 458 } |
| 459 Address payloadEnd() { return payload() + payloadSize(); } | 459 Address payloadEnd() { return payload() + payloadSize(); } |
| 460 bool containedInObjectPayload(Address address) | 460 bool containedInObjectPayload(Address address) |
| 461 { | 461 { |
| 462 return payload() <= address && address < payloadEnd(); | 462 return payload() <= address && address < payloadEnd(); |
| 463 } | 463 } |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 547 { | 547 { |
| 548 // Compute the amount of padding we have to add to a header to make | 548 // Compute the amount of padding we have to add to a header to make |
| 549 // the size of the header plus the padding a multiple of 8 bytes. | 549 // the size of the header plus the padding a multiple of 8 bytes. |
| 550 size_t paddingSize = (sizeof(LargeObjectPage) + allocationGranularity -
(sizeof(HeapObjectHeader) % allocationGranularity)) % allocationGranularity; | 550 size_t paddingSize = (sizeof(LargeObjectPage) + allocationGranularity -
(sizeof(HeapObjectHeader) % allocationGranularity)) % allocationGranularity; |
| 551 return sizeof(LargeObjectPage) + paddingSize; | 551 return sizeof(LargeObjectPage) + paddingSize; |
| 552 } | 552 } |
| 553 bool isLargeObjectPage() override { return true; } | 553 bool isLargeObjectPage() override { return true; } |
| 554 | 554 |
| 555 HeapObjectHeader* heapObjectHeader() | 555 HeapObjectHeader* heapObjectHeader() |
| 556 { | 556 { |
| 557 Address headerAddress = address() + pageHeaderSize(); | 557 Address headerAddress = getAddress() + pageHeaderSize(); |
| 558 return reinterpret_cast<HeapObjectHeader*>(headerAddress); | 558 return reinterpret_cast<HeapObjectHeader*>(headerAddress); |
| 559 } | 559 } |
| 560 | 560 |
| 561 #ifdef ANNOTATE_CONTIGUOUS_CONTAINER | 561 #ifdef ANNOTATE_CONTIGUOUS_CONTAINER |
| 562 void setIsVectorBackingPage() { m_isVectorBackingPage = true; } | 562 void setIsVectorBackingPage() { m_isVectorBackingPage = true; } |
| 563 bool isVectorBackingPage() const { return m_isVectorBackingPage; } | 563 bool isVectorBackingPage() const { return m_isVectorBackingPage; } |
| 564 #endif | 564 #endif |
| 565 | 565 |
| 566 private: | 566 private: |
| 567 | 567 |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 886 SET_MEMORY_ACCESSIBLE(result, allocationSize - sizeof(HeapObjectHeader))
; | 886 SET_MEMORY_ACCESSIBLE(result, allocationSize - sizeof(HeapObjectHeader))
; |
| 887 ASSERT(findPageFromAddress(headerAddress + allocationSize - 1)); | 887 ASSERT(findPageFromAddress(headerAddress + allocationSize - 1)); |
| 888 return result; | 888 return result; |
| 889 } | 889 } |
| 890 return outOfLineAllocate(allocationSize, gcInfoIndex); | 890 return outOfLineAllocate(allocationSize, gcInfoIndex); |
| 891 } | 891 } |
| 892 | 892 |
| 893 } // namespace blink | 893 } // namespace blink |
| 894 | 894 |
| 895 #endif // HeapPage_h | 895 #endif // HeapPage_h |
| OLD | NEW |