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 2632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2643 // Slow case: perform binary search. | 2643 // Slow case: perform binary search. |
2644 return BinarySearch<search_mode>(array, name, 0, nof - 1, valid_entries, | 2644 return BinarySearch<search_mode>(array, name, 0, nof - 1, valid_entries, |
2645 out_insertion_index); | 2645 out_insertion_index); |
2646 } | 2646 } |
2647 | 2647 |
2648 | 2648 |
2649 int DescriptorArray::Search(Name* name, int valid_descriptors) { | 2649 int DescriptorArray::Search(Name* name, int valid_descriptors) { |
2650 return internal::Search<VALID_ENTRIES>(this, name, valid_descriptors, NULL); | 2650 return internal::Search<VALID_ENTRIES>(this, name, valid_descriptors, NULL); |
2651 } | 2651 } |
2652 | 2652 |
2653 | 2653 int DescriptorArray::SearchWithCache(Isolate* isolate, Name* name, Map* map) { |
2654 int DescriptorArray::SearchWithCache(Name* name, Map* map) { | |
2655 int number_of_own_descriptors = map->NumberOfOwnDescriptors(); | 2654 int number_of_own_descriptors = map->NumberOfOwnDescriptors(); |
2656 if (number_of_own_descriptors == 0) return kNotFound; | 2655 if (number_of_own_descriptors == 0) return kNotFound; |
2657 | 2656 |
2658 DescriptorLookupCache* cache = GetIsolate()->descriptor_lookup_cache(); | 2657 DescriptorLookupCache* cache = isolate->descriptor_lookup_cache(); |
2659 int number = cache->Lookup(map, name); | 2658 int number = cache->Lookup(map, name); |
2660 | 2659 |
2661 if (number == DescriptorLookupCache::kAbsent) { | 2660 if (number == DescriptorLookupCache::kAbsent) { |
2662 number = Search(name, number_of_own_descriptors); | 2661 number = Search(name, number_of_own_descriptors); |
2663 cache->Update(map, name, number); | 2662 cache->Update(map, name, number); |
2664 } | 2663 } |
2665 | 2664 |
2666 return number; | 2665 return number; |
2667 } | 2666 } |
2668 | 2667 |
(...skipping 5004 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7673 #undef WRITE_INT64_FIELD | 7672 #undef WRITE_INT64_FIELD |
7674 #undef READ_BYTE_FIELD | 7673 #undef READ_BYTE_FIELD |
7675 #undef WRITE_BYTE_FIELD | 7674 #undef WRITE_BYTE_FIELD |
7676 #undef NOBARRIER_READ_BYTE_FIELD | 7675 #undef NOBARRIER_READ_BYTE_FIELD |
7677 #undef NOBARRIER_WRITE_BYTE_FIELD | 7676 #undef NOBARRIER_WRITE_BYTE_FIELD |
7678 | 7677 |
7679 } // namespace internal | 7678 } // namespace internal |
7680 } // namespace v8 | 7679 } // namespace v8 |
7681 | 7680 |
7682 #endif // V8_OBJECTS_INL_H_ | 7681 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |