WeakHashTable::Lookup() handlified and ObjectHashTable's interface cleaned up.
authorishell@chromium.org <ishell@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Tue, 29 Apr 2014 14:31:12 +0000 (14:31 +0000)
committerishell@chromium.org <ishell@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Tue, 29 Apr 2014 14:31:12 +0000 (14:31 +0000)
R=yangguo@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@21060 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/heap.cc
src/heap.h
src/lithium-codegen.cc
src/objects-debug.cc
src/objects.cc
src/objects.h

index af1759b..381ae50 100644 (file)
@@ -5505,11 +5505,11 @@ void Heap::AddWeakObjectToCodeDependency(Handle<Object> obj,
     WeakHashTable::cast(weak_object_to_code_table_)->Zap(the_hole_value());
   }
   set_weak_object_to_code_table(*table);
-  ASSERT_EQ(*dep, table->Lookup(*obj));
+  ASSERT_EQ(*dep, table->Lookup(obj));
 }
 
 
-DependentCode* Heap::LookupWeakObjectToCodeDependency(Object* obj) {
+DependentCode* Heap::LookupWeakObjectToCodeDependency(Handle<Object> obj) {
   Object* dep = WeakHashTable::cast(weak_object_to_code_table_)->Lookup(obj);
   if (dep->IsDependentCode()) return DependentCode::cast(dep);
   return DependentCode::cast(empty_fixed_array());
index 8fb16c5..996fb45 100644 (file)
@@ -1485,7 +1485,7 @@ class Heap {
   void AddWeakObjectToCodeDependency(Handle<Object> obj,
                                      Handle<DependentCode> dep);
 
-  DependentCode* LookupWeakObjectToCodeDependency(Object* obj);
+  DependentCode* LookupWeakObjectToCodeDependency(Handle<Object> obj);
 
   void InitializeWeakObjectToCodeTable() {
     set_weak_object_to_code_table(undefined_value());
index 9186605..b560218 100644 (file)
@@ -155,7 +155,7 @@ static void AddWeakObjectToCodeDependency(Isolate* isolate,
                                           Handle<Code> code) {
   Heap* heap = isolate->heap();
   heap->EnsureWeakObjectToCodeTable();
-  Handle<DependentCode> dep(heap->LookupWeakObjectToCodeDependency(*object));
+  Handle<DependentCode> dep(heap->LookupWeakObjectToCodeDependency(object));
   dep = DependentCode::Insert(dep, DependentCode::kWeakCodeGroup, code);
   heap->AddWeakObjectToCodeDependency(object, dep);
 }
index 02f754a..a7725ab 100644 (file)
@@ -655,6 +655,9 @@ void Code::CodeVerify() {
 
 void Code::VerifyEmbeddedObjectsDependency() {
   if (!CanContainWeakObjects()) return;
+  DisallowHeapAllocation no_gc;
+  Isolate* isolate = GetIsolate();
+  HandleScope scope(isolate);
   int mode_mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT);
   for (RelocIterator it(this, mode_mask); !it.done(); it.next()) {
     Object* obj = it.rinfo()->target_object();
@@ -667,7 +670,8 @@ void Code::VerifyEmbeddedObjectsDependency() {
       } else if (obj->IsJSObject()) {
         Object* raw_table = GetIsolate()->heap()->weak_object_to_code_table();
         WeakHashTable* table = WeakHashTable::cast(raw_table);
-        CHECK(DependentCode::cast(table->Lookup(obj))->Contains(
+        Handle<Object> key_obj(obj, isolate);
+        CHECK(DependentCode::cast(table->Lookup(key_obj))->Contains(
             DependentCode::kWeakCodeGroup, this));
       }
     }
index 4d78909..7f2b8df 100644 (file)
@@ -16051,21 +16051,6 @@ Object* ObjectHashTable::Lookup(Handle<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) {
@@ -16114,29 +16099,15 @@ void ObjectHashTable::RemoveEntry(int entry) {
 }
 
 
-Object* WeakHashTable::Lookup(Object* key) {
-  ASSERT(IsKey(key));
+Object* WeakHashTable::Lookup(Handle<Object> key) {
+  DisallowHeapAllocation no_gc;
+  ASSERT(IsKey(*key));
   int entry = FindEntry(key);
   if (entry == kNotFound) return GetHeap()->the_hole_value();
   return get(EntryToValueIndex(entry));
 }
 
 
-// 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) {
index 25f9afc..6402f86 100644 (file)
@@ -4202,10 +4202,6 @@ class ObjectHashTable: public HashTable<ObjectHashTable,
   // returned in case the key is not present.
   Object* Lookup(Handle<Object> key);
 
-  int FindEntry(Handle<Object> key);
-  // TODO(ishell): Remove this when all the callers are handlified.
-  int FindEntry(Object* key);
-
   // Adds (or overwrites) the value associated with the given key. Mapping a
   // key to the hole value causes removal of the whole entry.
   static Handle<ObjectHashTable> Put(Handle<ObjectHashTable> table,
@@ -4431,11 +4427,7 @@ class WeakHashTable: public HashTable<WeakHashTable,
 
   // Looks up the value associated with the given key. The hole value is
   // returned in case the key is not present.
-  Object* Lookup(Object* key);
-
-  int FindEntry(Handle<Object> key);
-  // TODO(ishell): Remove this when all the callers are handlified.
-  int FindEntry(Object* key);
+  Object* Lookup(Handle<Object> key);
 
   // Adds (or overwrites) the value associated with the given key. Mapping a
   // key to the hole value causes removal of the whole entry.