| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 } | 390 } |
| 391 entry->value = reinterpret_cast<void*>(1); | 391 entry->value = reinterpret_cast<void*>(1); |
| 392 } | 392 } |
| 393 return reinterpret_cast<AstRawString*>(entry->key); | 393 return reinterpret_cast<AstRawString*>(entry->key); |
| 394 } | 394 } |
| 395 | 395 |
| 396 | 396 |
| 397 bool AstValueFactory::AstRawStringCompare(void* a, void* b) { | 397 bool AstValueFactory::AstRawStringCompare(void* a, void* b) { |
| 398 const AstRawString* lhs = static_cast<AstRawString*>(a); | 398 const AstRawString* lhs = static_cast<AstRawString*>(a); |
| 399 const AstRawString* rhs = static_cast<AstRawString*>(b); | 399 const AstRawString* rhs = static_cast<AstRawString*>(b); |
| 400 DCHECK_EQ(lhs->hash(), rhs->hash()); |
| 400 if (lhs->length() != rhs->length()) return false; | 401 if (lhs->length() != rhs->length()) return false; |
| 401 if (lhs->hash() != rhs->hash()) return false; | |
| 402 const unsigned char* l = lhs->raw_data(); | 402 const unsigned char* l = lhs->raw_data(); |
| 403 const unsigned char* r = rhs->raw_data(); | 403 const unsigned char* r = rhs->raw_data(); |
| 404 size_t length = rhs->length(); | 404 size_t length = rhs->length(); |
| 405 if (lhs->is_one_byte()) { | 405 if (lhs->is_one_byte()) { |
| 406 if (rhs->is_one_byte()) { | 406 if (rhs->is_one_byte()) { |
| 407 return CompareCharsUnsigned(reinterpret_cast<const uint8_t*>(l), | 407 return CompareCharsUnsigned(reinterpret_cast<const uint8_t*>(l), |
| 408 reinterpret_cast<const uint8_t*>(r), | 408 reinterpret_cast<const uint8_t*>(r), |
| 409 length) == 0; | 409 length) == 0; |
| 410 } else { | 410 } else { |
| 411 return CompareCharsUnsigned(reinterpret_cast<const uint8_t*>(l), | 411 return CompareCharsUnsigned(reinterpret_cast<const uint8_t*>(l), |
| 412 reinterpret_cast<const uint16_t*>(r), | 412 reinterpret_cast<const uint16_t*>(r), |
| 413 length) == 0; | 413 length) == 0; |
| 414 } | 414 } |
| 415 } else { | 415 } else { |
| 416 if (rhs->is_one_byte()) { | 416 if (rhs->is_one_byte()) { |
| 417 return CompareCharsUnsigned(reinterpret_cast<const uint16_t*>(l), | 417 return CompareCharsUnsigned(reinterpret_cast<const uint16_t*>(l), |
| 418 reinterpret_cast<const uint8_t*>(r), | 418 reinterpret_cast<const uint8_t*>(r), |
| 419 length) == 0; | 419 length) == 0; |
| 420 } else { | 420 } else { |
| 421 return CompareCharsUnsigned(reinterpret_cast<const uint16_t*>(l), | 421 return CompareCharsUnsigned(reinterpret_cast<const uint16_t*>(l), |
| 422 reinterpret_cast<const uint16_t*>(r), | 422 reinterpret_cast<const uint16_t*>(r), |
| 423 length) == 0; | 423 length) == 0; |
| 424 } | 424 } |
| 425 } | 425 } |
| 426 } | 426 } |
| 427 } // namespace internal | 427 } // namespace internal |
| 428 } // namespace v8 | 428 } // namespace v8 |
| OLD | NEW |