Handle<JSObject> key,
int value) {
Handle<ObjectHashTable> table = PutIntoObjectHashTable(
- Handle<ObjectHashTable>(weakmap->table()),
+ Handle<ObjectHashTable>(ObjectHashTable::cast(weakmap->table())),
Handle<JSObject>(JSObject::cast(*key)),
Handle<Smi>(Smi::FromInt(value)));
weakmap->set_table(*table);
v8::HandleScope scope;
PutIntoWeakMap(weakmap, Handle<JSObject>(JSObject::cast(*key)), 23);
}
- CHECK_EQ(1, weakmap->table()->NumberOfElements());
+ CHECK_EQ(1, ObjectHashTable::cast(weakmap->table())->NumberOfElements());
// Force a full GC.
HEAP->CollectAllGarbage(false);
CHECK_EQ(0, NumberOfWeakCalls);
- CHECK_EQ(1, weakmap->table()->NumberOfElements());
- CHECK_EQ(0, weakmap->table()->NumberOfDeletedElements());
+ CHECK_EQ(1, ObjectHashTable::cast(weakmap->table())->NumberOfElements());
+ CHECK_EQ(
+ 0, ObjectHashTable::cast(weakmap->table())->NumberOfDeletedElements());
// Make the global reference to the key weak.
{
// weak references whereas the second one will also clear weak maps.
HEAP->CollectAllGarbage(false);
CHECK_EQ(1, NumberOfWeakCalls);
- CHECK_EQ(1, weakmap->table()->NumberOfElements());
- CHECK_EQ(0, weakmap->table()->NumberOfDeletedElements());
+ CHECK_EQ(1, ObjectHashTable::cast(weakmap->table())->NumberOfElements());
+ CHECK_EQ(
+ 0, ObjectHashTable::cast(weakmap->table())->NumberOfDeletedElements());
HEAP->CollectAllGarbage(false);
CHECK_EQ(1, NumberOfWeakCalls);
- CHECK_EQ(0, weakmap->table()->NumberOfElements());
- CHECK_EQ(1, weakmap->table()->NumberOfDeletedElements());
+ CHECK_EQ(0, ObjectHashTable::cast(weakmap->table())->NumberOfElements());
+ CHECK_EQ(
+ 1, ObjectHashTable::cast(weakmap->table())->NumberOfDeletedElements());
}
Handle<JSWeakMap> weakmap = AllocateJSWeakMap();
// Check initial capacity.
- CHECK_EQ(32, weakmap->table()->Capacity());
+ CHECK_EQ(32, ObjectHashTable::cast(weakmap->table())->Capacity());
// Fill up weak map to trigger capacity change.
{
}
// Check increased capacity.
- CHECK_EQ(128, weakmap->table()->Capacity());
+ CHECK_EQ(128, ObjectHashTable::cast(weakmap->table())->Capacity());
// Force a full GC.
- CHECK_EQ(32, weakmap->table()->NumberOfElements());
- CHECK_EQ(0, weakmap->table()->NumberOfDeletedElements());
+ CHECK_EQ(32, ObjectHashTable::cast(weakmap->table())->NumberOfElements());
+ CHECK_EQ(
+ 0, ObjectHashTable::cast(weakmap->table())->NumberOfDeletedElements());
HEAP->CollectAllGarbage(false);
- CHECK_EQ(0, weakmap->table()->NumberOfElements());
- CHECK_EQ(32, weakmap->table()->NumberOfDeletedElements());
+ CHECK_EQ(0, ObjectHashTable::cast(weakmap->table())->NumberOfElements());
+ CHECK_EQ(
+ 32, ObjectHashTable::cast(weakmap->table())->NumberOfDeletedElements());
// Check shrunk capacity.
- CHECK_EQ(32, weakmap->table()->Capacity());
+ CHECK_EQ(32, ObjectHashTable::cast(weakmap->table())->Capacity());
}