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 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 // heap page. If so, find the start of that object and mark it | 381 // heap page. If so, find the start of that object and mark it |
382 // using the given Visitor. Otherwise do nothing. The pointer must | 382 // using the given Visitor. Otherwise do nothing. The pointer must |
383 // be within the same aligned blinkPageSize as the this-pointer. | 383 // be within the same aligned blinkPageSize as the this-pointer. |
384 // | 384 // |
385 // This is used during conservative stack scanning to | 385 // This is used during conservative stack scanning to |
386 // conservatively mark all objects that could be referenced from | 386 // conservatively mark all objects that could be referenced from |
387 // the stack. | 387 // the stack. |
388 virtual void checkAndMarkPointer(Visitor*, Address) = 0; | 388 virtual void checkAndMarkPointer(Visitor*, Address) = 0; |
389 virtual void markOrphaned(); | 389 virtual void markOrphaned(); |
390 | 390 |
391 virtual void takeSnapshot(String dumpBaseName, size_t pageIndex, size_t* out
FreeSize, size_t* outFreeCount) = 0; | 391 virtual void takeSnapshot(String dumpBaseName, size_t pageIndex, ThreadState
::GCSnapshotInfo&, size_t* outFreeSize, size_t* outFreeCount) = 0; |
392 #if ENABLE(GC_PROFILING) | 392 #if ENABLE(GC_PROFILING) |
393 virtual const GCInfo* findGCInfo(Address) = 0; | 393 virtual const GCInfo* findGCInfo(Address) = 0; |
394 virtual void snapshot(TracedValue*, ThreadState::SnapshotInfo*) = 0; | 394 virtual void snapshot(TracedValue*, ThreadState::SnapshotInfo*) = 0; |
395 virtual void incrementMarkedObjectsAge() = 0; | 395 virtual void incrementMarkedObjectsAge() = 0; |
396 virtual void countMarkedObjects(ClassAgeCountsMap&) = 0; | 396 virtual void countMarkedObjects(ClassAgeCountsMap&) = 0; |
397 virtual void countObjectsToSweep(ClassAgeCountsMap&) = 0; | 397 virtual void countObjectsToSweep(ClassAgeCountsMap&) = 0; |
398 #endif | 398 #endif |
399 #if ENABLE(ASSERT) || ENABLE(GC_PROFILING) | 399 #if ENABLE(ASSERT) || ENABLE(GC_PROFILING) |
400 virtual bool contains(Address) = 0; | 400 virtual bool contains(Address) = 0; |
401 #endif | 401 #endif |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 void removeFromHeap() override; | 463 void removeFromHeap() override; |
464 void sweep() override; | 464 void sweep() override; |
465 void makeConsistentForGC() override; | 465 void makeConsistentForGC() override; |
466 void makeConsistentForMutator() override; | 466 void makeConsistentForMutator() override; |
467 #if defined(ADDRESS_SANITIZER) | 467 #if defined(ADDRESS_SANITIZER) |
468 void poisonObjects(ThreadState::ObjectsToPoison, ThreadState::Poisoning) ove
rride; | 468 void poisonObjects(ThreadState::ObjectsToPoison, ThreadState::Poisoning) ove
rride; |
469 #endif | 469 #endif |
470 void checkAndMarkPointer(Visitor*, Address) override; | 470 void checkAndMarkPointer(Visitor*, Address) override; |
471 void markOrphaned() override; | 471 void markOrphaned() override; |
472 | 472 |
473 void takeSnapshot(String dumpBaseName, size_t pageIndex, size_t* outFreeSize
, size_t* outFreeCount) override; | 473 void takeSnapshot(String dumpBaseName, size_t pageIndex, ThreadState::GCSnap
shotInfo&, size_t* outFreeSize, size_t* outFreeCount) override; |
474 #if ENABLE(GC_PROFILING) | 474 #if ENABLE(GC_PROFILING) |
475 const GCInfo* findGCInfo(Address) override; | 475 const GCInfo* findGCInfo(Address) override; |
476 void snapshot(TracedValue*, ThreadState::SnapshotInfo*) override; | 476 void snapshot(TracedValue*, ThreadState::SnapshotInfo*) override; |
477 void incrementMarkedObjectsAge() override; | 477 void incrementMarkedObjectsAge() override; |
478 void countMarkedObjects(ClassAgeCountsMap&) override; | 478 void countMarkedObjects(ClassAgeCountsMap&) override; |
479 void countObjectsToSweep(ClassAgeCountsMap&) override; | 479 void countObjectsToSweep(ClassAgeCountsMap&) override; |
480 #endif | 480 #endif |
481 #if ENABLE(ASSERT) || ENABLE(GC_PROFILING) | 481 #if ENABLE(ASSERT) || ENABLE(GC_PROFILING) |
482 // Returns true for the whole blinkPageSize page that the page is on, even | 482 // Returns true for the whole blinkPageSize page that the page is on, even |
483 // for the header, and the unmapped guard page at the start. That ensures | 483 // 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... |
528 void removeFromHeap() override; | 528 void removeFromHeap() override; |
529 void sweep() override; | 529 void sweep() override; |
530 void makeConsistentForGC() override; | 530 void makeConsistentForGC() override; |
531 void makeConsistentForMutator() override; | 531 void makeConsistentForMutator() override; |
532 #if defined(ADDRESS_SANITIZER) | 532 #if defined(ADDRESS_SANITIZER) |
533 void poisonObjects(ThreadState::ObjectsToPoison, ThreadState::Poisoning) ove
rride; | 533 void poisonObjects(ThreadState::ObjectsToPoison, ThreadState::Poisoning) ove
rride; |
534 #endif | 534 #endif |
535 void checkAndMarkPointer(Visitor*, Address) override; | 535 void checkAndMarkPointer(Visitor*, Address) override; |
536 void markOrphaned() override; | 536 void markOrphaned() override; |
537 | 537 |
538 void takeSnapshot(String dumpBaseName, size_t pageIndex, size_t* outFreeSize
, size_t* outFreeCount) override; | 538 void takeSnapshot(String dumpBaseName, size_t pageIndex, ThreadState::GCSnap
shotInfo&, size_t* outFreeSize, size_t* outFreeCount) override; |
539 #if ENABLE(GC_PROFILING) | 539 #if ENABLE(GC_PROFILING) |
540 const GCInfo* findGCInfo(Address) override; | 540 const GCInfo* findGCInfo(Address) override; |
541 void snapshot(TracedValue*, ThreadState::SnapshotInfo*) override; | 541 void snapshot(TracedValue*, ThreadState::SnapshotInfo*) override; |
542 void incrementMarkedObjectsAge() override; | 542 void incrementMarkedObjectsAge() override; |
543 void countMarkedObjects(ClassAgeCountsMap&) override; | 543 void countMarkedObjects(ClassAgeCountsMap&) override; |
544 void countObjectsToSweep(ClassAgeCountsMap&) override; | 544 void countObjectsToSweep(ClassAgeCountsMap&) override; |
545 #endif | 545 #endif |
546 #if ENABLE(ASSERT) || ENABLE(GC_PROFILING) | 546 #if ENABLE(ASSERT) || ENABLE(GC_PROFILING) |
547 // Returns true for any address that is on one of the pages that this | 547 // Returns true for any address that is on one of the pages that this |
548 // large object uses. That ensures that we can use a negative result to | 548 // large object uses. That ensures that we can use a negative result to |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
674 // | 674 // |
675 // BaseHeap is a parent class of NormalPageHeap and LargeObjectHeap. | 675 // BaseHeap is a parent class of NormalPageHeap and LargeObjectHeap. |
676 // NormalPageHeap represents a heap that contains NormalPages | 676 // NormalPageHeap represents a heap that contains NormalPages |
677 // and LargeObjectHeap represents a heap that contains LargeObjectPages. | 677 // and LargeObjectHeap represents a heap that contains LargeObjectPages. |
678 class PLATFORM_EXPORT BaseHeap { | 678 class PLATFORM_EXPORT BaseHeap { |
679 public: | 679 public: |
680 BaseHeap(ThreadState*, int); | 680 BaseHeap(ThreadState*, int); |
681 virtual ~BaseHeap(); | 681 virtual ~BaseHeap(); |
682 void cleanupPages(); | 682 void cleanupPages(); |
683 | 683 |
684 void takeSnapshot(const String& dumpBaseName); | 684 void takeSnapshot(const String& dumpBaseName, ThreadState::GCSnapshotInfo&); |
685 #if ENABLE(ASSERT) || ENABLE(GC_PROFILING) | 685 #if ENABLE(ASSERT) || ENABLE(GC_PROFILING) |
686 BasePage* findPageFromAddress(Address); | 686 BasePage* findPageFromAddress(Address); |
687 #endif | 687 #endif |
688 virtual void takeFreelistSnapshot(const String& dumpBaseName) { } | 688 virtual void takeFreelistSnapshot(const String& dumpBaseName) { } |
689 #if ENABLE(GC_PROFILING) | 689 #if ENABLE(GC_PROFILING) |
690 void snapshot(TracedValue*, ThreadState::SnapshotInfo*); | 690 void snapshot(TracedValue*, ThreadState::SnapshotInfo*); |
691 virtual void snapshotFreeList(TracedValue&) { } | 691 virtual void snapshotFreeList(TracedValue&) { } |
692 | 692 |
693 void countMarkedObjects(ClassAgeCountsMap&) const; | 693 void countMarkedObjects(ClassAgeCountsMap&) const; |
694 void countObjectsToSweep(ClassAgeCountsMap&) const; | 694 void countObjectsToSweep(ClassAgeCountsMap&) const; |
(...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1392 size_t copySize = previousHeader->payloadSize(); | 1392 size_t copySize = previousHeader->payloadSize(); |
1393 if (copySize > size) | 1393 if (copySize > size) |
1394 copySize = size; | 1394 copySize = size; |
1395 memcpy(address, previous, copySize); | 1395 memcpy(address, previous, copySize); |
1396 return address; | 1396 return address; |
1397 } | 1397 } |
1398 | 1398 |
1399 } // namespace blink | 1399 } // namespace blink |
1400 | 1400 |
1401 #endif // Heap_h | 1401 #endif // Heap_h |
OLD | NEW |