OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_HEAP_HEAP_H_ | 5 #ifndef V8_HEAP_HEAP_H_ |
6 #define V8_HEAP_HEAP_H_ | 6 #define V8_HEAP_HEAP_H_ |
7 | 7 |
8 #include <cmath> | 8 #include <cmath> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
583 kStrongRootListLength = kStringTableRootIndex, | 583 kStrongRootListLength = kStringTableRootIndex, |
584 kSmiRootsStart = kStringTableRootIndex + 1 | 584 kSmiRootsStart = kStringTableRootIndex + 1 |
585 }; | 585 }; |
586 | 586 |
587 enum FindMementoMode { kForRuntime, kForGC }; | 587 enum FindMementoMode { kForRuntime, kForGC }; |
588 | 588 |
589 enum HeapState { NOT_IN_GC, SCAVENGE, MARK_COMPACT, MINOR_MARK_COMPACT }; | 589 enum HeapState { NOT_IN_GC, SCAVENGE, MARK_COMPACT, MINOR_MARK_COMPACT }; |
590 | 590 |
591 enum UpdateAllocationSiteMode { kGlobal, kCached }; | 591 enum UpdateAllocationSiteMode { kGlobal, kCached }; |
592 | 592 |
593 // Taking this lock prevents the GC from entering a phase that relocates | 593 // Taking this mutex prevents the GC from entering a phase that relocates |
594 // object references. | 594 // object references. |
595 class RelocationLock { | 595 base::Mutex* relocation_mutex() { return &relocation_mutex_; } |
596 public: | |
597 explicit RelocationLock(Heap* heap) : heap_(heap) { | |
598 heap_->relocation_mutex_.Lock(); | |
599 } | |
600 | |
601 ~RelocationLock() { heap_->relocation_mutex_.Unlock(); } | |
602 | |
603 private: | |
604 Heap* heap_; | |
605 }; | |
606 | 596 |
607 // Support for partial snapshots. After calling this we have a linear | 597 // Support for partial snapshots. After calling this we have a linear |
608 // space to write objects in each space. | 598 // space to write objects in each space. |
609 struct Chunk { | 599 struct Chunk { |
610 uint32_t size; | 600 uint32_t size; |
611 Address start; | 601 Address start; |
612 Address end; | 602 Address end; |
613 }; | 603 }; |
614 typedef std::vector<Chunk> Reservation; | 604 typedef std::vector<Chunk> Reservation; |
615 | 605 |
(...skipping 2039 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2655 friend class PagedSpace; | 2645 friend class PagedSpace; |
2656 DISALLOW_COPY_AND_ASSIGN(AllocationObserver); | 2646 DISALLOW_COPY_AND_ASSIGN(AllocationObserver); |
2657 }; | 2647 }; |
2658 | 2648 |
2659 V8_EXPORT_PRIVATE const char* AllocationSpaceName(AllocationSpace space); | 2649 V8_EXPORT_PRIVATE const char* AllocationSpaceName(AllocationSpace space); |
2660 | 2650 |
2661 } // namespace internal | 2651 } // namespace internal |
2662 } // namespace v8 | 2652 } // namespace v8 |
2663 | 2653 |
2664 #endif // V8_HEAP_HEAP_H_ | 2654 #endif // V8_HEAP_HEAP_H_ |
OLD | NEW |