| 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 2117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2128 public: | 2128 public: |
| 2129 // Lookup field offset for (map, name). If absent, -1 is returned. | 2129 // Lookup field offset for (map, name). If absent, -1 is returned. |
| 2130 int Lookup(Map* map, String* name); | 2130 int Lookup(Map* map, String* name); |
| 2131 | 2131 |
| 2132 // Update an element in the cache. | 2132 // Update an element in the cache. |
| 2133 void Update(Map* map, String* name, int field_offset); | 2133 void Update(Map* map, String* name, int field_offset); |
| 2134 | 2134 |
| 2135 // Clear the cache. | 2135 // Clear the cache. |
| 2136 void Clear(); | 2136 void Clear(); |
| 2137 | 2137 |
| 2138 static const int kLength = 64; | 2138 static const int kLength = 128; |
| 2139 static const int kCapacityMask = kLength - 1; | 2139 static const int kCapacityMask = kLength - 1; |
| 2140 static const int kMapHashShift = 2; | 2140 static const int kMapHashShift = 5; |
| 2141 static const int kHashMask = -2; // Zero the last bit. |
| 2142 static const int kEntriesPerBucket = 2; |
| 2141 static const int kNotFound = -1; | 2143 static const int kNotFound = -1; |
| 2142 | 2144 |
| 2143 private: | 2145 private: |
| 2144 KeyedLookupCache() { | 2146 KeyedLookupCache() { |
| 2145 for (int i = 0; i < kLength; ++i) { | 2147 for (int i = 0; i < kLength; ++i) { |
| 2146 keys_[i].map = NULL; | 2148 keys_[i].map = NULL; |
| 2147 keys_[i].name = NULL; | 2149 keys_[i].name = NULL; |
| 2148 field_offsets_[i] = kNotFound; | 2150 field_offsets_[i] = kNotFound; |
| 2149 } | 2151 } |
| 2150 } | 2152 } |
| (...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2615 | 2617 |
| 2616 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2618 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
| 2617 }; | 2619 }; |
| 2618 #endif // DEBUG || LIVE_OBJECT_LIST | 2620 #endif // DEBUG || LIVE_OBJECT_LIST |
| 2619 | 2621 |
| 2620 } } // namespace v8::internal | 2622 } } // namespace v8::internal |
| 2621 | 2623 |
| 2622 #undef HEAP | 2624 #undef HEAP |
| 2623 | 2625 |
| 2624 #endif // V8_HEAP_H_ | 2626 #endif // V8_HEAP_H_ |
| OLD | NEW |