| 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 14 matching lines...) Expand all Loading... |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef HeapPage_h | 31 #ifndef HeapPage_h |
| 32 #define HeapPage_h | 32 #define HeapPage_h |
| 33 | 33 |
| 34 #include "platform/PlatformExport.h" | 34 #include "platform/PlatformExport.h" |
| 35 #include "platform/heap/BlinkGC.h" |
| 35 #include "platform/heap/GCInfo.h" | 36 #include "platform/heap/GCInfo.h" |
| 36 #include "platform/heap/ThreadState.h" | 37 #include "platform/heap/ThreadState.h" |
| 37 #include "platform/heap/Visitor.h" | 38 #include "platform/heap/Visitor.h" |
| 38 #include "wtf/AddressSanitizer.h" | 39 #include "wtf/AddressSanitizer.h" |
| 39 #include "wtf/Assertions.h" | 40 #include "wtf/Assertions.h" |
| 40 #include "wtf/Atomics.h" | 41 #include "wtf/Atomics.h" |
| 41 #include "wtf/ContainerAnnotations.h" | 42 #include "wtf/ContainerAnnotations.h" |
| 42 #include "wtf/Forward.h" | 43 #include "wtf/Forward.h" |
| 43 #include "wtf/PageAllocator.h" | 44 #include "wtf/PageAllocator.h" |
| 44 #include <stdint.h> | 45 #include <stdint.h> |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 // should be defined as non-virtual methods on NormalPage and LargeObjectPag
e. | 389 // should be defined as non-virtual methods on NormalPage and LargeObjectPag
e. |
| 389 // The following methods are not performance-sensitive. | 390 // The following methods are not performance-sensitive. |
| 390 virtual size_t objectPayloadSizeForTesting() = 0; | 391 virtual size_t objectPayloadSizeForTesting() = 0; |
| 391 virtual bool isEmpty() = 0; | 392 virtual bool isEmpty() = 0; |
| 392 virtual void removeFromHeap() = 0; | 393 virtual void removeFromHeap() = 0; |
| 393 virtual void sweep() = 0; | 394 virtual void sweep() = 0; |
| 394 virtual void makeConsistentForGC() = 0; | 395 virtual void makeConsistentForGC() = 0; |
| 395 virtual void makeConsistentForMutator() = 0; | 396 virtual void makeConsistentForMutator() = 0; |
| 396 | 397 |
| 397 #if defined(ADDRESS_SANITIZER) | 398 #if defined(ADDRESS_SANITIZER) |
| 398 virtual void poisonObjects(ThreadState::ObjectsToPoison, ThreadState::Poison
ing) = 0; | 399 virtual void poisonObjects(BlinkGC::ObjectsToPoison, BlinkGC::Poisoning) = 0
; |
| 399 #endif | 400 #endif |
| 400 // Check if the given address points to an object in this | 401 // Check if the given address points to an object in this |
| 401 // heap page. If so, find the start of that object and mark it | 402 // heap page. If so, find the start of that object and mark it |
| 402 // using the given Visitor. Otherwise do nothing. The pointer must | 403 // using the given Visitor. Otherwise do nothing. The pointer must |
| 403 // be within the same aligned blinkPageSize as the this-pointer. | 404 // be within the same aligned blinkPageSize as the this-pointer. |
| 404 // | 405 // |
| 405 // This is used during conservative stack scanning to | 406 // This is used during conservative stack scanning to |
| 406 // conservatively mark all objects that could be referenced from | 407 // conservatively mark all objects that could be referenced from |
| 407 // the stack. | 408 // the stack. |
| 408 virtual void checkAndMarkPointer(Visitor*, Address) = 0; | 409 virtual void checkAndMarkPointer(Visitor*, Address) = 0; |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 478 return payload() <= address && address < payloadEnd(); | 479 return payload() <= address && address < payloadEnd(); |
| 479 } | 480 } |
| 480 | 481 |
| 481 size_t objectPayloadSizeForTesting() override; | 482 size_t objectPayloadSizeForTesting() override; |
| 482 bool isEmpty() override; | 483 bool isEmpty() override; |
| 483 void removeFromHeap() override; | 484 void removeFromHeap() override; |
| 484 void sweep() override; | 485 void sweep() override; |
| 485 void makeConsistentForGC() override; | 486 void makeConsistentForGC() override; |
| 486 void makeConsistentForMutator() override; | 487 void makeConsistentForMutator() override; |
| 487 #if defined(ADDRESS_SANITIZER) | 488 #if defined(ADDRESS_SANITIZER) |
| 488 void poisonObjects(ThreadState::ObjectsToPoison, ThreadState::Poisoning) ove
rride; | 489 void poisonObjects(BlinkGC::ObjectsToPoison, BlinkGC::Poisoning) override; |
| 489 #endif | 490 #endif |
| 490 void checkAndMarkPointer(Visitor*, Address) override; | 491 void checkAndMarkPointer(Visitor*, Address) override; |
| 491 void markOrphaned() override; | 492 void markOrphaned() override; |
| 492 | 493 |
| 493 void takeSnapshot(String dumpBaseName, size_t pageIndex, ThreadState::GCSnap
shotInfo&, size_t* outFreeSize, size_t* outFreeCount) override; | 494 void takeSnapshot(String dumpBaseName, size_t pageIndex, ThreadState::GCSnap
shotInfo&, size_t* outFreeSize, size_t* outFreeCount) override; |
| 494 #if ENABLE(GC_PROFILING) | 495 #if ENABLE(GC_PROFILING) |
| 495 const GCInfo* findGCInfo(Address) override; | 496 const GCInfo* findGCInfo(Address) override; |
| 496 void snapshot(TracedValue*, ThreadState::SnapshotInfo*) override; | 497 void snapshot(TracedValue*, ThreadState::SnapshotInfo*) override; |
| 497 void incrementMarkedObjectsAge() override; | 498 void incrementMarkedObjectsAge() override; |
| 498 void countMarkedObjects(ClassAgeCountsMap&) override; | 499 void countMarkedObjects(ClassAgeCountsMap&) override; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 543 return payload() <= address && address < payloadEnd(); | 544 return payload() <= address && address < payloadEnd(); |
| 544 } | 545 } |
| 545 | 546 |
| 546 size_t objectPayloadSizeForTesting() override; | 547 size_t objectPayloadSizeForTesting() override; |
| 547 bool isEmpty() override; | 548 bool isEmpty() override; |
| 548 void removeFromHeap() override; | 549 void removeFromHeap() override; |
| 549 void sweep() override; | 550 void sweep() override; |
| 550 void makeConsistentForGC() override; | 551 void makeConsistentForGC() override; |
| 551 void makeConsistentForMutator() override; | 552 void makeConsistentForMutator() override; |
| 552 #if defined(ADDRESS_SANITIZER) | 553 #if defined(ADDRESS_SANITIZER) |
| 553 void poisonObjects(ThreadState::ObjectsToPoison, ThreadState::Poisoning) ove
rride; | 554 void poisonObjects(BlinkGC::ObjectsToPoison, BlinkGC::Poisoning) override; |
| 554 #endif | 555 #endif |
| 555 void checkAndMarkPointer(Visitor*, Address) override; | 556 void checkAndMarkPointer(Visitor*, Address) override; |
| 556 void markOrphaned() override; | 557 void markOrphaned() override; |
| 557 | 558 |
| 558 void takeSnapshot(String dumpBaseName, size_t pageIndex, ThreadState::GCSnap
shotInfo&, size_t* outFreeSize, size_t* outFreeCount) override; | 559 void takeSnapshot(String dumpBaseName, size_t pageIndex, ThreadState::GCSnap
shotInfo&, size_t* outFreeSize, size_t* outFreeCount) override; |
| 559 #if ENABLE(GC_PROFILING) | 560 #if ENABLE(GC_PROFILING) |
| 560 const GCInfo* findGCInfo(Address) override; | 561 const GCInfo* findGCInfo(Address) override; |
| 561 void snapshot(TracedValue*, ThreadState::SnapshotInfo*) override; | 562 void snapshot(TracedValue*, ThreadState::SnapshotInfo*) override; |
| 562 void incrementMarkedObjectsAge() override; | 563 void incrementMarkedObjectsAge() override; |
| 563 void countMarkedObjects(ClassAgeCountsMap&) override; | 564 void countMarkedObjects(ClassAgeCountsMap&) override; |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 719 virtual void clearFreeLists() { } | 720 virtual void clearFreeLists() { } |
| 720 void makeConsistentForGC(); | 721 void makeConsistentForGC(); |
| 721 void makeConsistentForMutator(); | 722 void makeConsistentForMutator(); |
| 722 #if ENABLE(ASSERT) | 723 #if ENABLE(ASSERT) |
| 723 virtual bool isConsistentForGC() = 0; | 724 virtual bool isConsistentForGC() = 0; |
| 724 #endif | 725 #endif |
| 725 size_t objectPayloadSizeForTesting(); | 726 size_t objectPayloadSizeForTesting(); |
| 726 void prepareHeapForTermination(); | 727 void prepareHeapForTermination(); |
| 727 void prepareForSweep(); | 728 void prepareForSweep(); |
| 728 #if defined(ADDRESS_SANITIZER) | 729 #if defined(ADDRESS_SANITIZER) |
| 729 void poisonHeap(ThreadState::ObjectsToPoison, ThreadState::Poisoning); | 730 void poisonHeap(BlinkGC::ObjectsToPoison, BlinkGC::Poisoning); |
| 730 #endif | 731 #endif |
| 731 Address lazySweep(size_t, size_t gcInfoIndex); | 732 Address lazySweep(size_t, size_t gcInfoIndex); |
| 732 void sweepUnsweptPage(); | 733 void sweepUnsweptPage(); |
| 733 // Returns true if we have swept all pages within the deadline. | 734 // Returns true if we have swept all pages within the deadline. |
| 734 // Returns false otherwise. | 735 // Returns false otherwise. |
| 735 bool lazySweepWithDeadline(double deadlineSeconds); | 736 bool lazySweepWithDeadline(double deadlineSeconds); |
| 736 void completeSweep(); | 737 void completeSweep(); |
| 737 | 738 |
| 738 ThreadState* threadState() { return m_threadState; } | 739 ThreadState* threadState() { return m_threadState; } |
| 739 int heapIndex() const { return m_index; } | 740 int heapIndex() const { return m_index; } |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 942 SET_MEMORY_ACCESSIBLE(result, allocationSize - sizeof(HeapObjectHeader))
; | 943 SET_MEMORY_ACCESSIBLE(result, allocationSize - sizeof(HeapObjectHeader))
; |
| 943 ASSERT(findPageFromAddress(headerAddress + allocationSize - 1)); | 944 ASSERT(findPageFromAddress(headerAddress + allocationSize - 1)); |
| 944 return result; | 945 return result; |
| 945 } | 946 } |
| 946 return outOfLineAllocate(allocationSize, gcInfoIndex); | 947 return outOfLineAllocate(allocationSize, gcInfoIndex); |
| 947 } | 948 } |
| 948 | 949 |
| 949 } // namespace blink | 950 } // namespace blink |
| 950 | 951 |
| 951 #endif // HeapPage_h | 952 #endif // HeapPage_h |
| OLD | NEW |