| 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 3019 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3030 } | 3030 } |
| 3031 | 3031 |
| 3032 | 3032 |
| 3033 void DescriptorArray::Get(int descriptor_number, Descriptor* desc) { | 3033 void DescriptorArray::Get(int descriptor_number, Descriptor* desc) { |
| 3034 desc->Init(handle(GetKey(descriptor_number), GetIsolate()), | 3034 desc->Init(handle(GetKey(descriptor_number), GetIsolate()), |
| 3035 handle(GetValue(descriptor_number), GetIsolate()), | 3035 handle(GetValue(descriptor_number), GetIsolate()), |
| 3036 GetDetails(descriptor_number)); | 3036 GetDetails(descriptor_number)); |
| 3037 } | 3037 } |
| 3038 | 3038 |
| 3039 | 3039 |
| 3040 void DescriptorArray::Set(int descriptor_number, | 3040 void DescriptorArray::SetDescriptor(int descriptor_number, Descriptor* desc) { |
| 3041 Descriptor* desc, | |
| 3042 const WhitenessWitness&) { | |
| 3043 // Range check. | 3041 // Range check. |
| 3044 DCHECK(descriptor_number < number_of_descriptors()); | 3042 DCHECK(descriptor_number < number_of_descriptors()); |
| 3045 | 3043 set(ToKeyIndex(descriptor_number), *desc->GetKey()); |
| 3046 NoIncrementalWriteBarrierSet(this, | 3044 set(ToValueIndex(descriptor_number), *desc->GetValue()); |
| 3047 ToKeyIndex(descriptor_number), | 3045 set(ToDetailsIndex(descriptor_number), desc->GetDetails().AsSmi()); |
| 3048 *desc->GetKey()); | |
| 3049 NoIncrementalWriteBarrierSet(this, | |
| 3050 ToValueIndex(descriptor_number), | |
| 3051 *desc->GetValue()); | |
| 3052 NoIncrementalWriteBarrierSet(this, ToDetailsIndex(descriptor_number), | |
| 3053 desc->GetDetails().AsSmi()); | |
| 3054 } | 3046 } |
| 3055 | 3047 |
| 3056 | 3048 |
| 3057 void DescriptorArray::Set(int descriptor_number, Descriptor* desc) { | 3049 void DescriptorArray::Set(int descriptor_number, Descriptor* desc) { |
| 3058 // Range check. | 3050 // Range check. |
| 3059 DCHECK(descriptor_number < number_of_descriptors()); | 3051 DCHECK(descriptor_number < number_of_descriptors()); |
| 3060 | 3052 |
| 3061 set(ToKeyIndex(descriptor_number), *desc->GetKey()); | 3053 set(ToKeyIndex(descriptor_number), *desc->GetKey()); |
| 3062 set(ToValueIndex(descriptor_number), *desc->GetValue()); | 3054 set(ToValueIndex(descriptor_number), *desc->GetValue()); |
| 3063 set(ToDetailsIndex(descriptor_number), desc->GetDetails().AsSmi()); | 3055 set(ToDetailsIndex(descriptor_number), desc->GetDetails().AsSmi()); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 3084 } | 3076 } |
| 3085 | 3077 |
| 3086 | 3078 |
| 3087 void DescriptorArray::SwapSortedKeys(int first, int second) { | 3079 void DescriptorArray::SwapSortedKeys(int first, int second) { |
| 3088 int first_key = GetSortedKeyIndex(first); | 3080 int first_key = GetSortedKeyIndex(first); |
| 3089 SetSortedKey(first, GetSortedKeyIndex(second)); | 3081 SetSortedKey(first, GetSortedKeyIndex(second)); |
| 3090 SetSortedKey(second, first_key); | 3082 SetSortedKey(second, first_key); |
| 3091 } | 3083 } |
| 3092 | 3084 |
| 3093 | 3085 |
| 3094 DescriptorArray::WhitenessWitness::WhitenessWitness(DescriptorArray* array) | |
| 3095 : marking_(array->GetHeap()->incremental_marking()) { | |
| 3096 marking_->EnterNoMarkingScope(); | |
| 3097 DCHECK(!marking_->IsMarking() || | |
| 3098 Marking::Color(array) == Marking::WHITE_OBJECT); | |
| 3099 } | |
| 3100 | |
| 3101 | |
| 3102 DescriptorArray::WhitenessWitness::~WhitenessWitness() { | |
| 3103 marking_->LeaveNoMarkingScope(); | |
| 3104 } | |
| 3105 | |
| 3106 | |
| 3107 PropertyType DescriptorArray::Entry::type() { return descs_->GetType(index_); } | 3086 PropertyType DescriptorArray::Entry::type() { return descs_->GetType(index_); } |
| 3108 | 3087 |
| 3109 | 3088 |
| 3110 Object* DescriptorArray::Entry::GetCallbackObject() { | 3089 Object* DescriptorArray::Entry::GetCallbackObject() { |
| 3111 return descs_->GetValue(index_); | 3090 return descs_->GetValue(index_); |
| 3112 } | 3091 } |
| 3113 | 3092 |
| 3114 | 3093 |
| 3115 int HashTableBase::NumberOfElements() { | 3094 int HashTableBase::NumberOfElements() { |
| 3116 return Smi::cast(get(kNumberOfElementsIndex))->value(); | 3095 return Smi::cast(get(kNumberOfElementsIndex))->value(); |
| (...skipping 4774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7891 #undef WRITE_INT64_FIELD | 7870 #undef WRITE_INT64_FIELD |
| 7892 #undef READ_BYTE_FIELD | 7871 #undef READ_BYTE_FIELD |
| 7893 #undef WRITE_BYTE_FIELD | 7872 #undef WRITE_BYTE_FIELD |
| 7894 #undef NOBARRIER_READ_BYTE_FIELD | 7873 #undef NOBARRIER_READ_BYTE_FIELD |
| 7895 #undef NOBARRIER_WRITE_BYTE_FIELD | 7874 #undef NOBARRIER_WRITE_BYTE_FIELD |
| 7896 | 7875 |
| 7897 } // namespace internal | 7876 } // namespace internal |
| 7898 } // namespace v8 | 7877 } // namespace v8 |
| 7899 | 7878 |
| 7900 #endif // V8_OBJECTS_INL_H_ | 7879 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |