| 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 1880 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1891 DCHECK(!ExpectedTransitionKey(map).is_null()); | 1891 DCHECK(!ExpectedTransitionKey(map).is_null()); |
| 1892 return Handle<Map>(map->transitions()->GetTarget( | 1892 return Handle<Map>(map->transitions()->GetTarget( |
| 1893 TransitionArray::kSimpleTransitionIndex)); | 1893 TransitionArray::kSimpleTransitionIndex)); |
| 1894 } | 1894 } |
| 1895 | 1895 |
| 1896 | 1896 |
| 1897 Handle<Map> Map::FindTransitionToField(Handle<Map> map, Handle<Name> key) { | 1897 Handle<Map> Map::FindTransitionToField(Handle<Map> map, Handle<Name> key) { |
| 1898 DisallowHeapAllocation no_allocation; | 1898 DisallowHeapAllocation no_allocation; |
| 1899 if (!map->HasTransitionArray()) return Handle<Map>::null(); | 1899 if (!map->HasTransitionArray()) return Handle<Map>::null(); |
| 1900 TransitionArray* transitions = map->transitions(); | 1900 TransitionArray* transitions = map->transitions(); |
| 1901 int transition = transitions->Search(FIELD, *key, NONE); | 1901 int transition = transitions->Search(DATA, *key, NONE); |
| 1902 if (transition == TransitionArray::kNotFound) return Handle<Map>::null(); | 1902 if (transition == TransitionArray::kNotFound) return Handle<Map>::null(); |
| 1903 PropertyDetails details = transitions->GetTargetDetails(transition); | 1903 PropertyDetails details = transitions->GetTargetDetails(transition); |
| 1904 if (details.type() != FIELD) return Handle<Map>::null(); | 1904 if (details.type() != FIELD) return Handle<Map>::null(); |
| 1905 DCHECK_EQ(NONE, details.attributes()); | 1905 DCHECK_EQ(NONE, details.attributes()); |
| 1906 return Handle<Map>(transitions->GetTarget(transition)); | 1906 return Handle<Map>(transitions->GetTarget(transition)); |
| 1907 } | 1907 } |
| 1908 | 1908 |
| 1909 | 1909 |
| 1910 ACCESSORS(Oddball, to_string, String, kToStringOffset) | 1910 ACCESSORS(Oddball, to_string, String, kToStringOffset) |
| 1911 ACCESSORS(Oddball, to_number, Object, kToNumberOffset) | 1911 ACCESSORS(Oddball, to_number, Object, kToNumberOffset) |
| (...skipping 1087 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2999 DescriptorArray* descriptors = this->instance_descriptors(); | 2999 DescriptorArray* descriptors = this->instance_descriptors(); |
| 3000 int number = descriptors->SearchWithCache(name, this); | 3000 int number = descriptors->SearchWithCache(name, this); |
| 3001 if (number == DescriptorArray::kNotFound) return result->NotFound(); | 3001 if (number == DescriptorArray::kNotFound) return result->NotFound(); |
| 3002 result->DescriptorResult(holder, descriptors->GetDetails(number), number); | 3002 result->DescriptorResult(holder, descriptors->GetDetails(number), number); |
| 3003 } | 3003 } |
| 3004 | 3004 |
| 3005 | 3005 |
| 3006 void Map::LookupTransition(JSObject* holder, Name* name, | 3006 void Map::LookupTransition(JSObject* holder, Name* name, |
| 3007 PropertyAttributes attributes, | 3007 PropertyAttributes attributes, |
| 3008 LookupResult* result) { | 3008 LookupResult* result) { |
| 3009 int transition_index = this->SearchTransition(FIELD, name, attributes); | 3009 int transition_index = this->SearchTransition(DATA, name, attributes); |
| 3010 if (transition_index == TransitionArray::kNotFound) return result->NotFound(); | 3010 if (transition_index == TransitionArray::kNotFound) return result->NotFound(); |
| 3011 result->TransitionResult(holder, this->GetTransition(transition_index)); | 3011 result->TransitionResult(holder, this->GetTransition(transition_index)); |
| 3012 } | 3012 } |
| 3013 | 3013 |
| 3014 | 3014 |
| 3015 FixedArrayBase* Map::GetInitialElements() { | 3015 FixedArrayBase* Map::GetInitialElements() { |
| 3016 if (has_fast_smi_or_object_elements() || | 3016 if (has_fast_smi_or_object_elements() || |
| 3017 has_fast_double_elements()) { | 3017 has_fast_double_elements()) { |
| 3018 DCHECK(!GetHeap()->InNewSpace(GetHeap()->empty_fixed_array())); | 3018 DCHECK(!GetHeap()->InNewSpace(GetHeap()->empty_fixed_array())); |
| 3019 return GetHeap()->empty_fixed_array(); | 3019 return GetHeap()->empty_fixed_array(); |
| (...skipping 2342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5362 | 5362 |
| 5363 | 5363 |
| 5364 int Map::SearchSpecialTransition(Symbol* name) { | 5364 int Map::SearchSpecialTransition(Symbol* name) { |
| 5365 if (HasTransitionArray()) { | 5365 if (HasTransitionArray()) { |
| 5366 return transitions()->SearchSpecial(name); | 5366 return transitions()->SearchSpecial(name); |
| 5367 } | 5367 } |
| 5368 return TransitionArray::kNotFound; | 5368 return TransitionArray::kNotFound; |
| 5369 } | 5369 } |
| 5370 | 5370 |
| 5371 | 5371 |
| 5372 int Map::SearchTransition(PropertyType type, Name* name, | 5372 int Map::SearchTransition(PropertyKind kind, Name* name, |
| 5373 PropertyAttributes attributes) { | 5373 PropertyAttributes attributes) { |
| 5374 if (HasTransitionArray()) { | 5374 if (HasTransitionArray()) { |
| 5375 return transitions()->Search(type, name, attributes); | 5375 return transitions()->Search(kind, name, attributes); |
| 5376 } | 5376 } |
| 5377 return TransitionArray::kNotFound; | 5377 return TransitionArray::kNotFound; |
| 5378 } | 5378 } |
| 5379 | 5379 |
| 5380 | 5380 |
| 5381 FixedArray* Map::GetPrototypeTransitions() { | 5381 FixedArray* Map::GetPrototypeTransitions() { |
| 5382 if (!HasTransitionArray()) return GetHeap()->empty_fixed_array(); | 5382 if (!HasTransitionArray()) return GetHeap()->empty_fixed_array(); |
| 5383 if (!transitions()->HasPrototypeTransitions()) { | 5383 if (!transitions()->HasPrototypeTransitions()) { |
| 5384 return GetHeap()->empty_fixed_array(); | 5384 return GetHeap()->empty_fixed_array(); |
| 5385 } | 5385 } |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5423 for (int i = 0; i < transitions()->number_of_transitions(); i++) { | 5423 for (int i = 0; i < transitions()->number_of_transitions(); i++) { |
| 5424 Map* target = transitions()->GetTarget(i); | 5424 Map* target = transitions()->GetTarget(i); |
| 5425 if (target->instance_descriptors() == instance_descriptors()) { | 5425 if (target->instance_descriptors() == instance_descriptors()) { |
| 5426 Name* key = transitions()->GetKey(i); | 5426 Name* key = transitions()->GetKey(i); |
| 5427 int new_target_index; | 5427 int new_target_index; |
| 5428 if (TransitionArray::IsSpecialTransition(key)) { | 5428 if (TransitionArray::IsSpecialTransition(key)) { |
| 5429 new_target_index = transition_array->SearchSpecial(Symbol::cast(key)); | 5429 new_target_index = transition_array->SearchSpecial(Symbol::cast(key)); |
| 5430 } else { | 5430 } else { |
| 5431 PropertyDetails details = | 5431 PropertyDetails details = |
| 5432 TransitionArray::GetTargetDetails(key, target); | 5432 TransitionArray::GetTargetDetails(key, target); |
| 5433 new_target_index = transition_array->Search(details.type(), key, | 5433 new_target_index = transition_array->Search(details.kind(), key, |
| 5434 details.attributes()); | 5434 details.attributes()); |
| 5435 } | 5435 } |
| 5436 DCHECK_NE(TransitionArray::kNotFound, new_target_index); | 5436 DCHECK_NE(TransitionArray::kNotFound, new_target_index); |
| 5437 DCHECK_EQ(target, transition_array->GetTarget(new_target_index)); | 5437 DCHECK_EQ(target, transition_array->GetTarget(new_target_index)); |
| 5438 } | 5438 } |
| 5439 } | 5439 } |
| 5440 #endif | 5440 #endif |
| 5441 DCHECK(transitions() != transition_array); | 5441 DCHECK(transitions() != transition_array); |
| 5442 ZapTransitions(); | 5442 ZapTransitions(); |
| 5443 } | 5443 } |
| (...skipping 2074 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7518 #undef READ_SHORT_FIELD | 7518 #undef READ_SHORT_FIELD |
| 7519 #undef WRITE_SHORT_FIELD | 7519 #undef WRITE_SHORT_FIELD |
| 7520 #undef READ_BYTE_FIELD | 7520 #undef READ_BYTE_FIELD |
| 7521 #undef WRITE_BYTE_FIELD | 7521 #undef WRITE_BYTE_FIELD |
| 7522 #undef NOBARRIER_READ_BYTE_FIELD | 7522 #undef NOBARRIER_READ_BYTE_FIELD |
| 7523 #undef NOBARRIER_WRITE_BYTE_FIELD | 7523 #undef NOBARRIER_WRITE_BYTE_FIELD |
| 7524 | 7524 |
| 7525 } } // namespace v8::internal | 7525 } } // namespace v8::internal |
| 7526 | 7526 |
| 7527 #endif // V8_OBJECTS_INL_H_ | 7527 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |