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());
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());
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);
}
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();
} 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));
}
}
}
-// 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) {
}
-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) {
// 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,
// 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.