Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Unified Diff: test/cctest/test-dictionary.cc

Issue 256743008: OrderedHashMap::Lookup() and ObjectHashTable::Lookup() handlified. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebasing Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/runtime.cc ('k') | test/cctest/test-ordered-hash-table.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-dictionary.cc
diff --git a/test/cctest/test-dictionary.cc b/test/cctest/test-dictionary.cc
index a40f282960c979e4b298d0106f7a36cb95ed78e3..0f7777239650bcf9d90c94715e682c2c43c6bb8a 100644
--- a/test/cctest/test-dictionary.cc
+++ b/test/cctest/test-dictionary.cc
@@ -50,24 +50,24 @@ static void TestHashMap(Handle<HashMap> table) {
Handle<JSObject> b = factory->NewJSArray(11);
table = HashMap::Put(table, a, b);
CHECK_EQ(table->NumberOfElements(), 1);
- CHECK_EQ(table->Lookup(*a), *b);
- CHECK_EQ(table->Lookup(*b), CcTest::heap()->the_hole_value());
+ CHECK_EQ(table->Lookup(a), *b);
+ CHECK_EQ(table->Lookup(b), CcTest::heap()->the_hole_value());
// Keys still have to be valid after objects were moved.
CcTest::heap()->CollectGarbage(NEW_SPACE);
CHECK_EQ(table->NumberOfElements(), 1);
- CHECK_EQ(table->Lookup(*a), *b);
- CHECK_EQ(table->Lookup(*b), CcTest::heap()->the_hole_value());
+ CHECK_EQ(table->Lookup(a), *b);
+ CHECK_EQ(table->Lookup(b), CcTest::heap()->the_hole_value());
// Keys that are overwritten should not change number of elements.
table = HashMap::Put(table, a, factory->NewJSArray(13));
CHECK_EQ(table->NumberOfElements(), 1);
- CHECK_NE(table->Lookup(*a), *b);
+ CHECK_NE(table->Lookup(a), *b);
// Keys mapped to the hole should be removed permanently.
table = HashMap::Put(table, a, factory->the_hole_value());
CHECK_EQ(table->NumberOfElements(), 0);
- CHECK_EQ(table->Lookup(*a), CcTest::heap()->the_hole_value());
+ CHECK_EQ(table->Lookup(a), CcTest::heap()->the_hole_value());
// Keys should map back to their respective values and also should get
// an identity hash code generated.
@@ -77,7 +77,7 @@ static void TestHashMap(Handle<HashMap> table) {
table = HashMap::Put(table, key, value);
CHECK_EQ(table->NumberOfElements(), i + 1);
CHECK_NE(table->FindEntry(*key), HashMap::kNotFound);
- CHECK_EQ(table->Lookup(*key), *value);
+ CHECK_EQ(table->Lookup(key), *value);
CHECK(key->GetIdentityHash()->IsSmi());
}
@@ -87,7 +87,7 @@ static void TestHashMap(Handle<HashMap> table) {
Handle<JSReceiver> key = factory->NewJSArray(7);
CHECK(JSReceiver::GetOrCreateIdentityHash(key)->IsSmi());
CHECK_EQ(table->FindEntry(*key), HashMap::kNotFound);
- CHECK_EQ(table->Lookup(*key), CcTest::heap()->the_hole_value());
+ CHECK_EQ(table->Lookup(key), CcTest::heap()->the_hole_value());
CHECK(key->GetIdentityHash()->IsSmi());
}
@@ -95,7 +95,7 @@ static void TestHashMap(Handle<HashMap> table) {
// should not get an identity hash code generated.
for (int i = 0; i < 100; i++) {
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(),
CcTest::heap()->undefined_value());
}
@@ -119,7 +119,8 @@ class ObjectHashTableTest: public ObjectHashTable {
}
int lookup(int key) {
- return Smi::cast(Lookup(Smi::FromInt(key)))->value();
+ Handle<Object> key_obj(Smi::FromInt(key), GetIsolate());
+ return Smi::cast(Lookup(key_obj))->value();
}
int capacity() {
@@ -225,7 +226,7 @@ static void TestHashMapCausesGC(Handle<HashMap> table) {
SimulateFullSpace(CcTest::heap()->old_pointer_space());
// Calling Lookup() should not cause GC ever.
- CHECK(table->Lookup(*key)->IsTheHole());
+ CHECK(table->Lookup(key)->IsTheHole());
// Calling Put() should request GC by returning a failure.
int gc_count = isolate->heap()->gc_count();
« no previous file with comments | « src/runtime.cc ('k') | test/cctest/test-ordered-hash-table.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698