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

Unified Diff: src/objects-inl.h

Issue 637253004: Use smi zero instead of undefine_value to zap dead weak cells. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address comments Created 6 years, 2 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.cc ('k') | test/cctest/test-heap.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 a5b46a454a15b948d9cc649a125243d6cf1604aa..26adbc12886480112a3173afe4864e4ec705af27 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -1930,13 +1930,14 @@ void PropertyCell::set_type_raw(Object* val, WriteBarrierMode ignored) {
}
-HeapObject* WeakCell::value() const {
+Object* WeakCell::value() const {
return HeapObject::cast(READ_FIELD(this, kValueOffset));
}
-void WeakCell::clear(HeapObject* undefined) {
- WRITE_FIELD(this, kValueOffset, undefined);
+void WeakCell::clear() {
+ DCHECK(GetHeap()->gc_state() == Heap::MARK_COMPACT);
+ WRITE_FIELD(this, kValueOffset, Smi::FromInt(0));
}
@@ -1946,6 +1947,9 @@ void WeakCell::initialize(HeapObject* val) {
}
+bool WeakCell::cleared() const { return value() == Smi::FromInt(0); }
+
+
Object* WeakCell::next() const { return READ_FIELD(this, kNextOffset); }
« no previous file with comments | « src/objects.cc ('k') | test/cctest/test-heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698