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 = 128; | 2138 static const int kLength = 256; |
2139 static const int kCapacityMask = kLength - 1; | 2139 static const int kCapacityMask = kLength - 1; |
2140 static const int kMapHashShift = 5; | 2140 static const int kMapHashShift = 5; |
2141 static const int kHashMask = -2; // Zero the last bit. | 2141 static const int kHashMask = -4; // Zero the last two bits. |
2142 static const int kEntriesPerBucket = 2; | 2142 static const int kEntriesPerBucket = 4; |
Yang
2012/01/23 15:53:31
Maybe add assertions such as
STATIC_ASSERT(IS_POWE
| |
2143 static const int kNotFound = -1; | 2143 static const int kNotFound = -1; |
2144 | 2144 |
2145 private: | 2145 private: |
2146 KeyedLookupCache() { | 2146 KeyedLookupCache() { |
2147 for (int i = 0; i < kLength; ++i) { | 2147 for (int i = 0; i < kLength; ++i) { |
2148 keys_[i].map = NULL; | 2148 keys_[i].map = NULL; |
2149 keys_[i].name = NULL; | 2149 keys_[i].name = NULL; |
2150 field_offsets_[i] = kNotFound; | 2150 field_offsets_[i] = kNotFound; |
2151 } | 2151 } |
2152 } | 2152 } |
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2618 private: | 2618 private: |
2619 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2619 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
2620 }; | 2620 }; |
2621 #endif // DEBUG || LIVE_OBJECT_LIST | 2621 #endif // DEBUG || LIVE_OBJECT_LIST |
2622 | 2622 |
2623 } } // namespace v8::internal | 2623 } } // namespace v8::internal |
2624 | 2624 |
2625 #undef HEAP | 2625 #undef HEAP |
2626 | 2626 |
2627 #endif // V8_HEAP_H_ | 2627 #endif // V8_HEAP_H_ |
OLD | NEW |