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

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: Rebase 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 3130 matching lines...) Expand 10 before | Expand all | Expand 10 after
3141 3141
3142 3142
3143 int DescriptorArray::GetFieldIndex(int descriptor_number) { 3143 int DescriptorArray::GetFieldIndex(int descriptor_number) {
3144 DCHECK(GetDetails(descriptor_number).location() == kField); 3144 DCHECK(GetDetails(descriptor_number).location() == kField);
3145 return GetDetails(descriptor_number).field_index(); 3145 return GetDetails(descriptor_number).field_index();
3146 } 3146 }
3147 3147
3148 3148
3149 HeapType* DescriptorArray::GetFieldType(int descriptor_number) { 3149 HeapType* DescriptorArray::GetFieldType(int descriptor_number) {
3150 DCHECK(GetDetails(descriptor_number).location() == kField); 3150 DCHECK(GetDetails(descriptor_number).location() == kField);
3151 return HeapType::cast(GetValue(descriptor_number)); 3151 Object* value = GetValue(descriptor_number);
3152 if (value->IsWeakCell()) {
3153 if (WeakCell::cast(value)->cleared()) return HeapType::None();
3154 value = WeakCell::cast(value)->value();
3155 }
3156 return HeapType::cast(value);
3152 } 3157 }
3153 3158
3154 3159
3155 Object* DescriptorArray::GetConstant(int descriptor_number) { 3160 Object* DescriptorArray::GetConstant(int descriptor_number) {
3156 return GetValue(descriptor_number); 3161 return GetValue(descriptor_number);
3157 } 3162 }
3158 3163
3159 3164
3160 Object* DescriptorArray::GetCallbacksObject(int descriptor_number) { 3165 Object* DescriptorArray::GetCallbacksObject(int descriptor_number) {
3161 DCHECK(GetType(descriptor_number) == ACCESSOR_CONSTANT); 3166 DCHECK(GetType(descriptor_number) == ACCESSOR_CONSTANT);
(...skipping 4335 matching lines...) Expand 10 before | Expand all | Expand 10 after
7497 #undef READ_SHORT_FIELD 7502 #undef READ_SHORT_FIELD
7498 #undef WRITE_SHORT_FIELD 7503 #undef WRITE_SHORT_FIELD
7499 #undef READ_BYTE_FIELD 7504 #undef READ_BYTE_FIELD
7500 #undef WRITE_BYTE_FIELD 7505 #undef WRITE_BYTE_FIELD
7501 #undef NOBARRIER_READ_BYTE_FIELD 7506 #undef NOBARRIER_READ_BYTE_FIELD
7502 #undef NOBARRIER_WRITE_BYTE_FIELD 7507 #undef NOBARRIER_WRITE_BYTE_FIELD
7503 7508
7504 } } // namespace v8::internal 7509 } } // namespace v8::internal
7505 7510
7506 #endif // V8_OBJECTS_INL_H_ 7511 #endif // V8_OBJECTS_INL_H_
OLDNEW
« src/objects-debug.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