From: ishell@chromium.org Date: Tue, 29 Apr 2014 14:31:12 +0000 (+0000) Subject: WeakHashTable::Lookup() handlified and ObjectHashTable's interface cleaned up. X-Git-Tag: upstream/4.7.83~9347 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=303f2ab50fedd472b0506d0ddd96cdd77b2bb8ed;p=platform%2Fupstream%2Fv8.git WeakHashTable::Lookup() handlified and ObjectHashTable's interface cleaned up. 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 --- diff --git a/src/heap.cc b/src/heap.cc index af1759b..381ae50 100644 --- a/src/heap.cc +++ b/src/heap.cc @@ -5505,11 +5505,11 @@ void Heap::AddWeakObjectToCodeDependency(Handle 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 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()); diff --git a/src/heap.h b/src/heap.h index 8fb16c5..996fb45 100644 --- a/src/heap.h +++ b/src/heap.h @@ -1485,7 +1485,7 @@ class Heap { void AddWeakObjectToCodeDependency(Handle obj, Handle dep); - DependentCode* LookupWeakObjectToCodeDependency(Object* obj); + DependentCode* LookupWeakObjectToCodeDependency(Handle obj); void InitializeWeakObjectToCodeTable() { set_weak_object_to_code_table(undefined_value()); diff --git a/src/lithium-codegen.cc b/src/lithium-codegen.cc index 9186605..b560218 100644 --- a/src/lithium-codegen.cc +++ b/src/lithium-codegen.cc @@ -155,7 +155,7 @@ static void AddWeakObjectToCodeDependency(Isolate* isolate, Handle code) { Heap* heap = isolate->heap(); heap->EnsureWeakObjectToCodeTable(); - Handle dep(heap->LookupWeakObjectToCodeDependency(*object)); + Handle dep(heap->LookupWeakObjectToCodeDependency(object)); dep = DependentCode::Insert(dep, DependentCode::kWeakCodeGroup, code); heap->AddWeakObjectToCodeDependency(object, dep); } diff --git a/src/objects-debug.cc b/src/objects-debug.cc index 02f754a..a7725ab 100644 --- a/src/objects-debug.cc +++ b/src/objects-debug.cc @@ -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 key_obj(obj, isolate); + CHECK(DependentCode::cast(table->Lookup(key_obj))->Contains( DependentCode::kWeakCodeGroup, this)); } } diff --git a/src/objects.cc b/src/objects.cc index 4d78909..7f2b8df 100644 --- a/src/objects.cc +++ b/src/objects.cc @@ -16051,21 +16051,6 @@ Object* ObjectHashTable::Lookup(Handle key) { } -// TODO(ishell): Try to remove this when FindEntry(Object* key) is removed -int ObjectHashTable::FindEntry(Handle 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::Put(Handle table, Handle key, Handle value) { @@ -16114,29 +16099,15 @@ void ObjectHashTable::RemoveEntry(int entry) { } -Object* WeakHashTable::Lookup(Object* key) { - ASSERT(IsKey(key)); +Object* WeakHashTable::Lookup(Handle 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 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::Put(Handle table, Handle key, Handle value) { diff --git a/src/objects.h b/src/objects.h index 25f9afc..6402f86 100644 --- a/src/objects.h +++ b/src/objects.h @@ -4202,10 +4202,6 @@ class ObjectHashTable: public HashTable key); - int FindEntry(Handle 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 Put(Handle table, @@ -4431,11 +4427,7 @@ class WeakHashTable: public HashTable key); - // TODO(ishell): Remove this when all the callers are handlified. - int FindEntry(Object* key); + Object* Lookup(Handle key); // Adds (or overwrites) the value associated with the given key. Mapping a // key to the hole value causes removal of the whole entry.