| 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 return string_->AsArrayIndex(index); | 70 return string_->AsArrayIndex(index); |
| 71 if (!is_one_byte_ || literal_bytes_.length() == 0 || | 71 if (!is_one_byte_ || literal_bytes_.length() == 0 || |
| 72 literal_bytes_.length() > String::kMaxArrayIndexSize) | 72 literal_bytes_.length() > String::kMaxArrayIndexSize) |
| 73 return false; | 73 return false; |
| 74 OneByteStringStream stream(literal_bytes_); | 74 OneByteStringStream stream(literal_bytes_); |
| 75 return StringToArrayIndex(&stream, index); | 75 return StringToArrayIndex(&stream, index); |
| 76 } | 76 } |
| 77 | 77 |
| 78 | 78 |
| 79 bool AstString::IsOneByteEqualTo(const char* data) const { | 79 bool AstString::IsOneByteEqualTo(const char* data) const { |
| 80 int length = strlen(data); | 80 int length = static_cast<int>(strlen(data)); |
| 81 if (is_one_byte_ && literal_bytes_.length() == length) { | 81 if (is_one_byte_ && literal_bytes_.length() == length) { |
| 82 const char* token = reinterpret_cast<const char*>(literal_bytes_.start()); | 82 const char* token = reinterpret_cast<const char*>(literal_bytes_.start()); |
| 83 return !strncmp(token, data, length); | 83 return !strncmp(token, data, length); |
| 84 } | 84 } |
| 85 return false; | 85 return false; |
| 86 } | 86 } |
| 87 | 87 |
| 88 | 88 |
| 89 void AstString::Internalize(Isolate* isolate) { | 89 void AstString::Internalize(Isolate* isolate) { |
| 90 if (!string_.is_null()) return; | 90 if (!string_.is_null()) return; |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 if (isolate_) { | 359 if (isolate_) { |
| 360 new_string[0].Internalize(isolate_); | 360 new_string[0].Internalize(isolate_); |
| 361 } | 361 } |
| 362 entry->value = reinterpret_cast<void*>(1); | 362 entry->value = reinterpret_cast<void*>(1); |
| 363 } | 363 } |
| 364 return reinterpret_cast<AstString*>(entry->key); | 364 return reinterpret_cast<AstString*>(entry->key); |
| 365 } | 365 } |
| 366 | 366 |
| 367 | 367 |
| 368 } } // namespace v8::internal | 368 } } // namespace v8::internal |
| OLD | NEW |