| 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 3576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3587 static bool BoundsCheckKeyMatch(void* key1, void* key2) { | 3587 static bool BoundsCheckKeyMatch(void* key1, void* key2) { |
| 3588 BoundsCheckKey* k1 = static_cast<BoundsCheckKey*>(key1); | 3588 BoundsCheckKey* k1 = static_cast<BoundsCheckKey*>(key1); |
| 3589 BoundsCheckKey* k2 = static_cast<BoundsCheckKey*>(key2); | 3589 BoundsCheckKey* k2 = static_cast<BoundsCheckKey*>(key2); |
| 3590 return k1->IndexBase() == k2->IndexBase() && k1->Length() == k2->Length(); | 3590 return k1->IndexBase() == k2->IndexBase() && k1->Length() == k2->Length(); |
| 3591 } | 3591 } |
| 3592 | 3592 |
| 3593 | 3593 |
| 3594 class BoundsCheckTable : private ZoneHashMap { | 3594 class BoundsCheckTable : private ZoneHashMap { |
| 3595 public: | 3595 public: |
| 3596 BoundsCheckBbData** LookupOrInsert(BoundsCheckKey* key, Zone* zone) { | 3596 BoundsCheckBbData** LookupOrInsert(BoundsCheckKey* key, Zone* zone) { |
| 3597 return reinterpret_cast<BoundsCheckBbData**>( | 3597 // Avoid type-punning compiler warnings. |
| 3598 &(Lookup(key, key->Hash(), true, ZoneAllocationPolicy(zone))->value)); | 3598 union { |
| 3599 void** in; |
| 3600 BoundsCheckBbData** out; |
| 3601 } u; |
| 3602 u.in = &(Lookup(key, key->Hash(), true, ZoneAllocationPolicy(zone))->value); |
| 3603 return u.out; |
| 3599 } | 3604 } |
| 3600 | 3605 |
| 3601 void Insert(BoundsCheckKey* key, BoundsCheckBbData* data, Zone* zone) { | 3606 void Insert(BoundsCheckKey* key, BoundsCheckBbData* data, Zone* zone) { |
| 3602 Lookup(key, key->Hash(), true, ZoneAllocationPolicy(zone))->value = data; | 3607 Lookup(key, key->Hash(), true, ZoneAllocationPolicy(zone))->value = data; |
| 3603 } | 3608 } |
| 3604 | 3609 |
| 3605 void Delete(BoundsCheckKey* key) { | 3610 void Delete(BoundsCheckKey* key) { |
| 3606 Remove(key, key->Hash()); | 3611 Remove(key, key->Hash()); |
| 3607 } | 3612 } |
| 3608 | 3613 |
| (...skipping 6507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10116 } | 10121 } |
| 10117 } | 10122 } |
| 10118 | 10123 |
| 10119 #ifdef DEBUG | 10124 #ifdef DEBUG |
| 10120 if (graph_ != NULL) graph_->Verify(false); // No full verify. | 10125 if (graph_ != NULL) graph_->Verify(false); // No full verify. |
| 10121 if (allocator_ != NULL) allocator_->Verify(); | 10126 if (allocator_ != NULL) allocator_->Verify(); |
| 10122 #endif | 10127 #endif |
| 10123 } | 10128 } |
| 10124 | 10129 |
| 10125 } } // namespace v8::internal | 10130 } } // namespace v8::internal |
| OLD | NEW |