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

Unified Diff: src/objects-inl.h

Issue 871253005: Use weak cells in dependent code. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Address comments Created 5 years, 10 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-debug.cc ('k') | src/serialize.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects-inl.h
diff --git a/src/objects-inl.h b/src/objects-inl.h
index c275ade935cec7af80f1a67a318ac6a7747c9efc..748406a41313364193bd1cec63a8a67318d6b4ff 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -4766,21 +4766,6 @@ void DependentCode::set_number_of_entries(DependencyGroup group, int value) {
}
-bool DependentCode::is_code_at(int i) {
- return get(kCodesStartIndex + i)->IsCode();
-}
-
-Code* DependentCode::code_at(int i) {
- return Code::cast(get(kCodesStartIndex + i));
-}
-
-
-CompilationInfo* DependentCode::compilation_info_at(int i) {
- return reinterpret_cast<CompilationInfo*>(
- Foreign::cast(get(kCodesStartIndex + i))->foreign_address());
-}
-
-
void DependentCode::set_object_at(int i, Object* object) {
set(kCodesStartIndex + i, object);
}
@@ -4791,11 +4776,6 @@ Object* DependentCode::object_at(int i) {
}
-Object** DependentCode::slot_at(int i) {
- return RawFieldOfElementAt(kCodesStartIndex + i);
-}
-
-
void DependentCode::clear_at(int i) {
set_undefined(kCodesStartIndex + i);
}
@@ -7228,13 +7208,18 @@ Handle<ObjectHashTable> ObjectHashTable::Shrink(
template <int entrysize>
bool WeakHashTableShape<entrysize>::IsMatch(Handle<Object> key, Object* other) {
- return key->SameValue(other);
+ if (other->IsWeakCell()) other = WeakCell::cast(other)->value();
+ return key->IsWeakCell() ? WeakCell::cast(*key)->value() == other
+ : *key == other;
}
template <int entrysize>
uint32_t WeakHashTableShape<entrysize>::Hash(Handle<Object> key) {
- intptr_t hash = reinterpret_cast<intptr_t>(*key);
+ intptr_t hash =
+ key->IsWeakCell()
+ ? reinterpret_cast<intptr_t>(WeakCell::cast(*key)->value())
+ : reinterpret_cast<intptr_t>(*key);
return (uint32_t)(hash & 0xFFFFFFFF);
}
@@ -7242,6 +7227,7 @@ uint32_t WeakHashTableShape<entrysize>::Hash(Handle<Object> key) {
template <int entrysize>
uint32_t WeakHashTableShape<entrysize>::HashForObject(Handle<Object> key,
Object* other) {
+ if (other->IsWeakCell()) other = WeakCell::cast(other)->value();
intptr_t hash = reinterpret_cast<intptr_t>(other);
return (uint32_t)(hash & 0xFFFFFFFF);
}
« no previous file with comments | « src/objects-debug.cc ('k') | src/serialize.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698