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 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 static_cast<uint32_t>(reinterpret_cast<uintptr_t>(name)); | 249 static_cast<uint32_t>(reinterpret_cast<uintptr_t>(name)); |
250 // We always set the in_loop bit to zero when generating the lookup code | 250 // We always set the in_loop bit to zero when generating the lookup code |
251 // so do it here too so the hash codes match. | 251 // so do it here too so the hash codes match. |
252 uint32_t iflags = | 252 uint32_t iflags = |
253 (static_cast<uint32_t>(flags) & ~Code::kFlagsICInLoopMask); | 253 (static_cast<uint32_t>(flags) & ~Code::kFlagsICInLoopMask); |
254 uint32_t key = seed - string_low32bits + iflags; | 254 uint32_t key = seed - string_low32bits + iflags; |
255 return key & ((kSecondaryTableSize - 1) << kHeapObjectTagSize); | 255 return key & ((kSecondaryTableSize - 1) << kHeapObjectTagSize); |
256 } | 256 } |
257 | 257 |
258 // Compute the entry for a given offset in exactly the same way as | 258 // Compute the entry for a given offset in exactly the same way as |
259 // we done in generated code. This makes it a lot easier to avoid | 259 // we do in generated code. We generate an hash code that already |
260 // making mistakes in the hashed offset computations. | 260 // ends in String::kHashShift 0s. Then we shift it so it is a multiple |
| 261 // of sizeof(Entry). This makes it easier to avoid making mistakes |
| 262 // in the hashed offset computations. |
261 static Entry* entry(Entry* table, int offset) { | 263 static Entry* entry(Entry* table, int offset) { |
| 264 const int shift_amount = kPointerSizeLog2 + 1 - String::kHashShift; |
262 return reinterpret_cast<Entry*>( | 265 return reinterpret_cast<Entry*>( |
263 reinterpret_cast<Address>(table) + (offset << 1)); | 266 reinterpret_cast<Address>(table) + (offset << shift_amount)); |
264 } | 267 } |
265 }; | 268 }; |
266 | 269 |
267 | 270 |
268 class SCTableReference { | 271 class SCTableReference { |
269 public: | 272 public: |
270 static SCTableReference keyReference(StubCache::Table table) { | 273 static SCTableReference keyReference(StubCache::Table table) { |
271 return SCTableReference( | 274 return SCTableReference( |
272 reinterpret_cast<Address>(&first_entry(table)->key)); | 275 reinterpret_cast<Address>(&first_entry(table)->key)); |
273 } | 276 } |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
552 | 555 |
553 const ParameterCount& arguments() { return arguments_; } | 556 const ParameterCount& arguments() { return arguments_; } |
554 | 557 |
555 Object* GetCode(PropertyType type, String* name); | 558 Object* GetCode(PropertyType type, String* name); |
556 }; | 559 }; |
557 | 560 |
558 | 561 |
559 } } // namespace v8::internal | 562 } } // namespace v8::internal |
560 | 563 |
561 #endif // V8_STUB_CACHE_H_ | 564 #endif // V8_STUB_CACHE_H_ |
OLD | NEW |