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 9285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9296 if (is_index) is_index = hasher.UpdateIndex(c); | 9296 if (is_index) is_index = hasher.UpdateIndex(c); |
9297 } | 9297 } |
9298 } | 9298 } |
9299 *utf16_length_out = static_cast<int>(utf16_length); | 9299 *utf16_length_out = static_cast<int>(utf16_length); |
9300 // Must set length here so that hash computation is correct. | 9300 // Must set length here so that hash computation is correct. |
9301 hasher.length_ = utf16_length; | 9301 hasher.length_ = utf16_length; |
9302 return hasher.GetHashField(); | 9302 return hasher.GetHashField(); |
9303 } | 9303 } |
9304 | 9304 |
9305 | 9305 |
| 9306 MaybeObject* String::SubString(int start, int end, PretenureFlag pretenure) { |
| 9307 Heap* heap = GetHeap(); |
| 9308 if (start == 0 && end == length()) return this; |
| 9309 MaybeObject* result = heap->AllocateSubString(this, start, end, pretenure); |
| 9310 return result; |
| 9311 } |
| 9312 |
| 9313 |
9306 void String::PrintOn(FILE* file) { | 9314 void String::PrintOn(FILE* file) { |
9307 int length = this->length(); | 9315 int length = this->length(); |
9308 for (int i = 0; i < length; i++) { | 9316 for (int i = 0; i < length; i++) { |
9309 PrintF(file, "%c", Get(i)); | 9317 PrintF(file, "%c", Get(i)); |
9310 } | 9318 } |
9311 } | 9319 } |
9312 | 9320 |
9313 | 9321 |
9314 static void TrimEnumCache(Heap* heap, Map* map, DescriptorArray* descriptors) { | 9322 static void TrimEnumCache(Heap* heap, Map* map, DescriptorArray* descriptors) { |
9315 int live_enum = map->EnumLength(); | 9323 int live_enum = map->EnumLength(); |
(...skipping 7162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16478 #define ERROR_MESSAGES_TEXTS(C, T) T, | 16486 #define ERROR_MESSAGES_TEXTS(C, T) T, |
16479 static const char* error_messages_[] = { | 16487 static const char* error_messages_[] = { |
16480 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 16488 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
16481 }; | 16489 }; |
16482 #undef ERROR_MESSAGES_TEXTS | 16490 #undef ERROR_MESSAGES_TEXTS |
16483 return error_messages_[reason]; | 16491 return error_messages_[reason]; |
16484 } | 16492 } |
16485 | 16493 |
16486 | 16494 |
16487 } } // namespace v8::internal | 16495 } } // namespace v8::internal |
OLD | NEW |