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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 // 4 //
5 // Review notes: 5 // Review notes:
6 // 6 //
7 // - The use of macros in these inline functions may seem superfluous 7 // - The use of macros in these inline functions may seem superfluous
8 // but it is absolutely needed to make sure gcc generates optimal 8 // but it is absolutely needed to make sure gcc generates optimal
9 // code. gcc is not happy when attempting to inline too deep. 9 // code. gcc is not happy when attempting to inline too deep.
10 // 10 //
(...skipping 3129 matching lines...) Expand 10 before | Expand all | Expand 10 after
3140 3140
3141 3141
3142 int DescriptorArray::GetFieldIndex(int descriptor_number) { 3142 int DescriptorArray::GetFieldIndex(int descriptor_number) {
3143 DCHECK(GetDetails(descriptor_number).location() == kField); 3143 DCHECK(GetDetails(descriptor_number).location() == kField);
3144 return GetDetails(descriptor_number).field_index(); 3144 return GetDetails(descriptor_number).field_index();
3145 } 3145 }
3146 3146
3147 3147
3148 HeapType* DescriptorArray::GetFieldType(int descriptor_number) { 3148 HeapType* DescriptorArray::GetFieldType(int descriptor_number) {
3149 DCHECK(GetDetails(descriptor_number).location() == kField); 3149 DCHECK(GetDetails(descriptor_number).location() == kField);
3150 return HeapType::cast(GetValue(descriptor_number)); 3150 Object* value = GetValue(descriptor_number);
3151 if (value->IsWeakCell()) {
3152 if (WeakCell::cast(value)->cleared()) return HeapType::None();
3153 value = WeakCell::cast(value)->value();
3154 }
3155 return HeapType::cast(value);
3151 } 3156 }
3152 3157
3153 3158
3154 Object* DescriptorArray::GetConstant(int descriptor_number) { 3159 Object* DescriptorArray::GetConstant(int descriptor_number) {
3155 return GetValue(descriptor_number); 3160 return GetValue(descriptor_number);
3156 } 3161 }
3157 3162
3158 3163
3159 Object* DescriptorArray::GetCallbacksObject(int descriptor_number) { 3164 Object* DescriptorArray::GetCallbacksObject(int descriptor_number) {
3160 DCHECK(GetType(descriptor_number) == ACCESSOR_CONSTANT); 3165 DCHECK(GetType(descriptor_number) == ACCESSOR_CONSTANT);
(...skipping 4335 matching lines...) Expand 10 before | Expand all | Expand 10 after
7496 #undef READ_SHORT_FIELD 7501 #undef READ_SHORT_FIELD
7497 #undef WRITE_SHORT_FIELD 7502 #undef WRITE_SHORT_FIELD
7498 #undef READ_BYTE_FIELD 7503 #undef READ_BYTE_FIELD
7499 #undef WRITE_BYTE_FIELD 7504 #undef WRITE_BYTE_FIELD
7500 #undef NOBARRIER_READ_BYTE_FIELD 7505 #undef NOBARRIER_READ_BYTE_FIELD
7501 #undef NOBARRIER_WRITE_BYTE_FIELD 7506 #undef NOBARRIER_WRITE_BYTE_FIELD
7502 7507
7503 } } // namespace v8::internal 7508 } } // namespace v8::internal
7504 7509
7505 #endif // V8_OBJECTS_INL_H_ 7510 #endif // V8_OBJECTS_INL_H_
OLDNEW
« 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