Pacify GCmole.

R=jarin@chromium.org

Review URL: https://codereview.chromium.org/490423003

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@23300 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
yangguo@chromium.org 2014-08-22 11:09:13 +00:00
parent a6adfd8f82
commit 2229575b26
2 changed files with 20 additions and 11 deletions

View File

@ -99,8 +99,8 @@ static void TestHashMap(Handle<HashMap> table) {
for (int i = 0; i < 100; i++) { for (int i = 0; i < 100; i++) {
Handle<JSReceiver> key = factory->NewJSArray(7); Handle<JSReceiver> key = factory->NewJSArray(7);
CHECK_EQ(table->Lookup(key), CcTest::heap()->the_hole_value()); CHECK_EQ(table->Lookup(key), CcTest::heap()->the_hole_value());
CHECK_EQ(key->GetIdentityHash(), Object* identity_hash = key->GetIdentityHash();
CcTest::heap()->undefined_value()); CHECK_EQ(identity_hash, CcTest::heap()->undefined_value());
} }
} }

View File

@ -118,7 +118,8 @@ TEST(Map) {
CHECK(ordered_map->Lookup(obj)->IsTheHole()); CHECK(ordered_map->Lookup(obj)->IsTheHole());
ordered_map = OrderedHashMap::Put(ordered_map, obj, val); ordered_map = OrderedHashMap::Put(ordered_map, obj, val);
CHECK_EQ(1, ordered_map->NumberOfElements()); CHECK_EQ(1, ordered_map->NumberOfElements());
CHECK(ordered_map->Lookup(obj)->SameValue(*val)); Object* lookup = ordered_map->Lookup(obj);
CHECK(lookup->SameValue(*val));
bool was_present = false; bool was_present = false;
ordered_map = OrderedHashMap::Remove(ordered_map, obj, &was_present); ordered_map = OrderedHashMap::Remove(ordered_map, obj, &was_present);
CHECK(was_present); CHECK(was_present);
@ -136,20 +137,28 @@ TEST(Map) {
ordered_map = OrderedHashMap::Put(ordered_map, obj2, val2); ordered_map = OrderedHashMap::Put(ordered_map, obj2, val2);
ordered_map = OrderedHashMap::Put(ordered_map, obj3, val3); ordered_map = OrderedHashMap::Put(ordered_map, obj3, val3);
CHECK_EQ(3, ordered_map->NumberOfElements()); CHECK_EQ(3, ordered_map->NumberOfElements());
CHECK(ordered_map->Lookup(obj1)->SameValue(*val1)); lookup = ordered_map->Lookup(obj1);
CHECK(ordered_map->Lookup(obj2)->SameValue(*val2)); CHECK(lookup->SameValue(*val1));
CHECK(ordered_map->Lookup(obj3)->SameValue(*val3)); lookup = ordered_map->Lookup(obj2);
CHECK(lookup->SameValue(*val2));
lookup = ordered_map->Lookup(obj3);
CHECK(lookup->SameValue(*val3));
// Test growth // Test growth
ordered_map = OrderedHashMap::Put(ordered_map, obj, val); ordered_map = OrderedHashMap::Put(ordered_map, obj, val);
Handle<JSObject> obj4 = factory->NewJSObjectFromMap(map); Handle<JSObject> obj4 = factory->NewJSObjectFromMap(map);
Handle<JSObject> val4 = factory->NewJSObjectFromMap(map); Handle<JSObject> val4 = factory->NewJSObjectFromMap(map);
ordered_map = OrderedHashMap::Put(ordered_map, obj4, val4); ordered_map = OrderedHashMap::Put(ordered_map, obj4, val4);
CHECK(ordered_map->Lookup(obj)->SameValue(*val)); lookup = ordered_map->Lookup(obj);
CHECK(ordered_map->Lookup(obj1)->SameValue(*val1)); CHECK(lookup->SameValue(*val));
CHECK(ordered_map->Lookup(obj2)->SameValue(*val2)); lookup = ordered_map->Lookup(obj1);
CHECK(ordered_map->Lookup(obj3)->SameValue(*val3)); CHECK(lookup->SameValue(*val1));
CHECK(ordered_map->Lookup(obj4)->SameValue(*val4)); lookup = ordered_map->Lookup(obj2);
CHECK(lookup->SameValue(*val2));
lookup = ordered_map->Lookup(obj3);
CHECK(lookup->SameValue(*val3));
lookup = ordered_map->Lookup(obj4);
CHECK(lookup->SameValue(*val4));
CHECK_EQ(5, ordered_map->NumberOfElements()); CHECK_EQ(5, ordered_map->NumberOfElements());
CHECK_EQ(4, ordered_map->NumberOfBuckets()); CHECK_EQ(4, ordered_map->NumberOfBuckets());