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 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 static Entry primary_[]; | 219 static Entry primary_[]; |
220 static Entry secondary_[]; | 220 static Entry secondary_[]; |
221 | 221 |
222 // Computes the hashed offsets for primary and secondary caches. | 222 // Computes the hashed offsets for primary and secondary caches. |
223 static int PrimaryOffset(String* name, Code::Flags flags, Map* map) { | 223 static int PrimaryOffset(String* name, Code::Flags flags, Map* map) { |
224 // This works well because the heap object tag size and the hash | 224 // This works well because the heap object tag size and the hash |
225 // shift are equal. Shifting down the length field to get the | 225 // shift are equal. Shifting down the length field to get the |
226 // hash code would effectively throw away two bits of the hash | 226 // hash code would effectively throw away two bits of the hash |
227 // code. | 227 // code. |
228 ASSERT(kHeapObjectTagSize == String::kHashShift); | 228 ASSERT(kHeapObjectTagSize == String::kHashShift); |
229 // Compute the hash of the name (use entire length field). | 229 // Compute the hash of the name (use entire hash field). |
230 ASSERT(name->HasHashCode()); | 230 ASSERT(name->HasHashCode()); |
231 uint32_t field = name->length_field(); | 231 uint32_t field = name->hash_field(); |
232 // Using only the low bits in 64-bit mode is unlikely to increase the | 232 // Using only the low bits in 64-bit mode is unlikely to increase the |
233 // risk of collision even if the heap is spread over an area larger than | 233 // risk of collision even if the heap is spread over an area larger than |
234 // 4Gb (and not at all if it isn't). | 234 // 4Gb (and not at all if it isn't). |
235 uint32_t map_low32bits = | 235 uint32_t map_low32bits = |
236 static_cast<uint32_t>(reinterpret_cast<uintptr_t>(map)); | 236 static_cast<uint32_t>(reinterpret_cast<uintptr_t>(map)); |
237 // We always set the in_loop bit to zero when generating the lookup code | 237 // We always set the in_loop bit to zero when generating the lookup code |
238 // so do it here too so the hash codes match. | 238 // so do it here too so the hash codes match. |
239 uint32_t iflags = | 239 uint32_t iflags = |
240 (static_cast<uint32_t>(flags) & ~Code::kFlagsNotUsedInLookup); | 240 (static_cast<uint32_t>(flags) & ~Code::kFlagsNotUsedInLookup); |
241 // Base the offset on a simple combination of name, flags, and map. | 241 // Base the offset on a simple combination of name, flags, and map. |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
568 Object* CompileConstructStub(SharedFunctionInfo* shared); | 568 Object* CompileConstructStub(SharedFunctionInfo* shared); |
569 | 569 |
570 private: | 570 private: |
571 Object* GetCode(); | 571 Object* GetCode(); |
572 }; | 572 }; |
573 | 573 |
574 | 574 |
575 } } // namespace v8::internal | 575 } } // namespace v8::internal |
576 | 576 |
577 #endif // V8_STUB_CACHE_H_ | 577 #endif // V8_STUB_CACHE_H_ |
OLD | NEW |