| 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_STUB_CACHE_H_ | 5 #ifndef V8_STUB_CACHE_H_ |
| 6 #define V8_STUB_CACHE_H_ | 6 #define V8_STUB_CACHE_H_ |
| 7 | 7 |
| 8 #include "src/macro-assembler.h" | 8 #include "src/macro-assembler.h" |
| 9 | 9 |
| 10 namespace v8 { | 10 namespace v8 { |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 } | 67 } |
| 68 | 68 |
| 69 StubCache::Entry* first_entry(StubCache::Table table) { | 69 StubCache::Entry* first_entry(StubCache::Table table) { |
| 70 switch (table) { | 70 switch (table) { |
| 71 case StubCache::kPrimary: | 71 case StubCache::kPrimary: |
| 72 return StubCache::primary_; | 72 return StubCache::primary_; |
| 73 case StubCache::kSecondary: | 73 case StubCache::kSecondary: |
| 74 return StubCache::secondary_; | 74 return StubCache::secondary_; |
| 75 } | 75 } |
| 76 UNREACHABLE(); | 76 UNREACHABLE(); |
| 77 return NULL; | 77 return nullptr; |
| 78 } | 78 } |
| 79 | 79 |
| 80 Isolate* isolate() { return isolate_; } | 80 Isolate* isolate() { return isolate_; } |
| 81 Code::Kind ic_kind() const { return ic_kind_; } | 81 Code::Kind ic_kind() const { return ic_kind_; } |
| 82 | 82 |
| 83 // Setting the entry size such that the index is shifted by Name::kHashShift | 83 // Setting the entry size such that the index is shifted by Name::kHashShift |
| 84 // is convenient; shifting down the length field (to extract the hash code) | 84 // is convenient; shifting down the length field (to extract the hash code) |
| 85 // automatically discards the hash bit field. | 85 // automatically discards the hash bit field. |
| 86 static const int kCacheIndexShift = Name::kHashShift; | 86 static const int kCacheIndexShift = Name::kHashShift; |
| 87 | 87 |
| 88 static const int kPrimaryTableBits = 11; | 88 static const int kPrimaryTableBits = 11; |
| 89 static const int kPrimaryTableSize = (1 << kPrimaryTableBits); | 89 static const int kPrimaryTableSize = (1 << kPrimaryTableBits); |
| 90 static const int kSecondaryTableBits = 9; | 90 static const int kSecondaryTableBits = 9; |
| 91 static const int kSecondaryTableSize = (1 << kSecondaryTableBits); | 91 static const int kSecondaryTableSize = (1 << kSecondaryTableBits); |
| 92 | 92 |
| 93 // Some magic number used in primary and secondary hash computations. | 93 // Some magic number used in primary and secondary hash computations. |
| 94 static const int kPrimaryMagic = 0x3d532433; | 94 static const int kPrimaryMagic = 0x3d532433; |
| 95 static const int kSecondaryMagic = 0xb16b00b5; | 95 static const int kSecondaryMagic = 0xb16ca6e5; |
| 96 | 96 |
| 97 static int PrimaryOffsetForTesting(Name* name, Map* map) { | 97 static int PrimaryOffsetForTesting(Name* name, Map* map) { |
| 98 return PrimaryOffset(name, map); | 98 return PrimaryOffset(name, map); |
| 99 } | 99 } |
| 100 | 100 |
| 101 static int SecondaryOffsetForTesting(Name* name, int seed) { | 101 static int SecondaryOffsetForTesting(Name* name, int seed) { |
| 102 return SecondaryOffset(name, seed); | 102 return SecondaryOffset(name, seed); |
| 103 } | 103 } |
| 104 | 104 |
| 105 // The constructor is made public only for the purposes of testing. | 105 // The constructor is made public only for the purposes of testing. |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 | 161 |
| 162 friend class Isolate; | 162 friend class Isolate; |
| 163 friend class SCTableReference; | 163 friend class SCTableReference; |
| 164 | 164 |
| 165 DISALLOW_COPY_AND_ASSIGN(StubCache); | 165 DISALLOW_COPY_AND_ASSIGN(StubCache); |
| 166 }; | 166 }; |
| 167 } // namespace internal | 167 } // namespace internal |
| 168 } // namespace v8 | 168 } // namespace v8 |
| 169 | 169 |
| 170 #endif // V8_STUB_CACHE_H_ | 170 #endif // V8_STUB_CACHE_H_ |
| OLD | NEW |