Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(52)

Side by Side Diff: third_party/WebKit/Source/platform/heap/HeapPage.h

Issue 2684633004: Remove orphaned pages from Oilpan (Closed)
Patch Set: temp Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 // 413 //
414 // This is used during conservative stack scanning to 414 // This is used during conservative stack scanning to
415 // conservatively mark all objects that could be referenced from 415 // conservatively mark all objects that could be referenced from
416 // the stack. 416 // the stack.
417 virtual void checkAndMarkPointer(Visitor*, Address) = 0; 417 virtual void checkAndMarkPointer(Visitor*, Address) = 0;
418 #if DCHECK_IS_ON() 418 #if DCHECK_IS_ON()
419 virtual void checkAndMarkPointer(Visitor*, 419 virtual void checkAndMarkPointer(Visitor*,
420 Address, 420 Address,
421 MarkedPointerCallbackForTesting) = 0; 421 MarkedPointerCallbackForTesting) = 0;
422 #endif 422 #endif
423 virtual void markOrphaned();
424 423
425 class HeapSnapshotInfo { 424 class HeapSnapshotInfo {
426 STACK_ALLOCATED(); 425 STACK_ALLOCATED();
427 426
428 public: 427 public:
429 size_t freeCount = 0; 428 size_t freeCount = 0;
430 size_t freeSize = 0; 429 size_t freeSize = 0;
431 }; 430 };
432 431
433 virtual void takeSnapshot(base::trace_event::MemoryAllocatorDump*, 432 virtual void takeSnapshot(base::trace_event::MemoryAllocatorDump*,
434 ThreadState::GCSnapshotInfo&, 433 ThreadState::GCSnapshotInfo&,
435 HeapSnapshotInfo&) = 0; 434 HeapSnapshotInfo&) = 0;
436 #if DCHECK_IS_ON() 435 #if DCHECK_IS_ON()
437 virtual bool contains(Address) = 0; 436 virtual bool contains(Address) = 0;
438 #endif 437 #endif
439 virtual size_t size() = 0; 438 virtual size_t size() = 0;
440 virtual bool isLargeObjectPage() { return false; } 439 virtual bool isLargeObjectPage() { return false; }
441 440
442 Address getAddress() { return reinterpret_cast<Address>(this); } 441 Address getAddress() { return reinterpret_cast<Address>(this); }
443 PageMemory* storage() const { return m_storage; } 442 PageMemory* storage() const { return m_storage; }
444 BaseArena* arena() const { return m_arena; } 443 BaseArena* arena() const { return m_arena; }
445 bool orphaned() { return !m_arena; }
446 bool terminating() { return m_terminating; } 444 bool terminating() { return m_terminating; }
447 void setTerminating() { m_terminating = true; } 445 void setTerminating() { m_terminating = true; }
448 446
449 // Returns true if this page has been swept by the ongoing lazy sweep. 447 // Returns true if this page has been swept by the ongoing lazy sweep.
450 bool hasBeenSwept() const { return m_swept; } 448 bool hasBeenSwept() const { return m_swept; }
451 449
452 void markAsSwept() { 450 void markAsSwept() {
453 ASSERT(!m_swept); 451 ASSERT(!m_swept);
454 m_swept = true; 452 m_swept = true;
455 } 453 }
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 } 497 }
500 #if defined(ADDRESS_SANITIZER) 498 #if defined(ADDRESS_SANITIZER)
501 void poisonUnmarkedObjects() override; 499 void poisonUnmarkedObjects() override;
502 #endif 500 #endif
503 void checkAndMarkPointer(Visitor*, Address) override; 501 void checkAndMarkPointer(Visitor*, Address) override;
504 #if DCHECK_IS_ON() 502 #if DCHECK_IS_ON()
505 void checkAndMarkPointer(Visitor*, 503 void checkAndMarkPointer(Visitor*,
506 Address, 504 Address,
507 MarkedPointerCallbackForTesting) override; 505 MarkedPointerCallbackForTesting) override;
508 #endif 506 #endif
509 void markOrphaned() override;
510 507
511 void takeSnapshot(base::trace_event::MemoryAllocatorDump*, 508 void takeSnapshot(base::trace_event::MemoryAllocatorDump*,
512 ThreadState::GCSnapshotInfo&, 509 ThreadState::GCSnapshotInfo&,
513 HeapSnapshotInfo&) override; 510 HeapSnapshotInfo&) override;
514 #if DCHECK_IS_ON() 511 #if DCHECK_IS_ON()
515 // Returns true for the whole blinkPageSize page that the page is on, even 512 // Returns true for the whole blinkPageSize page that the page is on, even
516 // for the header, and the unmapped guard page at the start. That ensures 513 // for the header, and the unmapped guard page at the start. That ensures
517 // the result can be used to populate the negative page cache. 514 // the result can be used to populate the negative page cache.
518 bool contains(Address) override; 515 bool contains(Address) override;
519 #endif 516 #endif
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 void invalidateObjectStartBitmap() override {} 579 void invalidateObjectStartBitmap() override {}
583 #if defined(ADDRESS_SANITIZER) 580 #if defined(ADDRESS_SANITIZER)
584 void poisonUnmarkedObjects() override; 581 void poisonUnmarkedObjects() override;
585 #endif 582 #endif
586 void checkAndMarkPointer(Visitor*, Address) override; 583 void checkAndMarkPointer(Visitor*, Address) override;
587 #if DCHECK_IS_ON() 584 #if DCHECK_IS_ON()
588 void checkAndMarkPointer(Visitor*, 585 void checkAndMarkPointer(Visitor*,
589 Address, 586 Address,
590 MarkedPointerCallbackForTesting) override; 587 MarkedPointerCallbackForTesting) override;
591 #endif 588 #endif
592 void markOrphaned() override;
593 589
594 void takeSnapshot(base::trace_event::MemoryAllocatorDump*, 590 void takeSnapshot(base::trace_event::MemoryAllocatorDump*,
595 ThreadState::GCSnapshotInfo&, 591 ThreadState::GCSnapshotInfo&,
596 HeapSnapshotInfo&) override; 592 HeapSnapshotInfo&) override;
597 #if DCHECK_IS_ON() 593 #if DCHECK_IS_ON()
598 // Returns true for any address that is on one of the pages that this 594 // Returns true for any address that is on one of the pages that this
599 // large object uses. That ensures that we can use a negative result to 595 // large object uses. That ensures that we can use a negative result to
600 // populate the negative page cache. 596 // populate the negative page cache.
601 bool contains(Address) override; 597 bool contains(Address) override;
602 #endif 598 #endif
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
719 // BaseArena is a parent class of NormalPageArena and LargeObjectArena. 715 // BaseArena is a parent class of NormalPageArena and LargeObjectArena.
720 // NormalPageArena represents a part of a heap that contains NormalPages 716 // NormalPageArena represents a part of a heap that contains NormalPages
721 // and LargeObjectArena represents a part of a heap that contains 717 // and LargeObjectArena represents a part of a heap that contains
722 // LargeObjectPages. 718 // LargeObjectPages.
723 class PLATFORM_EXPORT BaseArena { 719 class PLATFORM_EXPORT BaseArena {
724 USING_FAST_MALLOC(BaseArena); 720 USING_FAST_MALLOC(BaseArena);
725 721
726 public: 722 public:
727 BaseArena(ThreadState*, int); 723 BaseArena(ThreadState*, int);
728 virtual ~BaseArena(); 724 virtual ~BaseArena();
729 void cleanupPages(); 725 void removeAllPages();
730 726
731 void takeSnapshot(const String& dumpBaseName, ThreadState::GCSnapshotInfo&); 727 void takeSnapshot(const String& dumpBaseName, ThreadState::GCSnapshotInfo&);
732 #if DCHECK_IS_ON() 728 #if DCHECK_IS_ON()
733 BasePage* findPageFromAddress(Address); 729 BasePage* findPageFromAddress(Address);
734 #endif 730 #endif
735 virtual void takeFreelistSnapshot(const String& dumpBaseName) {} 731 virtual void takeFreelistSnapshot(const String& dumpBaseName) {}
736 virtual void clearFreeLists() {} 732 virtual void clearFreeLists() {}
737 void makeConsistentForGC(); 733 void makeConsistentForGC();
738 void makeConsistentForMutator(); 734 void makeConsistentForMutator();
739 #if DCHECK_IS_ON() 735 #if DCHECK_IS_ON()
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
869 // Large objects should not refer to header->size(). 865 // Large objects should not refer to header->size().
870 // The actual size of a large object is stored in 866 // The actual size of a large object is stored in
871 // LargeObjectPage::m_payloadSize. 867 // LargeObjectPage::m_payloadSize.
872 ASSERT(result != largeObjectSizeInHeader); 868 ASSERT(result != largeObjectSizeInHeader);
873 ASSERT(!pageFromObject(this)->isLargeObjectPage()); 869 ASSERT(!pageFromObject(this)->isLargeObjectPage());
874 return result; 870 return result;
875 } 871 }
876 872
877 #if DCHECK_IS_ON() 873 #if DCHECK_IS_ON()
878 NO_SANITIZE_ADDRESS inline bool HeapObjectHeader::checkHeader() const { 874 NO_SANITIZE_ADDRESS inline bool HeapObjectHeader::checkHeader() const {
879 return !pageFromObject(this)->orphaned() && m_magic == magic; 875 return m_magic == magic;
880 } 876 }
881 #endif 877 #endif
882 878
883 inline Address HeapObjectHeader::payload() { 879 inline Address HeapObjectHeader::payload() {
884 return reinterpret_cast<Address>(this) + sizeof(HeapObjectHeader); 880 return reinterpret_cast<Address>(this) + sizeof(HeapObjectHeader);
885 } 881 }
886 882
887 inline Address HeapObjectHeader::payloadEnd() { 883 inline Address HeapObjectHeader::payloadEnd() {
888 return reinterpret_cast<Address>(this) + size(); 884 return reinterpret_cast<Address>(this) + size();
889 } 885 }
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
973 return outOfLineAllocate(allocationSize, gcInfoIndex); 969 return outOfLineAllocate(allocationSize, gcInfoIndex);
974 } 970 }
975 971
976 inline NormalPageArena* NormalPage::arenaForNormalPage() const { 972 inline NormalPageArena* NormalPage::arenaForNormalPage() const {
977 return static_cast<NormalPageArena*>(arena()); 973 return static_cast<NormalPageArena*>(arena());
978 } 974 }
979 975
980 } // namespace blink 976 } // namespace blink
981 977
982 #endif // HeapPage_h 978 #endif // HeapPage_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698