| Index: src/heap.h
|
| diff --git a/src/heap.h b/src/heap.h
|
| index b1ef19f535b500a2e274e82eb2a7fcd34ad55086..e05130da3cde6e835cb045d16ae54d6a4be45a20 100644
|
| --- a/src/heap.h
|
| +++ b/src/heap.h
|
| @@ -213,6 +213,43 @@ typedef bool (*DirtyRegionCallback)(Address start,
|
| Address end,
|
| ObjectSlotCallback copy_object_func);
|
|
|
| +enum RootsPartition {
|
| + kStrongRootsList,
|
| + kBootstrapperRoots,
|
| + kTopRoots,
|
| + kRelocatableRoots,
|
| +#ifdef ENABLE_DEBUGGER_SUPPORT
|
| + kDebugRoots,
|
| +#endif
|
| + kCompilationCacheRoots,
|
| + kHandleScopeRoots,
|
| + kBuiltinsRoots,
|
| + kGlobalHandlesRoots,
|
| + kThreadManagerRoots,
|
| + kSerializerDeserializerRoots,
|
| + kNumberOfRootsPartitions
|
| +};
|
| +
|
| +class RootsPartitioner : public AllStatic {
|
| + public:
|
| + static bool Claim(RootsPartition partition) {
|
| + return (partitions_state_[partition] == UNCLAIMED) &&
|
| + AtomicCompareAndSwap(&partitions_state_[partition], UNCLAIMED, CLAIMED);
|
| + }
|
| +
|
| + static void Reset() {
|
| + for (int i = 0; i < kNumberOfRootsPartitions; i++) {
|
| + partitions_state_[i] = UNCLAIMED;
|
| + }
|
| + }
|
| +
|
| + private:
|
| + static const Atomic32 CLAIMED = 0;
|
| + static const Atomic32 UNCLAIMED = 1;
|
| +
|
| + static Atomic32 partitions_state_[kNumberOfRootsPartitions];
|
| +};
|
| +
|
|
|
| // The all static Heap captures the interface to the global object heap.
|
| // All JavaScript contexts by this process share the same object heap.
|
| @@ -771,6 +808,11 @@ class Heap : public AllStatic {
|
| static void IterateRoots(ObjectVisitor* v, VisitMode mode);
|
| // Iterates over all strong roots in the heap.
|
| static void IterateStrongRoots(ObjectVisitor* v, VisitMode mode);
|
| +
|
| + static void ClaimAndIterateStrongRootsGroup(ObjectVisitor* v,
|
| + VisitMode mode,
|
| + RootsPartition partition);
|
| +
|
| // Iterates over all the other roots in the heap.
|
| static void IterateWeakRoots(ObjectVisitor* v, VisitMode mode);
|
|
|
| @@ -1659,53 +1701,6 @@ class DescriptorLookupCache {
|
| };
|
|
|
|
|
| -// ----------------------------------------------------------------------------
|
| -// Marking stack for tracing live objects.
|
| -
|
| -class MarkingStack {
|
| - public:
|
| - void Initialize(Address low, Address high) {
|
| - top_ = low_ = reinterpret_cast<HeapObject**>(low);
|
| - high_ = reinterpret_cast<HeapObject**>(high);
|
| - overflowed_ = false;
|
| - }
|
| -
|
| - bool is_full() { return top_ >= high_; }
|
| -
|
| - bool is_empty() { return top_ <= low_; }
|
| -
|
| - bool overflowed() { return overflowed_; }
|
| -
|
| - void clear_overflowed() { overflowed_ = false; }
|
| -
|
| - // Push the (marked) object on the marking stack if there is room,
|
| - // otherwise mark the object as overflowed and wait for a rescan of the
|
| - // heap.
|
| - void Push(HeapObject* object) {
|
| - CHECK(object->IsHeapObject());
|
| - if (is_full()) {
|
| - object->SetOverflow();
|
| - overflowed_ = true;
|
| - } else {
|
| - *(top_++) = object;
|
| - }
|
| - }
|
| -
|
| - HeapObject* Pop() {
|
| - ASSERT(!is_empty());
|
| - HeapObject* object = *(--top_);
|
| - CHECK(object->IsHeapObject());
|
| - return object;
|
| - }
|
| -
|
| - private:
|
| - HeapObject** low_;
|
| - HeapObject** top_;
|
| - HeapObject** high_;
|
| - bool overflowed_;
|
| -};
|
| -
|
| -
|
| // A helper class to document/test C++ scopes where we do not
|
| // expect a GC. Usage:
|
| //
|
| @@ -1823,11 +1818,13 @@ class GCTracer BASE_EMBEDDED {
|
| void set_is_compacting() { is_compacting_ = true; }
|
| bool is_compacting() const { return is_compacting_; }
|
|
|
| +#ifdef DEBUG
|
| // Increment and decrement the count of marked objects.
|
| - void increment_marked_count() { ++marked_count_; }
|
| + void increment_marked_count() { AtomicAdd(&marked_count_, 1); }
|
| void decrement_marked_count() { --marked_count_; }
|
|
|
| int marked_count() { return marked_count_; }
|
| +#endif
|
|
|
| void increment_promoted_objects_size(int object_size) {
|
| promoted_objects_size_ += object_size;
|
| @@ -1870,14 +1867,12 @@ class GCTracer BASE_EMBEDDED {
|
| // false if there has not been a previous full GC).
|
| bool previous_has_compacted_;
|
|
|
| +#ifdef DEBUG
|
| // On a full GC, a count of the number of marked objects. Incremented
|
| // when an object is marked and decremented when an object's mark bit is
|
| // cleared. Will be zero on a scavenge collection.
|
| int marked_count_;
|
| -
|
| - // The count from the end of the previous full GC. Will be zero if there
|
| - // was no previous full GC.
|
| - int previous_marked_count_;
|
| +#endif
|
|
|
| // Amounts of time spent in different scopes during GC.
|
| double scopes_[Scope::kNumberOfScopes];
|
|
|