| OLD | NEW |
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 3889 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3900 return MarkCompactCollector::HasCompacted() ? "Mark-compact" | 3900 return MarkCompactCollector::HasCompacted() ? "Mark-compact" |
| 3901 : "Mark-sweep"; | 3901 : "Mark-sweep"; |
| 3902 } | 3902 } |
| 3903 return "Unknown GC"; | 3903 return "Unknown GC"; |
| 3904 } | 3904 } |
| 3905 | 3905 |
| 3906 | 3906 |
| 3907 int KeyedLookupCache::Hash(Map* map, String* name) { | 3907 int KeyedLookupCache::Hash(Map* map, String* name) { |
| 3908 // Uses only lower 32 bits if pointers are larger. | 3908 // Uses only lower 32 bits if pointers are larger. |
| 3909 uintptr_t addr_hash = | 3909 uintptr_t addr_hash = |
| 3910 static_cast<uint32_t>(reinterpret_cast<uintptr_t>(map)) >> 2; | 3910 static_cast<uint32_t>(reinterpret_cast<uintptr_t>(map)) >> kMapHashShift; |
| 3911 return (addr_hash ^ name->Hash()) % kLength; | 3911 return (addr_hash ^ name->Hash()) & kCapacityMask; |
| 3912 } | 3912 } |
| 3913 | 3913 |
| 3914 | 3914 |
| 3915 int KeyedLookupCache::Lookup(Map* map, String* name) { | 3915 int KeyedLookupCache::Lookup(Map* map, String* name) { |
| 3916 int index = Hash(map, name); | 3916 int index = Hash(map, name); |
| 3917 Key& key = keys_[index]; | 3917 Key& key = keys_[index]; |
| 3918 if ((key.map == map) && key.name->Equals(name)) { | 3918 if ((key.map == map) && key.name->Equals(name)) { |
| 3919 return field_offsets_[index]; | 3919 return field_offsets_[index]; |
| 3920 } | 3920 } |
| 3921 return -1; | 3921 return -1; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3985 for (int i = 0; i < kNumberOfCaches; i++) { | 3985 for (int i = 0; i < kNumberOfCaches; i++) { |
| 3986 if (caches_[i] != NULL) { | 3986 if (caches_[i] != NULL) { |
| 3987 delete caches_[i]; | 3987 delete caches_[i]; |
| 3988 caches_[i] = NULL; | 3988 caches_[i] = NULL; |
| 3989 } | 3989 } |
| 3990 } | 3990 } |
| 3991 } | 3991 } |
| 3992 | 3992 |
| 3993 | 3993 |
| 3994 } } // namespace v8::internal | 3994 } } // namespace v8::internal |
| OLD | NEW |