| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 literal_bytes_(lb), pos_(0) {} | 42 literal_bytes_(lb), pos_(0) {} |
| 43 | 43 |
| 44 bool HasMore() { return pos_ < literal_bytes_.length(); } | 44 bool HasMore() { return pos_ < literal_bytes_.length(); } |
| 45 uint16_t GetNext() { return literal_bytes_[pos_++]; } | 45 uint16_t GetNext() { return literal_bytes_[pos_++]; } |
| 46 | 46 |
| 47 private: | 47 private: |
| 48 Vector<const byte> literal_bytes_; | 48 Vector<const byte> literal_bytes_; |
| 49 int pos_; | 49 int pos_; |
| 50 }; | 50 }; |
| 51 | 51 |
| 52 } | 52 } // namespace |
| 53 | 53 |
| 54 class AstRawStringInternalizationKey : public HashTableKey { | 54 class AstRawStringInternalizationKey : public HashTableKey { |
| 55 public: | 55 public: |
| 56 explicit AstRawStringInternalizationKey(const AstRawString* string) | 56 explicit AstRawStringInternalizationKey(const AstRawString* string) |
| 57 : string_(string) {} | 57 : string_(string) {} |
| 58 | 58 |
| 59 bool IsMatch(Object* other) override { | 59 bool IsMatch(Object* other) override { |
| 60 if (string_->is_one_byte_) | 60 if (string_->is_one_byte_) |
| 61 return String::cast(other)->IsOneByteEqualTo(string_->literal_bytes_); | 61 return String::cast(other)->IsOneByteEqualTo(string_->literal_bytes_); |
| 62 return String::cast(other)->IsTwoByteEqualTo( | 62 return String::cast(other)->IsTwoByteEqualTo( |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 const AstRawString* lhs = static_cast<AstRawString*>(a); | 380 const AstRawString* lhs = static_cast<AstRawString*>(a); |
| 381 const AstRawString* rhs = static_cast<AstRawString*>(b); | 381 const AstRawString* rhs = static_cast<AstRawString*>(b); |
| 382 if (lhs->is_one_byte() != rhs->is_one_byte()) return false; | 382 if (lhs->is_one_byte() != rhs->is_one_byte()) return false; |
| 383 if (lhs->hash() != rhs->hash()) return false; | 383 if (lhs->hash() != rhs->hash()) return false; |
| 384 int len = lhs->byte_length(); | 384 int len = lhs->byte_length(); |
| 385 if (rhs->byte_length() != len) return false; | 385 if (rhs->byte_length() != len) return false; |
| 386 return memcmp(lhs->raw_data(), rhs->raw_data(), len) == 0; | 386 return memcmp(lhs->raw_data(), rhs->raw_data(), len) == 0; |
| 387 } | 387 } |
| 388 } // namespace internal | 388 } // namespace internal |
| 389 } // namespace v8 | 389 } // namespace v8 |
| OLD | NEW |