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 9280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9291 if (is_index) is_index = hasher.UpdateIndex(c); | 9291 if (is_index) is_index = hasher.UpdateIndex(c); |
9292 } | 9292 } |
9293 } | 9293 } |
9294 *utf16_length_out = static_cast<int>(utf16_length); | 9294 *utf16_length_out = static_cast<int>(utf16_length); |
9295 // Must set length here so that hash computation is correct. | 9295 // Must set length here so that hash computation is correct. |
9296 hasher.length_ = utf16_length; | 9296 hasher.length_ = utf16_length; |
9297 return hasher.GetHashField(); | 9297 return hasher.GetHashField(); |
9298 } | 9298 } |
9299 | 9299 |
9300 | 9300 |
9301 MaybeObject* String::SubString(int start, int end, PretenureFlag pretenure) { | |
9302 Heap* heap = GetHeap(); | |
9303 if (start == 0 && end == length()) return this; | |
9304 MaybeObject* result = heap->AllocateSubString(this, start, end, pretenure); | |
9305 return result; | |
9306 } | |
9307 | |
9308 | |
9309 void String::PrintOn(FILE* file) { | 9301 void String::PrintOn(FILE* file) { |
9310 int length = this->length(); | 9302 int length = this->length(); |
9311 for (int i = 0; i < length; i++) { | 9303 for (int i = 0; i < length; i++) { |
9312 PrintF(file, "%c", Get(i)); | 9304 PrintF(file, "%c", Get(i)); |
9313 } | 9305 } |
9314 } | 9306 } |
9315 | 9307 |
9316 | 9308 |
9317 static void TrimEnumCache(Heap* heap, Map* map, DescriptorArray* descriptors) { | 9309 static void TrimEnumCache(Heap* heap, Map* map, DescriptorArray* descriptors) { |
9318 int live_enum = map->EnumLength(); | 9310 int live_enum = map->EnumLength(); |
(...skipping 7345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16664 #define ERROR_MESSAGES_TEXTS(C, T) T, | 16656 #define ERROR_MESSAGES_TEXTS(C, T) T, |
16665 static const char* error_messages_[] = { | 16657 static const char* error_messages_[] = { |
16666 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 16658 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
16667 }; | 16659 }; |
16668 #undef ERROR_MESSAGES_TEXTS | 16660 #undef ERROR_MESSAGES_TEXTS |
16669 return error_messages_[reason]; | 16661 return error_messages_[reason]; |
16670 } | 16662 } |
16671 | 16663 |
16672 | 16664 |
16673 } } // namespace v8::internal | 16665 } } // namespace v8::internal |
OLD | NEW |