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 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 // heap page. If so, find the start of that object and mark it | 396 // heap page. If so, find the start of that object and mark it |
397 // using the given Visitor. Otherwise do nothing. The pointer must | 397 // using the given Visitor. Otherwise do nothing. The pointer must |
398 // be within the same aligned blinkPageSize as the this-pointer. | 398 // be within the same aligned blinkPageSize as the this-pointer. |
399 // | 399 // |
400 // This is used during conservative stack scanning to | 400 // This is used during conservative stack scanning to |
401 // conservatively mark all objects that could be referenced from | 401 // conservatively mark all objects that could be referenced from |
402 // the stack. | 402 // the stack. |
403 virtual void checkAndMarkPointer(Visitor*, Address) = 0; | 403 virtual void checkAndMarkPointer(Visitor*, Address) = 0; |
404 virtual void markOrphaned(); | 404 virtual void markOrphaned(); |
405 | 405 |
406 virtual void takeSnapshot(String dumpBaseName, size_t pageIndex) = 0; | 406 virtual void takeSnapshot(String dumpBaseName, size_t pageIndex, ThreadState
::GCSnapshotInfo&) = 0; |
407 #if ENABLE(GC_PROFILING) | 407 #if ENABLE(GC_PROFILING) |
408 virtual const GCInfo* findGCInfo(Address) = 0; | 408 virtual const GCInfo* findGCInfo(Address) = 0; |
409 virtual void snapshot(TracedValue*, ThreadState::SnapshotInfo*) = 0; | 409 virtual void snapshot(TracedValue*, ThreadState::SnapshotInfo*) = 0; |
410 virtual void incrementMarkedObjectsAge() = 0; | 410 virtual void incrementMarkedObjectsAge() = 0; |
411 virtual void countMarkedObjects(ClassAgeCountsMap&) = 0; | 411 virtual void countMarkedObjects(ClassAgeCountsMap&) = 0; |
412 virtual void countObjectsToSweep(ClassAgeCountsMap&) = 0; | 412 virtual void countObjectsToSweep(ClassAgeCountsMap&) = 0; |
413 #endif | 413 #endif |
414 #if ENABLE(ASSERT) || ENABLE(GC_PROFILING) | 414 #if ENABLE(ASSERT) || ENABLE(GC_PROFILING) |
415 virtual bool contains(Address) = 0; | 415 virtual bool contains(Address) = 0; |
416 #endif | 416 #endif |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
478 virtual void removeFromHeap() override; | 478 virtual void removeFromHeap() override; |
479 virtual void sweep() override; | 479 virtual void sweep() override; |
480 virtual void makeConsistentForGC() override; | 480 virtual void makeConsistentForGC() override; |
481 virtual void makeConsistentForMutator() override; | 481 virtual void makeConsistentForMutator() override; |
482 #if defined(ADDRESS_SANITIZER) | 482 #if defined(ADDRESS_SANITIZER) |
483 virtual void poisonObjects(ObjectsToPoison, Poisoning) override; | 483 virtual void poisonObjects(ObjectsToPoison, Poisoning) override; |
484 #endif | 484 #endif |
485 virtual void checkAndMarkPointer(Visitor*, Address) override; | 485 virtual void checkAndMarkPointer(Visitor*, Address) override; |
486 virtual void markOrphaned() override; | 486 virtual void markOrphaned() override; |
487 | 487 |
488 void takeSnapshot(String dumpBaseName, size_t pageIndex) override; | 488 void takeSnapshot(String dumpBaseName, size_t pageIndex, ThreadState::GCSnap
shotInfo&) override; |
489 #if ENABLE(GC_PROFILING) | 489 #if ENABLE(GC_PROFILING) |
490 const GCInfo* findGCInfo(Address) override; | 490 const GCInfo* findGCInfo(Address) override; |
491 void snapshot(TracedValue*, ThreadState::SnapshotInfo*) override; | 491 void snapshot(TracedValue*, ThreadState::SnapshotInfo*) override; |
492 void incrementMarkedObjectsAge() override; | 492 void incrementMarkedObjectsAge() override; |
493 void countMarkedObjects(ClassAgeCountsMap&) override; | 493 void countMarkedObjects(ClassAgeCountsMap&) override; |
494 void countObjectsToSweep(ClassAgeCountsMap&) override; | 494 void countObjectsToSweep(ClassAgeCountsMap&) override; |
495 #endif | 495 #endif |
496 #if ENABLE(ASSERT) || ENABLE(GC_PROFILING) | 496 #if ENABLE(ASSERT) || ENABLE(GC_PROFILING) |
497 // Returns true for the whole blinkPageSize page that the page is on, even | 497 // Returns true for the whole blinkPageSize page that the page is on, even |
498 // for the header, and the unmapped guard page at the start. That ensures | 498 // for the header, and the unmapped guard page at the start. That ensures |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
543 virtual void removeFromHeap() override; | 543 virtual void removeFromHeap() override; |
544 virtual void sweep() override; | 544 virtual void sweep() override; |
545 virtual void makeConsistentForGC() override; | 545 virtual void makeConsistentForGC() override; |
546 virtual void makeConsistentForMutator() override; | 546 virtual void makeConsistentForMutator() override; |
547 #if defined(ADDRESS_SANITIZER) | 547 #if defined(ADDRESS_SANITIZER) |
548 virtual void poisonObjects(ObjectsToPoison, Poisoning) override; | 548 virtual void poisonObjects(ObjectsToPoison, Poisoning) override; |
549 #endif | 549 #endif |
550 virtual void checkAndMarkPointer(Visitor*, Address) override; | 550 virtual void checkAndMarkPointer(Visitor*, Address) override; |
551 virtual void markOrphaned() override; | 551 virtual void markOrphaned() override; |
552 | 552 |
553 void takeSnapshot(String dumpBaseName, size_t pageIndex) override; | 553 void takeSnapshot(String dumpBaseName, size_t pageIndex, ThreadState::GCSnap
shotInfo&) override; |
554 #if ENABLE(GC_PROFILING) | 554 #if ENABLE(GC_PROFILING) |
555 const GCInfo* findGCInfo(Address) override; | 555 const GCInfo* findGCInfo(Address) override; |
556 void snapshot(TracedValue*, ThreadState::SnapshotInfo*) override; | 556 void snapshot(TracedValue*, ThreadState::SnapshotInfo*) override; |
557 void incrementMarkedObjectsAge() override; | 557 void incrementMarkedObjectsAge() override; |
558 void countMarkedObjects(ClassAgeCountsMap&) override; | 558 void countMarkedObjects(ClassAgeCountsMap&) override; |
559 void countObjectsToSweep(ClassAgeCountsMap&) override; | 559 void countObjectsToSweep(ClassAgeCountsMap&) override; |
560 #endif | 560 #endif |
561 #if ENABLE(ASSERT) || ENABLE(GC_PROFILING) | 561 #if ENABLE(ASSERT) || ENABLE(GC_PROFILING) |
562 // Returns true for any address that is on one of the pages that this | 562 // Returns true for any address that is on one of the pages that this |
563 // large object uses. That ensures that we can use a negative result to | 563 // large object uses. That ensures that we can use a negative result to |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
685 // | 685 // |
686 // BaseHeap is a parent class of NormalPageHeap and LargeObjectHeap. | 686 // BaseHeap is a parent class of NormalPageHeap and LargeObjectHeap. |
687 // NormalPageHeap represents a heap that contains NormalPages | 687 // NormalPageHeap represents a heap that contains NormalPages |
688 // and LargeObjectHeap represents a heap that contains LargeObjectPages. | 688 // and LargeObjectHeap represents a heap that contains LargeObjectPages. |
689 class PLATFORM_EXPORT BaseHeap { | 689 class PLATFORM_EXPORT BaseHeap { |
690 public: | 690 public: |
691 BaseHeap(ThreadState*, int); | 691 BaseHeap(ThreadState*, int); |
692 virtual ~BaseHeap(); | 692 virtual ~BaseHeap(); |
693 void cleanupPages(); | 693 void cleanupPages(); |
694 | 694 |
695 void takeSnapshot(const String& dumpBaseName); | 695 void takeSnapshot(const String& dumpBaseName, ThreadState::GCSnapshotInfo&); |
696 #if ENABLE(ASSERT) || ENABLE(GC_PROFILING) | 696 #if ENABLE(ASSERT) || ENABLE(GC_PROFILING) |
697 BasePage* findPageFromAddress(Address); | 697 BasePage* findPageFromAddress(Address); |
698 #endif | 698 #endif |
699 virtual void takeFreelistSnapshot(const String& dumpBaseName) { }; | 699 virtual void takeFreelistSnapshot(const String& dumpBaseName) { }; |
700 #if ENABLE(GC_PROFILING) | 700 #if ENABLE(GC_PROFILING) |
701 void snapshot(TracedValue*, ThreadState::SnapshotInfo*); | 701 void snapshot(TracedValue*, ThreadState::SnapshotInfo*); |
702 virtual void snapshotFreeList(TracedValue&) { }; | 702 virtual void snapshotFreeList(TracedValue&) { }; |
703 | 703 |
704 void countMarkedObjects(ClassAgeCountsMap&) const; | 704 void countMarkedObjects(ClassAgeCountsMap&) const; |
705 void countObjectsToSweep(ClassAgeCountsMap&) const; | 705 void countObjectsToSweep(ClassAgeCountsMap&) const; |
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1400 size_t copySize = previousHeader->payloadSize(); | 1400 size_t copySize = previousHeader->payloadSize(); |
1401 if (copySize > size) | 1401 if (copySize > size) |
1402 copySize = size; | 1402 copySize = size; |
1403 memcpy(address, previous, copySize); | 1403 memcpy(address, previous, copySize); |
1404 return address; | 1404 return address; |
1405 } | 1405 } |
1406 | 1406 |
1407 } // namespace blink | 1407 } // namespace blink |
1408 | 1408 |
1409 #endif // Heap_h | 1409 #endif // Heap_h |
OLD | NEW |