| 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 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 // The following methods are not performance-sensitive. | 371 // The following methods are not performance-sensitive. |
| 372 virtual size_t objectPayloadSizeForTesting() = 0; | 372 virtual size_t objectPayloadSizeForTesting() = 0; |
| 373 virtual bool isEmpty() = 0; | 373 virtual bool isEmpty() = 0; |
| 374 virtual void removeFromHeap() = 0; | 374 virtual void removeFromHeap() = 0; |
| 375 virtual void sweep() = 0; | 375 virtual void sweep() = 0; |
| 376 virtual void makeConsistentForGC() = 0; | 376 virtual void makeConsistentForGC() = 0; |
| 377 virtual void makeConsistentForMutator() = 0; | 377 virtual void makeConsistentForMutator() = 0; |
| 378 virtual void invalidateObjectStartBitmap() = 0; | 378 virtual void invalidateObjectStartBitmap() = 0; |
| 379 | 379 |
| 380 #if defined(ADDRESS_SANITIZER) | 380 #if defined(ADDRESS_SANITIZER) |
| 381 virtual void poisonObjects(BlinkGC::ObjectsToPoison, BlinkGC::Poisoning) = 0
; | 381 virtual void poisonUnmarkedObjects() = 0; |
| 382 #endif | 382 #endif |
| 383 // Check if the given address points to an object in this | 383 // Check if the given address points to an object in this |
| 384 // heap page. If so, find the start of that object and mark it | 384 // heap page. If so, find the start of that object and mark it |
| 385 // using the given Visitor. Otherwise do nothing. The pointer must | 385 // using the given Visitor. Otherwise do nothing. The pointer must |
| 386 // be within the same aligned blinkPageSize as the this-pointer. | 386 // be within the same aligned blinkPageSize as the this-pointer. |
| 387 // | 387 // |
| 388 // This is used during conservative stack scanning to | 388 // This is used during conservative stack scanning to |
| 389 // conservatively mark all objects that could be referenced from | 389 // conservatively mark all objects that could be referenced from |
| 390 // the stack. | 390 // the stack. |
| 391 virtual void checkAndMarkPointer(Visitor*, Address) = 0; | 391 virtual void checkAndMarkPointer(Visitor*, Address) = 0; |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 } | 462 } |
| 463 | 463 |
| 464 size_t objectPayloadSizeForTesting() override; | 464 size_t objectPayloadSizeForTesting() override; |
| 465 bool isEmpty() override; | 465 bool isEmpty() override; |
| 466 void removeFromHeap() override; | 466 void removeFromHeap() override; |
| 467 void sweep() override; | 467 void sweep() override; |
| 468 void makeConsistentForGC() override; | 468 void makeConsistentForGC() override; |
| 469 void makeConsistentForMutator() override; | 469 void makeConsistentForMutator() override; |
| 470 void invalidateObjectStartBitmap() override { m_objectStartBitMapComputed =
false; } | 470 void invalidateObjectStartBitmap() override { m_objectStartBitMapComputed =
false; } |
| 471 #if defined(ADDRESS_SANITIZER) | 471 #if defined(ADDRESS_SANITIZER) |
| 472 void poisonObjects(BlinkGC::ObjectsToPoison, BlinkGC::Poisoning) override; | 472 void poisonUnmarkedObjects() override; |
| 473 #endif | 473 #endif |
| 474 void checkAndMarkPointer(Visitor*, Address) override; | 474 void checkAndMarkPointer(Visitor*, Address) override; |
| 475 void markOrphaned() override; | 475 void markOrphaned() override; |
| 476 | 476 |
| 477 void takeSnapshot(WebMemoryAllocatorDump*, ThreadState::GCSnapshotInfo&, Hea
pSnapshotInfo&) override; | 477 void takeSnapshot(WebMemoryAllocatorDump*, ThreadState::GCSnapshotInfo&, Hea
pSnapshotInfo&) override; |
| 478 #if ENABLE(ASSERT) | 478 #if ENABLE(ASSERT) |
| 479 // Returns true for the whole blinkPageSize page that the page is on, even | 479 // Returns true for the whole blinkPageSize page that the page is on, even |
| 480 // for the header, and the unmapped guard page at the start. That ensures | 480 // for the header, and the unmapped guard page at the start. That ensures |
| 481 // the result can be used to populate the negative page cache. | 481 // the result can be used to populate the negative page cache. |
| 482 bool contains(Address) override; | 482 bool contains(Address) override; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 519 } | 519 } |
| 520 | 520 |
| 521 size_t objectPayloadSizeForTesting() override; | 521 size_t objectPayloadSizeForTesting() override; |
| 522 bool isEmpty() override; | 522 bool isEmpty() override; |
| 523 void removeFromHeap() override; | 523 void removeFromHeap() override; |
| 524 void sweep() override; | 524 void sweep() override; |
| 525 void makeConsistentForGC() override; | 525 void makeConsistentForGC() override; |
| 526 void makeConsistentForMutator() override; | 526 void makeConsistentForMutator() override; |
| 527 void invalidateObjectStartBitmap() override { } | 527 void invalidateObjectStartBitmap() override { } |
| 528 #if defined(ADDRESS_SANITIZER) | 528 #if defined(ADDRESS_SANITIZER) |
| 529 void poisonObjects(BlinkGC::ObjectsToPoison, BlinkGC::Poisoning) override; | 529 void poisonUnmarkedObjects() override; |
| 530 #endif | 530 #endif |
| 531 void checkAndMarkPointer(Visitor*, Address) override; | 531 void checkAndMarkPointer(Visitor*, Address) override; |
| 532 void markOrphaned() override; | 532 void markOrphaned() override; |
| 533 | 533 |
| 534 void takeSnapshot(WebMemoryAllocatorDump*, ThreadState::GCSnapshotInfo&, Hea
pSnapshotInfo&) override; | 534 void takeSnapshot(WebMemoryAllocatorDump*, ThreadState::GCSnapshotInfo&, Hea
pSnapshotInfo&) override; |
| 535 #if ENABLE(ASSERT) | 535 #if ENABLE(ASSERT) |
| 536 // Returns true for any address that is on one of the pages that this | 536 // Returns true for any address that is on one of the pages that this |
| 537 // large object uses. That ensures that we can use a negative result to | 537 // large object uses. That ensures that we can use a negative result to |
| 538 // populate the negative page cache. | 538 // populate the negative page cache. |
| 539 bool contains(Address) override; | 539 bool contains(Address) override; |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 671 virtual void clearFreeLists() { } | 671 virtual void clearFreeLists() { } |
| 672 void makeConsistentForGC(); | 672 void makeConsistentForGC(); |
| 673 void makeConsistentForMutator(); | 673 void makeConsistentForMutator(); |
| 674 #if ENABLE(ASSERT) | 674 #if ENABLE(ASSERT) |
| 675 virtual bool isConsistentForGC() = 0; | 675 virtual bool isConsistentForGC() = 0; |
| 676 #endif | 676 #endif |
| 677 size_t objectPayloadSizeForTesting(); | 677 size_t objectPayloadSizeForTesting(); |
| 678 void prepareHeapForTermination(); | 678 void prepareHeapForTermination(); |
| 679 void prepareForSweep(); | 679 void prepareForSweep(); |
| 680 #if defined(ADDRESS_SANITIZER) | 680 #if defined(ADDRESS_SANITIZER) |
| 681 void poisonArena(BlinkGC::ObjectsToPoison, BlinkGC::Poisoning); | 681 void poisonArena(); |
| 682 #endif | 682 #endif |
| 683 Address lazySweep(size_t, size_t gcInfoIndex); | 683 Address lazySweep(size_t, size_t gcInfoIndex); |
| 684 void sweepUnsweptPage(); | 684 void sweepUnsweptPage(); |
| 685 // Returns true if we have swept all pages within the deadline. | 685 // Returns true if we have swept all pages within the deadline. |
| 686 // Returns false otherwise. | 686 // Returns false otherwise. |
| 687 bool lazySweepWithDeadline(double deadlineSeconds); | 687 bool lazySweepWithDeadline(double deadlineSeconds); |
| 688 void completeSweep(); | 688 void completeSweep(); |
| 689 | 689 |
| 690 ThreadState* getThreadState() { return m_threadState; } | 690 ThreadState* getThreadState() { return m_threadState; } |
| 691 int arenaIndex() const { return m_index; } | 691 int arenaIndex() const { return m_index; } |
| (...skipping 194 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 |