Fix compilation error and add missing file to GYP.
R=ricow@chromium.org Review URL: http://codereview.chromium.org/8136004 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9518 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
2fb58638a6
commit
9f06a99592
@ -91,7 +91,8 @@
|
||||
'test-threads.cc',
|
||||
'test-unbound-queue.cc',
|
||||
'test-utils.cc',
|
||||
'test-version.cc'
|
||||
'test-version.cc',
|
||||
'test-weakmaps.cc'
|
||||
],
|
||||
'conditions': [
|
||||
['v8_target_arch=="ia32"', {
|
||||
|
@ -50,7 +50,7 @@ static void PutIntoWeakMap(Handle<JSWeakMap> weakmap,
|
||||
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);
|
||||
@ -85,13 +85,14 @@ TEST(Weakness) {
|
||||
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.
|
||||
{
|
||||
@ -107,12 +108,14 @@ TEST(Weakness) {
|
||||
// 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());
|
||||
}
|
||||
|
||||
|
||||
@ -122,7 +125,7 @@ TEST(Shrinking) {
|
||||
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.
|
||||
{
|
||||
@ -135,15 +138,17 @@ TEST(Shrinking) {
|
||||
}
|
||||
|
||||
// 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());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user