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

Unified Diff: src/objects-inl.h

Issue 1018283002: Reland "Fix memory leak caused by field type in descriptor array." (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix type of cleared weak cell to be None Created 5 years, 9 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
« src/objects.cc ('K') | « src/objects-debug.cc ('k') | src/property.h » ('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 11294011a0557ee339603308c9adb65891e41b44..83b7da43889a4ba5aeca7e8d94297c7faf383369 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -3147,7 +3147,12 @@ int DescriptorArray::GetFieldIndex(int descriptor_number) {
HeapType* DescriptorArray::GetFieldType(int descriptor_number) {
DCHECK(GetDetails(descriptor_number).location() == kField);
- return HeapType::cast(GetValue(descriptor_number));
+ Object* value = GetValue(descriptor_number);
+ if (value->IsWeakCell()) {
+ if (WeakCell::cast(value)->cleared()) return HeapType::None();
+ value = WeakCell::cast(value)->value();
+ }
+ return HeapType::cast(value);
}
« src/objects.cc ('K') | « src/objects-debug.cc ('k') | src/property.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698