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 2319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2330 if (IsUnboxedDoubleField(index)) { | 2330 if (IsUnboxedDoubleField(index)) { |
2331 DCHECK(value->IsMutableHeapNumber()); | 2331 DCHECK(value->IsMutableHeapNumber()); |
2332 RawFastDoublePropertyAtPut(index, HeapNumber::cast(value)->value()); | 2332 RawFastDoublePropertyAtPut(index, HeapNumber::cast(value)->value()); |
2333 } else { | 2333 } else { |
2334 RawFastPropertyAtPut(index, value); | 2334 RawFastPropertyAtPut(index, value); |
2335 } | 2335 } |
2336 } | 2336 } |
2337 | 2337 |
2338 void JSObject::WriteToField(int descriptor, PropertyDetails details, | 2338 void JSObject::WriteToField(int descriptor, PropertyDetails details, |
2339 Object* value) { | 2339 Object* value) { |
2340 DCHECK(details.type() == DATA); | 2340 DCHECK_EQ(kField, details.location()); |
| 2341 DCHECK_EQ(kData, details.kind()); |
2341 DisallowHeapAllocation no_gc; | 2342 DisallowHeapAllocation no_gc; |
2342 FieldIndex index = FieldIndex::ForDescriptor(map(), descriptor); | 2343 FieldIndex index = FieldIndex::ForDescriptor(map(), descriptor); |
2343 if (details.representation().IsDouble()) { | 2344 if (details.representation().IsDouble()) { |
2344 // Nothing more to be done. | 2345 // Nothing more to be done. |
2345 if (value->IsUninitialized(this->GetIsolate())) { | 2346 if (value->IsUninitialized(this->GetIsolate())) { |
2346 return; | 2347 return; |
2347 } | 2348 } |
2348 if (IsUnboxedDoubleField(index)) { | 2349 if (IsUnboxedDoubleField(index)) { |
2349 RawFastDoublePropertyAtPut(index, value->Number()); | 2350 RawFastDoublePropertyAtPut(index, value->Number()); |
2350 } else { | 2351 } else { |
(...skipping 850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3201 } | 3202 } |
3202 | 3203 |
3203 | 3204 |
3204 void DescriptorArray::SwapSortedKeys(int first, int second) { | 3205 void DescriptorArray::SwapSortedKeys(int first, int second) { |
3205 int first_key = GetSortedKeyIndex(first); | 3206 int first_key = GetSortedKeyIndex(first); |
3206 SetSortedKey(first, GetSortedKeyIndex(second)); | 3207 SetSortedKey(first, GetSortedKeyIndex(second)); |
3207 SetSortedKey(second, first_key); | 3208 SetSortedKey(second, first_key); |
3208 } | 3209 } |
3209 | 3210 |
3210 | 3211 |
3211 PropertyType DescriptorArray::Entry::type() { return descs_->GetType(index_); } | |
3212 | |
3213 | |
3214 Object* DescriptorArray::Entry::GetCallbackObject() { | |
3215 return descs_->GetValue(index_); | |
3216 } | |
3217 | |
3218 | |
3219 int HashTableBase::NumberOfElements() { | 3212 int HashTableBase::NumberOfElements() { |
3220 return Smi::cast(get(kNumberOfElementsIndex))->value(); | 3213 return Smi::cast(get(kNumberOfElementsIndex))->value(); |
3221 } | 3214 } |
3222 | 3215 |
3223 | 3216 |
3224 int HashTableBase::NumberOfDeletedElements() { | 3217 int HashTableBase::NumberOfDeletedElements() { |
3225 return Smi::cast(get(kNumberOfDeletedElementsIndex))->value(); | 3218 return Smi::cast(get(kNumberOfDeletedElementsIndex))->value(); |
3226 } | 3219 } |
3227 | 3220 |
3228 | 3221 |
(...skipping 1685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4914 | 4907 |
4915 | 4908 |
4916 bool Map::CanBeDeprecated() { | 4909 bool Map::CanBeDeprecated() { |
4917 int descriptor = LastAdded(); | 4910 int descriptor = LastAdded(); |
4918 for (int i = 0; i <= descriptor; i++) { | 4911 for (int i = 0; i <= descriptor; i++) { |
4919 PropertyDetails details = instance_descriptors()->GetDetails(i); | 4912 PropertyDetails details = instance_descriptors()->GetDetails(i); |
4920 if (details.representation().IsNone()) return true; | 4913 if (details.representation().IsNone()) return true; |
4921 if (details.representation().IsSmi()) return true; | 4914 if (details.representation().IsSmi()) return true; |
4922 if (details.representation().IsDouble()) return true; | 4915 if (details.representation().IsDouble()) return true; |
4923 if (details.representation().IsHeapObject()) return true; | 4916 if (details.representation().IsHeapObject()) return true; |
4924 if (details.type() == DATA_CONSTANT) return true; | 4917 if (details.kind() == kData && details.location() == kDescriptor) { |
| 4918 return true; |
| 4919 } |
4925 } | 4920 } |
4926 return false; | 4921 return false; |
4927 } | 4922 } |
4928 | 4923 |
4929 | 4924 |
4930 void Map::NotifyLeafMapLayoutChange() { | 4925 void Map::NotifyLeafMapLayoutChange() { |
4931 if (is_stable()) { | 4926 if (is_stable()) { |
4932 mark_unstable(); | 4927 mark_unstable(); |
4933 dependent_code()->DeoptimizeDependentCodeGroup( | 4928 dependent_code()->DeoptimizeDependentCodeGroup( |
4934 GetIsolate(), | 4929 GetIsolate(), |
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5638 DescriptorArray* descriptors = instance_descriptors(); | 5633 DescriptorArray* descriptors = instance_descriptors(); |
5639 int number_of_own_descriptors = NumberOfOwnDescriptors(); | 5634 int number_of_own_descriptors = NumberOfOwnDescriptors(); |
5640 DCHECK(descriptors->number_of_descriptors() == number_of_own_descriptors); | 5635 DCHECK(descriptors->number_of_descriptors() == number_of_own_descriptors); |
5641 descriptors->Append(desc); | 5636 descriptors->Append(desc); |
5642 SetNumberOfOwnDescriptors(number_of_own_descriptors + 1); | 5637 SetNumberOfOwnDescriptors(number_of_own_descriptors + 1); |
5643 | 5638 |
5644 // This function does not support appending double field descriptors and | 5639 // This function does not support appending double field descriptors and |
5645 // it should never try to (otherwise, layout descriptor must be updated too). | 5640 // it should never try to (otherwise, layout descriptor must be updated too). |
5646 #ifdef DEBUG | 5641 #ifdef DEBUG |
5647 PropertyDetails details = desc->GetDetails(); | 5642 PropertyDetails details = desc->GetDetails(); |
5648 CHECK(details.type() != DATA || !details.representation().IsDouble()); | 5643 CHECK(details.location() != kField || !details.representation().IsDouble()); |
5649 #endif | 5644 #endif |
5650 } | 5645 } |
5651 | 5646 |
5652 | 5647 |
5653 Object* Map::GetBackPointer() { | 5648 Object* Map::GetBackPointer() { |
5654 Object* object = constructor_or_backpointer(); | 5649 Object* object = constructor_or_backpointer(); |
5655 if (object->IsMap()) { | 5650 if (object->IsMap()) { |
5656 return object; | 5651 return object; |
5657 } | 5652 } |
5658 return GetIsolate()->heap()->undefined_value(); | 5653 return GetIsolate()->heap()->undefined_value(); |
(...skipping 2794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8453 #undef WRITE_INT64_FIELD | 8448 #undef WRITE_INT64_FIELD |
8454 #undef READ_BYTE_FIELD | 8449 #undef READ_BYTE_FIELD |
8455 #undef WRITE_BYTE_FIELD | 8450 #undef WRITE_BYTE_FIELD |
8456 #undef NOBARRIER_READ_BYTE_FIELD | 8451 #undef NOBARRIER_READ_BYTE_FIELD |
8457 #undef NOBARRIER_WRITE_BYTE_FIELD | 8452 #undef NOBARRIER_WRITE_BYTE_FIELD |
8458 | 8453 |
8459 } // namespace internal | 8454 } // namespace internal |
8460 } // namespace v8 | 8455 } // namespace v8 |
8461 | 8456 |
8462 #endif // V8_OBJECTS_INL_H_ | 8457 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |