OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 1282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1293 class KeyedLookupCache { | 1293 class KeyedLookupCache { |
1294 public: | 1294 public: |
1295 // Lookup field offset for (map, name). If absent, -1 is returned. | 1295 // Lookup field offset for (map, name). If absent, -1 is returned. |
1296 static int Lookup(Map* map, String* name); | 1296 static int Lookup(Map* map, String* name); |
1297 | 1297 |
1298 // Update an element in the cache. | 1298 // Update an element in the cache. |
1299 static void Update(Map* map, String* name, int field_offset); | 1299 static void Update(Map* map, String* name, int field_offset); |
1300 | 1300 |
1301 // Clear the cache. | 1301 // Clear the cache. |
1302 static void Clear(); | 1302 static void Clear(); |
1303 | |
1304 static const int kLength = 64; | |
1305 static const int kCapacityMask = kLength - 1; | |
1306 static const int kMapHashShift = 2; | |
1307 | |
1308 private: | 1303 private: |
1309 static inline int Hash(Map* map, String* name); | 1304 static inline int Hash(Map* map, String* name); |
1310 | 1305 static const int kLength = 64; |
1311 // Get the address of the keys and field_offsets arrays. Used in | |
1312 // generated code to perform cache lookups. | |
1313 static Address keys_address() { | |
1314 return reinterpret_cast<Address>(&keys_); | |
1315 } | |
1316 | |
1317 static Address field_offsets_address() { | |
1318 return reinterpret_cast<Address>(&field_offsets_); | |
1319 } | |
1320 | |
1321 struct Key { | 1306 struct Key { |
1322 Map* map; | 1307 Map* map; |
1323 String* name; | 1308 String* name; |
1324 }; | 1309 }; |
1325 static Key keys_[kLength]; | 1310 static Key keys_[kLength]; |
1326 static int field_offsets_[kLength]; | 1311 static int field_offsets_[kLength]; |
| 1312 }; |
1327 | 1313 |
1328 friend class ExternalReference; | |
1329 }; | |
1330 | 1314 |
1331 | 1315 |
1332 // Cache for mapping (array, property name) into descriptor index. | 1316 // Cache for mapping (array, property name) into descriptor index. |
1333 // The cache contains both positive and negative results. | 1317 // The cache contains both positive and negative results. |
1334 // Descriptor index equals kNotFound means the property is absent. | 1318 // Descriptor index equals kNotFound means the property is absent. |
1335 // Cleared at startup and prior to any gc. | 1319 // Cleared at startup and prior to any gc. |
1336 class DescriptorLookupCache { | 1320 class DescriptorLookupCache { |
1337 public: | 1321 public: |
1338 // Lookup descriptor index for (map, name). | 1322 // Lookup descriptor index for (map, name). |
1339 // If absent, kAbsent is returned. | 1323 // If absent, kAbsent is returned. |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1675 | 1659 |
1676 // To speed up scavenge collections new space string are kept | 1660 // To speed up scavenge collections new space string are kept |
1677 // separate from old space strings. | 1661 // separate from old space strings. |
1678 static List<Object*> new_space_strings_; | 1662 static List<Object*> new_space_strings_; |
1679 static List<Object*> old_space_strings_; | 1663 static List<Object*> old_space_strings_; |
1680 }; | 1664 }; |
1681 | 1665 |
1682 } } // namespace v8::internal | 1666 } } // namespace v8::internal |
1683 | 1667 |
1684 #endif // V8_HEAP_H_ | 1668 #endif // V8_HEAP_H_ |
OLD | NEW |