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 3945 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3956 return MarkCompactCollector::HasCompacted() ? "Mark-compact" | 3956 return MarkCompactCollector::HasCompacted() ? "Mark-compact" |
3957 : "Mark-sweep"; | 3957 : "Mark-sweep"; |
3958 } | 3958 } |
3959 return "Unknown GC"; | 3959 return "Unknown GC"; |
3960 } | 3960 } |
3961 | 3961 |
3962 | 3962 |
3963 int KeyedLookupCache::Hash(Map* map, String* name) { | 3963 int KeyedLookupCache::Hash(Map* map, String* name) { |
3964 // Uses only lower 32 bits if pointers are larger. | 3964 // Uses only lower 32 bits if pointers are larger. |
3965 uintptr_t addr_hash = | 3965 uintptr_t addr_hash = |
3966 static_cast<uint32_t>(reinterpret_cast<uintptr_t>(map)) >> 2; | 3966 static_cast<uint32_t>(reinterpret_cast<uintptr_t>(map)) >> kMapHashShift; |
3967 return (addr_hash ^ name->Hash()) % kLength; | 3967 return (addr_hash ^ name->Hash()) & kCapacityMask; |
3968 } | 3968 } |
3969 | 3969 |
3970 | 3970 |
3971 int KeyedLookupCache::Lookup(Map* map, String* name) { | 3971 int KeyedLookupCache::Lookup(Map* map, String* name) { |
3972 int index = Hash(map, name); | 3972 int index = Hash(map, name); |
3973 Key& key = keys_[index]; | 3973 Key& key = keys_[index]; |
3974 if ((key.map == map) && key.name->Equals(name)) { | 3974 if ((key.map == map) && key.name->Equals(name)) { |
3975 return field_offsets_[index]; | 3975 return field_offsets_[index]; |
3976 } | 3976 } |
3977 return -1; | 3977 return -1; |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4072 void ExternalStringTable::TearDown() { | 4072 void ExternalStringTable::TearDown() { |
4073 new_space_strings_.Free(); | 4073 new_space_strings_.Free(); |
4074 old_space_strings_.Free(); | 4074 old_space_strings_.Free(); |
4075 } | 4075 } |
4076 | 4076 |
4077 | 4077 |
4078 List<Object*> ExternalStringTable::new_space_strings_; | 4078 List<Object*> ExternalStringTable::new_space_strings_; |
4079 List<Object*> ExternalStringTable::old_space_strings_; | 4079 List<Object*> ExternalStringTable::old_space_strings_; |
4080 | 4080 |
4081 } } // namespace v8::internal | 4081 } } // namespace v8::internal |
OLD | NEW |