| 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 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 HeapSnapshotInfo&) = 0; | 427 HeapSnapshotInfo&) = 0; |
| 428 #if DCHECK_IS_ON() | 428 #if DCHECK_IS_ON() |
| 429 virtual bool contains(Address) = 0; | 429 virtual bool contains(Address) = 0; |
| 430 #endif | 430 #endif |
| 431 virtual size_t size() = 0; | 431 virtual size_t size() = 0; |
| 432 virtual bool isLargeObjectPage() { return false; } | 432 virtual bool isLargeObjectPage() { return false; } |
| 433 | 433 |
| 434 Address getAddress() { return reinterpret_cast<Address>(this); } | 434 Address getAddress() { return reinterpret_cast<Address>(this); } |
| 435 PageMemory* storage() const { return m_storage; } | 435 PageMemory* storage() const { return m_storage; } |
| 436 BaseArena* arena() const { return m_arena; } | 436 BaseArena* arena() const { return m_arena; } |
| 437 bool terminating() { return m_terminating; } | |
| 438 void setTerminating() { m_terminating = true; } | |
| 439 | 437 |
| 440 // Returns true if this page has been swept by the ongoing lazy sweep. | 438 // Returns true if this page has been swept by the ongoing lazy sweep. |
| 441 bool hasBeenSwept() const { return m_swept; } | 439 bool hasBeenSwept() const { return m_swept; } |
| 442 | 440 |
| 443 void markAsSwept() { | 441 void markAsSwept() { |
| 444 ASSERT(!m_swept); | 442 ASSERT(!m_swept); |
| 445 m_swept = true; | 443 m_swept = true; |
| 446 } | 444 } |
| 447 | 445 |
| 448 void markAsUnswept() { | 446 void markAsUnswept() { |
| 449 ASSERT(m_swept); | 447 ASSERT(m_swept); |
| 450 m_swept = false; | 448 m_swept = false; |
| 451 } | 449 } |
| 452 | 450 |
| 453 private: | 451 private: |
| 454 PageMemory* m_storage; | 452 PageMemory* m_storage; |
| 455 BaseArena* m_arena; | 453 BaseArena* m_arena; |
| 456 BasePage* m_next; | 454 BasePage* m_next; |
| 457 // Whether the page is part of a terminating thread or not. | |
| 458 bool m_terminating; | |
| 459 | 455 |
| 460 // Track the sweeping state of a page. Set to true once | 456 // Track the sweeping state of a page. Set to true once |
| 461 // the lazy sweep completes has processed it. | 457 // the lazy sweep completes has processed it. |
| 462 // | 458 // |
| 463 // Set to false at the start of a sweep, true upon completion | 459 // Set to false at the start of a sweep, true upon completion |
| 464 // of lazy sweeping. | 460 // of lazy sweeping. |
| 465 bool m_swept; | 461 bool m_swept; |
| 466 friend class BaseArena; | 462 friend class BaseArena; |
| 467 }; | 463 }; |
| 468 | 464 |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 720 BasePage* findPageFromAddress(Address); | 716 BasePage* findPageFromAddress(Address); |
| 721 #endif | 717 #endif |
| 722 virtual void takeFreelistSnapshot(const String& dumpBaseName) {} | 718 virtual void takeFreelistSnapshot(const String& dumpBaseName) {} |
| 723 virtual void clearFreeLists() {} | 719 virtual void clearFreeLists() {} |
| 724 void makeConsistentForGC(); | 720 void makeConsistentForGC(); |
| 725 void makeConsistentForMutator(); | 721 void makeConsistentForMutator(); |
| 726 #if DCHECK_IS_ON() | 722 #if DCHECK_IS_ON() |
| 727 virtual bool isConsistentForGC() = 0; | 723 virtual bool isConsistentForGC() = 0; |
| 728 #endif | 724 #endif |
| 729 size_t objectPayloadSizeForTesting(); | 725 size_t objectPayloadSizeForTesting(); |
| 730 void prepareHeapForTermination(); | |
| 731 void prepareForSweep(); | 726 void prepareForSweep(); |
| 732 #if defined(ADDRESS_SANITIZER) | 727 #if defined(ADDRESS_SANITIZER) |
| 733 void poisonArena(); | 728 void poisonArena(); |
| 734 #endif | 729 #endif |
| 735 Address lazySweep(size_t, size_t gcInfoIndex); | 730 Address lazySweep(size_t, size_t gcInfoIndex); |
| 736 void sweepUnsweptPage(); | 731 void sweepUnsweptPage(); |
| 737 // Returns true if we have swept all pages within the deadline. | 732 // Returns true if we have swept all pages within the deadline. |
| 738 // Returns false otherwise. | 733 // Returns false otherwise. |
| 739 bool lazySweepWithDeadline(double deadlineSeconds); | 734 bool lazySweepWithDeadline(double deadlineSeconds); |
| 740 void completeSweep(); | 735 void completeSweep(); |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 946 return outOfLineAllocate(allocationSize, gcInfoIndex); | 941 return outOfLineAllocate(allocationSize, gcInfoIndex); |
| 947 } | 942 } |
| 948 | 943 |
| 949 inline NormalPageArena* NormalPage::arenaForNormalPage() const { | 944 inline NormalPageArena* NormalPage::arenaForNormalPage() const { |
| 950 return static_cast<NormalPageArena*>(arena()); | 945 return static_cast<NormalPageArena*>(arena()); |
| 951 } | 946 } |
| 952 | 947 |
| 953 } // namespace blink | 948 } // namespace blink |
| 954 | 949 |
| 955 #endif // HeapPage_h | 950 #endif // HeapPage_h |
| OLD | NEW |