OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_HEAP_H_ | 5 #ifndef V8_HEAP_H_ |
6 #define V8_HEAP_H_ | 6 #define V8_HEAP_H_ |
7 | 7 |
8 #include <cmath> | 8 #include <cmath> |
9 | 9 |
10 #include "src/allocation.h" | 10 #include "src/allocation.h" |
(...skipping 2386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2397 void Update(Handle<Map> map, Handle<Name> name, int field_offset); | 2397 void Update(Handle<Map> map, Handle<Name> name, int field_offset); |
2398 | 2398 |
2399 // Clear the cache. | 2399 // Clear the cache. |
2400 void Clear(); | 2400 void Clear(); |
2401 | 2401 |
2402 static const int kLength = 256; | 2402 static const int kLength = 256; |
2403 static const int kCapacityMask = kLength - 1; | 2403 static const int kCapacityMask = kLength - 1; |
2404 static const int kMapHashShift = 5; | 2404 static const int kMapHashShift = 5; |
2405 static const int kHashMask = -4; // Zero the last two bits. | 2405 static const int kHashMask = -4; // Zero the last two bits. |
2406 static const int kEntriesPerBucket = 4; | 2406 static const int kEntriesPerBucket = 4; |
2407 static const int kEntryLength = 2; | |
2408 static const int kMapIndex = 0; | |
2409 static const int kKeyIndex = 1; | |
2410 static const int kNotFound = -1; | 2407 static const int kNotFound = -1; |
2411 | 2408 |
2412 // kEntriesPerBucket should be a power of 2. | 2409 // kEntriesPerBucket should be a power of 2. |
2413 STATIC_ASSERT((kEntriesPerBucket & (kEntriesPerBucket - 1)) == 0); | 2410 STATIC_ASSERT((kEntriesPerBucket & (kEntriesPerBucket - 1)) == 0); |
2414 STATIC_ASSERT(kEntriesPerBucket == -kHashMask); | 2411 STATIC_ASSERT(kEntriesPerBucket == -kHashMask); |
2415 | 2412 |
2416 private: | 2413 private: |
2417 KeyedLookupCache() { | 2414 KeyedLookupCache() { |
2418 for (int i = 0; i < kLength; ++i) { | 2415 for (int i = 0; i < kLength; ++i) { |
2419 keys_[i].map = NULL; | 2416 keys_[i].map = NULL; |
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2783 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. | 2780 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. |
2784 | 2781 |
2785 private: | 2782 private: |
2786 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2783 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
2787 }; | 2784 }; |
2788 #endif // DEBUG | 2785 #endif // DEBUG |
2789 | 2786 |
2790 } } // namespace v8::internal | 2787 } } // namespace v8::internal |
2791 | 2788 |
2792 #endif // V8_HEAP_H_ | 2789 #endif // V8_HEAP_H_ |
OLD | NEW |