| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 9273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9284 if (is_index) is_index = hasher.UpdateIndex(c); | 9284 if (is_index) is_index = hasher.UpdateIndex(c); |
| 9285 } | 9285 } |
| 9286 } | 9286 } |
| 9287 *utf16_length_out = static_cast<int>(utf16_length); | 9287 *utf16_length_out = static_cast<int>(utf16_length); |
| 9288 // Must set length here so that hash computation is correct. | 9288 // Must set length here so that hash computation is correct. |
| 9289 hasher.length_ = utf16_length; | 9289 hasher.length_ = utf16_length; |
| 9290 return hasher.GetHashField(); | 9290 return hasher.GetHashField(); |
| 9291 } | 9291 } |
| 9292 | 9292 |
| 9293 | 9293 |
| 9294 MaybeObject* String::SubString(int start, int end, PretenureFlag pretenure) { | |
| 9295 Heap* heap = GetHeap(); | |
| 9296 if (start == 0 && end == length()) return this; | |
| 9297 MaybeObject* result = heap->AllocateSubString(this, start, end, pretenure); | |
| 9298 return result; | |
| 9299 } | |
| 9300 | |
| 9301 | |
| 9302 void String::PrintOn(FILE* file) { | 9294 void String::PrintOn(FILE* file) { |
| 9303 int length = this->length(); | 9295 int length = this->length(); |
| 9304 for (int i = 0; i < length; i++) { | 9296 for (int i = 0; i < length; i++) { |
| 9305 PrintF(file, "%c", Get(i)); | 9297 PrintF(file, "%c", Get(i)); |
| 9306 } | 9298 } |
| 9307 } | 9299 } |
| 9308 | 9300 |
| 9309 | 9301 |
| 9310 static void TrimEnumCache(Heap* heap, Map* map, DescriptorArray* descriptors) { | 9302 static void TrimEnumCache(Heap* heap, Map* map, DescriptorArray* descriptors) { |
| 9311 int live_enum = map->EnumLength(); | 9303 int live_enum = map->EnumLength(); |
| (...skipping 7084 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16396 #define ERROR_MESSAGES_TEXTS(C, T) T, | 16388 #define ERROR_MESSAGES_TEXTS(C, T) T, |
| 16397 static const char* error_messages_[] = { | 16389 static const char* error_messages_[] = { |
| 16398 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 16390 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
| 16399 }; | 16391 }; |
| 16400 #undef ERROR_MESSAGES_TEXTS | 16392 #undef ERROR_MESSAGES_TEXTS |
| 16401 return error_messages_[reason]; | 16393 return error_messages_[reason]; |
| 16402 } | 16394 } |
| 16403 | 16395 |
| 16404 | 16396 |
| 16405 } } // namespace v8::internal | 16397 } } // namespace v8::internal |
| OLD | NEW |