| OLD | NEW |
| 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 3034 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3045 void DescriptorArray::Set(int descriptor_number, Descriptor* desc) { | 3045 void DescriptorArray::Set(int descriptor_number, Descriptor* desc) { |
| 3046 // Range check. | 3046 // Range check. |
| 3047 DCHECK(descriptor_number < number_of_descriptors()); | 3047 DCHECK(descriptor_number < number_of_descriptors()); |
| 3048 | 3048 |
| 3049 set(ToKeyIndex(descriptor_number), *desc->GetKey()); | 3049 set(ToKeyIndex(descriptor_number), *desc->GetKey()); |
| 3050 set(ToValueIndex(descriptor_number), *desc->GetValue()); | 3050 set(ToValueIndex(descriptor_number), *desc->GetValue()); |
| 3051 set(ToDetailsIndex(descriptor_number), desc->GetDetails().AsSmi()); | 3051 set(ToDetailsIndex(descriptor_number), desc->GetDetails().AsSmi()); |
| 3052 } | 3052 } |
| 3053 | 3053 |
| 3054 | 3054 |
| 3055 void DescriptorArray::Append(Descriptor* desc, | |
| 3056 const WhitenessWitness& witness) { | |
| 3057 DisallowHeapAllocation no_gc; | |
| 3058 int descriptor_number = number_of_descriptors(); | |
| 3059 SetNumberOfDescriptors(descriptor_number + 1); | |
| 3060 Set(descriptor_number, desc, witness); | |
| 3061 | |
| 3062 uint32_t hash = desc->GetKey()->Hash(); | |
| 3063 | |
| 3064 int insertion; | |
| 3065 | |
| 3066 for (insertion = descriptor_number; insertion > 0; --insertion) { | |
| 3067 Name* key = GetSortedKey(insertion - 1); | |
| 3068 if (key->Hash() <= hash) break; | |
| 3069 SetSortedKey(insertion, GetSortedKeyIndex(insertion - 1)); | |
| 3070 } | |
| 3071 | |
| 3072 SetSortedKey(insertion, descriptor_number); | |
| 3073 } | |
| 3074 | |
| 3075 | |
| 3076 void DescriptorArray::Append(Descriptor* desc) { | 3055 void DescriptorArray::Append(Descriptor* desc) { |
| 3077 DisallowHeapAllocation no_gc; | 3056 DisallowHeapAllocation no_gc; |
| 3078 int descriptor_number = number_of_descriptors(); | 3057 int descriptor_number = number_of_descriptors(); |
| 3079 SetNumberOfDescriptors(descriptor_number + 1); | 3058 SetNumberOfDescriptors(descriptor_number + 1); |
| 3080 Set(descriptor_number, desc); | 3059 Set(descriptor_number, desc); |
| 3081 | 3060 |
| 3082 uint32_t hash = desc->GetKey()->Hash(); | 3061 uint32_t hash = desc->GetKey()->Hash(); |
| 3083 | 3062 |
| 3084 int insertion; | 3063 int insertion; |
| 3085 | 3064 |
| (...skipping 4183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7269 #undef READ_SHORT_FIELD | 7248 #undef READ_SHORT_FIELD |
| 7270 #undef WRITE_SHORT_FIELD | 7249 #undef WRITE_SHORT_FIELD |
| 7271 #undef READ_BYTE_FIELD | 7250 #undef READ_BYTE_FIELD |
| 7272 #undef WRITE_BYTE_FIELD | 7251 #undef WRITE_BYTE_FIELD |
| 7273 #undef NOBARRIER_READ_BYTE_FIELD | 7252 #undef NOBARRIER_READ_BYTE_FIELD |
| 7274 #undef NOBARRIER_WRITE_BYTE_FIELD | 7253 #undef NOBARRIER_WRITE_BYTE_FIELD |
| 7275 | 7254 |
| 7276 } } // namespace v8::internal | 7255 } } // namespace v8::internal |
| 7277 | 7256 |
| 7278 #endif // V8_OBJECTS_INL_H_ | 7257 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |