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

Unified Diff: src/objects.cc

Issue 257853003: ObjectHashTable's key and WeakHashTable's key types are now Handle<Object> instead of Object*. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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/objects.h ('k') | src/objects-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index 8b1c3fee434cccf48cba3852dadcb2788bc4c898..e4d25f9441a08b29bac4292db72aa403d1289846 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -14859,9 +14859,11 @@ template class HashTable<CompilationCacheTable,
template class HashTable<MapCache, MapCacheShape, HashTableKey*>;
-template class HashTable<ObjectHashTable, ObjectHashTableShape, Object*>;
+template class HashTable<ObjectHashTable,
+ ObjectHashTableShape,
+ Handle<Object> >;
-template class HashTable<WeakHashTable, WeakHashTableShape<2>, Object*>;
+template class HashTable<WeakHashTable, WeakHashTableShape<2>, Handle<Object> >;
template class Dictionary<NameDictionary, NameDictionaryShape, Handle<Name> >;
@@ -16141,6 +16143,21 @@ Object* ObjectHashTable::Lookup(Object* key) {
}
+// TODO(ishell): Try to remove this when FindEntry(Object* key) is removed
+int ObjectHashTable::FindEntry(Handle<Object> key) {
+ return DerivedHashTable::FindEntry(key);
+}
+
+
+// TODO(ishell): Remove this when all the callers are handlified.
+int ObjectHashTable::FindEntry(Object* key) {
+ DisallowHeapAllocation no_allocation;
+ Isolate* isolate = GetIsolate();
+ HandleScope scope(isolate);
+ return FindEntry(handle(key, isolate));
+}
+
+
Handle<ObjectHashTable> ObjectHashTable::Put(Handle<ObjectHashTable> table,
Handle<Object> key,
Handle<Object> value) {
@@ -16151,7 +16168,7 @@ Handle<ObjectHashTable> ObjectHashTable::Put(Handle<ObjectHashTable> table,
// Make sure the key object has an identity hash code.
Handle<Object> hash = Object::GetOrCreateHash(key, isolate);
- int entry = table->FindEntry(*key);
+ int entry = table->FindEntry(key);
// Check whether to perform removal operation.
if (value->IsTheHole()) {
@@ -16167,7 +16184,7 @@ Handle<ObjectHashTable> ObjectHashTable::Put(Handle<ObjectHashTable> table,
}
// Check whether the hash table should be extended.
- table = EnsureCapacity(table, 1, *key);
+ table = EnsureCapacity(table, 1, key);
table->AddEntry(table->FindInsertionEntry(Handle<Smi>::cast(hash)->value()),
*key,
*value);
@@ -16197,11 +16214,26 @@ Object* WeakHashTable::Lookup(Object* key) {
}
+// TODO(ishell): Try to remove this when FindEntry(Object* key) is removed
+int WeakHashTable::FindEntry(Handle<Object> key) {
+ return DerivedHashTable::FindEntry(key);
+}
+
+
+// TODO(ishell): Remove this when all the callers are handlified.
+int WeakHashTable::FindEntry(Object* key) {
+ DisallowHeapAllocation no_allocation;
+ Isolate* isolate = GetIsolate();
+ HandleScope scope(isolate);
+ return FindEntry(handle(key, isolate));
+}
+
+
Handle<WeakHashTable> WeakHashTable::Put(Handle<WeakHashTable> table,
Handle<Object> key,
Handle<Object> value) {
ASSERT(table->IsKey(*key));
- int entry = table->FindEntry(*key);
+ int entry = table->FindEntry(key);
// Key is already in table, just overwrite value.
if (entry != kNotFound) {
table->set(EntryToValueIndex(entry), *value);
@@ -16209,9 +16241,9 @@ Handle<WeakHashTable> WeakHashTable::Put(Handle<WeakHashTable> table,
}
// Check whether the hash table should be extended.
- table = EnsureCapacity(table, 1, *key, TENURED);
+ table = EnsureCapacity(table, 1, key, TENURED);
- table->AddEntry(table->FindInsertionEntry(table->Hash(*key)), key, value);
+ table->AddEntry(table->FindInsertionEntry(table->Hash(key)), key, value);
return table;
}
« no previous file with comments | « src/objects.h ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698