32 using namespace v8::internal;
40 static bool CanSkipCallback(
Heap* heap,
Object** pointer) {
41 can_skip_called_objects.
Add(*pointer);
42 return skippable_objects.
Contains(*pointer);
46 static void ResetCanSkipData() {
47 skippable_objects.Clear();
48 can_skip_called_objects.Clear();
59 ASSERT(!has_been_disposed_);
60 has_been_disposed_ =
true;
69 virtual const char*
GetLabel() {
return "whatever"; }
72 bool has_been_disposed_;
79 for (
Object** o = start; o != end; ++o)
87 TEST(IterateObjectGroupsOldApi) {
103 TestRetainedObjectInfo info1;
104 TestRetainedObjectInfo info2;
106 Object** g1_objects[] = { g1s1.location(), g1s2.location() };
107 Object** g2_objects[] = { g2s1.location(), g2s2.location() };
116 skippable_objects.
Add(*g1s1.location());
117 skippable_objects.
Add(*g1s2.location());
118 skippable_objects.
Add(*g2s1.location());
119 skippable_objects.
Add(*g2s2.location());
124 ASSERT(can_skip_called_objects.length() == 4);
132 ASSERT(!info1.has_been_disposed());
133 ASSERT(!info2.has_been_disposed());
141 skippable_objects.
Add(*g1s1.location());
142 skippable_objects.
Add(*g2s1.location());
143 skippable_objects.
Add(*g2s2.location());
148 ASSERT(can_skip_called_objects.length() == 3 ||
149 can_skip_called_objects.length() == 4);
158 ASSERT(info1.has_been_disposed());
159 ASSERT(!info2.has_been_disposed());
169 ASSERT(can_skip_called_objects.length() == 1);
171 can_skip_called_objects.
Contains(*g2s2.location()));
177 ASSERT(info2.has_been_disposed());
199 TestRetainedObjectInfo info1;
200 TestRetainedObjectInfo info2;
211 skippable_objects.
Add(*g1s1.location());
212 skippable_objects.
Add(*g1s2.location());
213 skippable_objects.
Add(*g2s1.location());
214 skippable_objects.
Add(*g2s2.location());
219 ASSERT(can_skip_called_objects.length() == 4);
227 ASSERT(!info1.has_been_disposed());
228 ASSERT(!info2.has_been_disposed());
236 skippable_objects.
Add(*g1s1.location());
237 skippable_objects.
Add(*g2s1.location());
238 skippable_objects.
Add(*g2s2.location());
243 ASSERT(can_skip_called_objects.length() == 3 ||
244 can_skip_called_objects.length() == 4);
253 ASSERT(info1.has_been_disposed());
254 ASSERT(!info2.has_been_disposed());
264 ASSERT(can_skip_called_objects.length() == 1);
266 can_skip_called_objects.
Contains(*g2s2.location()));
272 ASSERT(info2.has_been_disposed());
309 ASSERT(implicit_refs->length() == 2);
311 reinterpret_cast<HeapObject**
>(g1s1.location()));
316 reinterpret_cast<HeapObject**
>(g2s1.location()));
331 const int kArrayLength = 2048-1;
332 int indices[kArrayLength];
336 for (
int i = 0; i < kArrayLength; i++) {
345 CHECK(eternals[i].IsEmpty());
346 eternals[i].
Set(v8_isolate,
object);
347 CHECK(!eternals[i].IsEmpty());
352 for (
int i = 0; i < kArrayLength; i++) {
353 for (
int j = 0; j < 2; j++) {
361 local = eternals[i].
Get(v8_isolate);
365 CHECK(value->IsInt32());
378 CHECK(
object == eternal.
Get(v8_isolate));
void RemoveImplicitRefGroups()
List< ImplicitRefGroup * > * implicit_ref_groups()
#define CHECK_EQ(expected, value)
bool Contains(const T &elm) const
virtual void VisitPointers(Object **start, Object **end)
void SetReferenceFromGroup(UniqueId id, Object **child)
#define ASSERT(condition)
void Create(Isolate *isolate, Object *object, int *index)
static Local< Integer > New(Isolate *isolate, int32_t value)
V8_INLINE void Set(Isolate *isolate, Local< S > handle)
void AddObjectGroup(Object ***handles, size_t length, v8::RetainedObjectInfo *info)
virtual bool IsEquivalent(v8::RetainedObjectInfo *other)
Handle< Object > Create(Object *value)
void CollectAllAvailableGarbage(const char *gc_reason=NULL)
EternalHandles * eternal_handles()
GlobalHandles * global_handles()
static V8_INLINE Handle< T > Cast(Handle< S > that)
static i::Isolate * i_isolate()
static v8::internal::Handle< To > OpenHandle(v8::Local< From > handle)
static Local< Context > ToLocal(v8::internal::Handle< v8::internal::Context > obj)
static Local< Object > New(Isolate *isolate)
virtual intptr_t GetHash()
bool IterateObjectGroups(ObjectVisitor *v, WeakSlotCallbackWithHeap can_skip)
void SetRetainedObjectInfo(UniqueId id, RetainedObjectInfo *info)
static void InitializeVM()
Handle< Object > Get(int index)
virtual const char * GetLabel()
void SetObjectGroupId(Object **handle, UniqueId id)
MUST_USE_RESULT MaybeObject * AllocateFixedArray(int length, PretenureFlag pretenure=NOT_TENURED)
void RemoveObjectGroups()
void Add(const T &element, AllocationPolicy allocator=AllocationPolicy())
V8_INLINE Local< T > Get(Isolate *isolate)
static v8::Isolate * isolate()