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 10867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10878 | 10878 |
10879 | 10879 |
10880 // Find entry for key otherwise return kNotFound. | 10880 // Find entry for key otherwise return kNotFound. |
10881 int StringDictionary::FindEntry(String* key) { | 10881 int StringDictionary::FindEntry(String* key) { |
10882 if (!key->IsSymbol()) { | 10882 if (!key->IsSymbol()) { |
10883 return HashTable<StringDictionaryShape, String*>::FindEntry(key); | 10883 return HashTable<StringDictionaryShape, String*>::FindEntry(key); |
10884 } | 10884 } |
10885 | 10885 |
10886 // Optimized for symbol key. Knowledge of the key type allows: | 10886 // Optimized for symbol key. Knowledge of the key type allows: |
10887 // 1. Move the check if the key is a symbol out of the loop. | 10887 // 1. Move the check if the key is a symbol out of the loop. |
10888 // 2. Avoid comparing hash codes in symbol to symbol comparision. | 10888 // 2. Avoid comparing hash codes in symbol to symbol comparison. |
10889 // 3. Detect a case when a dictionary key is not a symbol but the key is. | 10889 // 3. Detect a case when a dictionary key is not a symbol but the key is. |
10890 // In case of positive result the dictionary key may be replaced by | 10890 // In case of positive result the dictionary key may be replaced by |
10891 // the symbol with minimal performance penalty. It gives a chance to | 10891 // the symbol with minimal performance penalty. It gives a chance to |
10892 // perform further lookups in code stubs (and significant performance boost | 10892 // perform further lookups in code stubs (and significant performance boost |
10893 // a certain style of code). | 10893 // a certain style of code). |
10894 | 10894 |
10895 // EnsureCapacity will guarantee the hash table is never full. | 10895 // EnsureCapacity will guarantee the hash table is never full. |
10896 uint32_t capacity = Capacity(); | 10896 uint32_t capacity = Capacity(); |
10897 uint32_t entry = FirstProbe(key->Hash(), capacity); | 10897 uint32_t entry = FirstProbe(key->Hash(), capacity); |
10898 uint32_t count = 1; | 10898 uint32_t count = 1; |
(...skipping 1907 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12806 if (break_point_objects()->IsUndefined()) return 0; | 12806 if (break_point_objects()->IsUndefined()) return 0; |
12807 // Single break point. | 12807 // Single break point. |
12808 if (!break_point_objects()->IsFixedArray()) return 1; | 12808 if (!break_point_objects()->IsFixedArray()) return 1; |
12809 // Multiple break points. | 12809 // Multiple break points. |
12810 return FixedArray::cast(break_point_objects())->length(); | 12810 return FixedArray::cast(break_point_objects())->length(); |
12811 } | 12811 } |
12812 #endif // ENABLE_DEBUGGER_SUPPORT | 12812 #endif // ENABLE_DEBUGGER_SUPPORT |
12813 | 12813 |
12814 | 12814 |
12815 } } // namespace v8::internal | 12815 } } // namespace v8::internal |
OLD | NEW |