| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 2611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2622 DescriptorArray* descriptors = this->instance_descriptors(); | 2622 DescriptorArray* descriptors = this->instance_descriptors(); |
| 2623 int number = descriptors->SearchWithCache(name, this); | 2623 int number = descriptors->SearchWithCache(name, this); |
| 2624 if (number == DescriptorArray::kNotFound) return result->NotFound(); | 2624 if (number == DescriptorArray::kNotFound) return result->NotFound(); |
| 2625 result->DescriptorResult(holder, descriptors->GetDetails(number), number); | 2625 result->DescriptorResult(holder, descriptors->GetDetails(number), number); |
| 2626 } | 2626 } |
| 2627 | 2627 |
| 2628 | 2628 |
| 2629 void Map::LookupTransition(JSObject* holder, | 2629 void Map::LookupTransition(JSObject* holder, |
| 2630 Name* name, | 2630 Name* name, |
| 2631 LookupResult* result) { | 2631 LookupResult* result) { |
| 2632 if (HasTransitionArray()) { | 2632 int transition_index = this->SearchTransition(name); |
| 2633 TransitionArray* transition_array = transitions(); | 2633 if (transition_index == TransitionArray::kNotFound) return result->NotFound(); |
| 2634 int number = transition_array->Search(name); | 2634 result->TransitionResult(holder, this->GetTransition(transition_index)); |
| 2635 if (number != TransitionArray::kNotFound) { | |
| 2636 return result->TransitionResult( | |
| 2637 holder, transition_array->GetTarget(number)); | |
| 2638 } | |
| 2639 } | |
| 2640 result->NotFound(); | |
| 2641 } | 2635 } |
| 2642 | 2636 |
| 2643 | 2637 |
| 2644 Object** DescriptorArray::GetKeySlot(int descriptor_number) { | 2638 Object** DescriptorArray::GetKeySlot(int descriptor_number) { |
| 2645 ASSERT(descriptor_number < number_of_descriptors()); | 2639 ASSERT(descriptor_number < number_of_descriptors()); |
| 2646 return RawFieldOfElementAt(ToKeyIndex(descriptor_number)); | 2640 return RawFieldOfElementAt(ToKeyIndex(descriptor_number)); |
| 2647 } | 2641 } |
| 2648 | 2642 |
| 2649 | 2643 |
| 2650 Object** DescriptorArray::GetDescriptorStartSlot(int descriptor_number) { | 2644 Object** DescriptorArray::GetDescriptorStartSlot(int descriptor_number) { |
| (...skipping 2246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4897 void Map::SetTransition(int transition_index, Map* target) { | 4891 void Map::SetTransition(int transition_index, Map* target) { |
| 4898 transitions()->SetTarget(transition_index, target); | 4892 transitions()->SetTarget(transition_index, target); |
| 4899 } | 4893 } |
| 4900 | 4894 |
| 4901 | 4895 |
| 4902 Map* Map::GetTransition(int transition_index) { | 4896 Map* Map::GetTransition(int transition_index) { |
| 4903 return transitions()->GetTarget(transition_index); | 4897 return transitions()->GetTarget(transition_index); |
| 4904 } | 4898 } |
| 4905 | 4899 |
| 4906 | 4900 |
| 4901 int Map::SearchTransition(Name* name) { |
| 4902 if (HasTransitionArray()) return transitions()->Search(name); |
| 4903 return TransitionArray::kNotFound; |
| 4904 } |
| 4905 |
| 4906 |
| 4907 MaybeObject* Map::set_elements_transition_map(Map* transitioned_map) { | 4907 MaybeObject* Map::set_elements_transition_map(Map* transitioned_map) { |
| 4908 TransitionArray* transitions; | 4908 TransitionArray* transitions; |
| 4909 MaybeObject* maybe_transitions = AddTransition( | 4909 MaybeObject* maybe_transitions = AddTransition( |
| 4910 GetHeap()->elements_transition_symbol(), | 4910 GetHeap()->elements_transition_symbol(), |
| 4911 transitioned_map, | 4911 transitioned_map, |
| 4912 FULL_TRANSITION); | 4912 FULL_TRANSITION); |
| 4913 if (!maybe_transitions->To(&transitions)) return maybe_transitions; | 4913 if (!maybe_transitions->To(&transitions)) return maybe_transitions; |
| 4914 set_transitions(transitions); | 4914 set_transitions(transitions); |
| 4915 return transitions; | 4915 return transitions; |
| 4916 } | 4916 } |
| (...skipping 2024 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6941 #undef READ_UINT32_FIELD | 6941 #undef READ_UINT32_FIELD |
| 6942 #undef WRITE_UINT32_FIELD | 6942 #undef WRITE_UINT32_FIELD |
| 6943 #undef READ_SHORT_FIELD | 6943 #undef READ_SHORT_FIELD |
| 6944 #undef WRITE_SHORT_FIELD | 6944 #undef WRITE_SHORT_FIELD |
| 6945 #undef READ_BYTE_FIELD | 6945 #undef READ_BYTE_FIELD |
| 6946 #undef WRITE_BYTE_FIELD | 6946 #undef WRITE_BYTE_FIELD |
| 6947 | 6947 |
| 6948 } } // namespace v8::internal | 6948 } } // namespace v8::internal |
| 6949 | 6949 |
| 6950 #endif // V8_OBJECTS_INL_H_ | 6950 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |