#include "src/counters.h"
#include "src/heap/heap.h"
#include "src/heap/incremental-marking-inl.h"
-#include "src/heap/objects-visiting.h"
#include "src/heap/spaces-inl.h"
#include "src/heap/store-buffer.h"
#include "src/heap/store-buffer-inl.h"
}
// Must be called only after |instance_type|, |instance_size| and
// |layout_descriptor| are set.
- map->set_visitor_id(StaticVisitorBase::GetVisitorId(map));
+ map->set_visitor_id(Heap::GetStaticVisitorIdForMap(map));
map->set_bit_field(0);
map->set_bit_field2(1 << Map::kIsExtensible);
int bit_field3 = Map::EnumLengthBits::encode(kInvalidEnumCacheSentinel) |
return false;
}
+
+// static
+int Heap::GetStaticVisitorIdForMap(Map* map) {
+ return StaticVisitorBase::GetVisitorId(map);
+}
+
} // namespace internal
} // namespace v8
// The roots that have an index less than this are always in old space.
static const int kOldSpaceRoots = 0x20;
+ // The minimum size of a HeapObject on the heap.
+ static const int kMinObjectSizeInWords = 2;
+
STATIC_ASSERT(kUndefinedValueRootIndex ==
Internals::kUndefinedValueRootIndex);
STATIC_ASSERT(kNullValueRootIndex == Internals::kNullValueRootIndex);
// pointer size aligned addresses.
static inline void MoveBlock(Address dst, Address src, int byte_size);
+ // Determines a static visitor id based on the given {map} that can then be
+ // stored on the map to facilitate fast dispatch for {StaticVisitorBase}.
+ static int GetStaticVisitorIdForMap(Map* map);
+
// Notifies the heap that is ok to start marking or other activities that
// should not happen during deserialization.
void NotifyDeserializationComplete();
AllocationAlignment alignment);
// ===========================================================================
- // ArrayBufferTracker. =======================================================
+ // ArrayBuffer tracking. =====================================================
// ===========================================================================
+
void RegisterNewArrayBuffer(JSArrayBuffer* buffer);
void UnregisterArrayBuffer(JSArrayBuffer* buffer);
const char* Marking::kImpossibleBitPattern = "01";
+// The following has to hold in order for {Marking::MarkBitFrom} to not produce
+// invalid {kImpossibleBitPattern} in the marking bitmap by overlapping.
+STATIC_ASSERT(Heap::kMinObjectSizeInWords >= 2);
+
+
// -------------------------------------------------------------------------
// MarkCompactCollector
markbit.Next().Set();
}
- static void SetAllMarkBitsInRange(MarkBit start, MarkBit end);
- static void ClearAllMarkBitsOfCellsContainedInRange(MarkBit start,
- MarkBit end);
-
static void TransferMark(Heap* heap, Address old_start, Address new_start);
#ifdef DEBUG
#define V8_OBJECTS_VISITING_H_
#include "src/allocation.h"
+#include "src/heap/heap.h"
#include "src/heap/spaces.h"
#include "src/layout-descriptor.h"
kVisitDataObject = kVisitDataObject2,
kVisitJSObject = kVisitJSObject2,
kVisitStruct = kVisitStruct2,
- kMinObjectSizeInWords = 2
};
// Visitor ID should fit in one byte.
DCHECK((base == kVisitDataObject) || (base == kVisitStruct) ||
(base == kVisitJSObject));
DCHECK(IsAligned(object_size, kPointerSize));
- DCHECK(kMinObjectSizeInWords * kPointerSize <= object_size);
+ DCHECK(Heap::kMinObjectSizeInWords * kPointerSize <= object_size);
DCHECK(object_size <= Page::kMaxRegularHeapObjectSize);
DCHECK(!has_unboxed_fields || (base == kVisitJSObject));
if (has_unboxed_fields) return generic;
- int visitor_id =
- Min(base + (object_size >> kPointerSizeLog2) - kMinObjectSizeInWords,
- static_cast<int>(generic));
+ int visitor_id = Min(
+ base + (object_size >> kPointerSizeLog2) - Heap::kMinObjectSizeInWords,
+ static_cast<int>(generic));
return static_cast<VisitorId>(visitor_id);
}
template <typename Visitor, StaticVisitorBase::VisitorId base,
StaticVisitorBase::VisitorId generic>
void RegisterSpecializations() {
- STATIC_ASSERT((generic - base + StaticVisitorBase::kMinObjectSizeInWords) ==
- 10);
+ STATIC_ASSERT((generic - base + Heap::kMinObjectSizeInWords) == 10);
RegisterSpecialization<Visitor, base, generic, 2>();
RegisterSpecialization<Visitor, base, generic, 3>();
RegisterSpecialization<Visitor, base, generic, 4>();
CHECK(is_dictionary_map());
CHECK(instance_descriptors()->IsEmpty());
CHECK_EQ(0, unused_property_fields());
- CHECK_EQ(StaticVisitorBase::GetVisitorId(this), visitor_id());
+ CHECK_EQ(Heap::GetStaticVisitorIdForMap(this), visitor_id());
}
// Verify that we can count more mementos than we can possibly find in one
// new space collection.
DCHECK((GetHeap()->MaxSemiSpaceSize() /
- (StaticVisitorBase::kMinObjectSizeInWords * kPointerSize +
+ (Heap::kMinObjectSizeInWords * kPointerSize +
AllocationMemento::kSize)) < MementoFoundCountBits::kMax);
DCHECK(count < MementoFoundCountBits::kMax);
set_pretenure_data(
// TODO(ishell): remove these checks from VERIFY_HEAP mode.
if (FLAG_verify_heap) {
CHECK(layout_descriptor()->IsConsistentWithMap(this));
- CHECK(visitor_id() == StaticVisitorBase::GetVisitorId(this));
+ CHECK(visitor_id() == Heap::GetStaticVisitorIdForMap(this));
}
#else
SLOW_DCHECK(layout_descriptor()->IsConsistentWithMap(this));
- DCHECK(visitor_id() == StaticVisitorBase::GetVisitorId(this));
+ DCHECK(visitor_id() == Heap::GetStaticVisitorIdForMap(this));
#endif
}
}
#else
SLOW_DCHECK(layout_descriptor()->IsConsistentWithMap(this));
#endif
- set_visitor_id(StaticVisitorBase::GetVisitorId(this));
+ set_visitor_id(Heap::GetStaticVisitorIdForMap(this));
}
}
#else
SLOW_DCHECK(result->layout_descriptor()->IsConsistentWithMap(*result));
#endif
- result->set_visitor_id(StaticVisitorBase::GetVisitorId(*result));
+ result->set_visitor_id(Heap::GetStaticVisitorIdForMap(*result));
}
Handle<Name> name = handle(descriptors->GetKey(new_descriptor));
copy->SetInObjectProperties(inobject_properties);
copy->set_unused_property_fields(inobject_properties);
copy->set_instance_size(new_instance_size);
- copy->set_visitor_id(StaticVisitorBase::GetVisitorId(*copy));
+ copy->set_visitor_id(Heap::GetStaticVisitorIdForMap(*copy));
return copy;
}
map->set_instance_size(map->instance_size() - slack * kPointerSize);
// Visitor id might depend on the instance size, recalculate it.
- map->set_visitor_id(StaticVisitorBase::GetVisitorId(map));
+ map->set_visitor_id(Heap::GetStaticVisitorIdForMap(map));
}