OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 3066 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3077 String* result = String::cast(o); | 3077 String* result = String::cast(o); |
3078 bool has_changed_character = false; | 3078 bool has_changed_character = false; |
3079 | 3079 |
3080 // Convert all characters to upper case, assuming that they will fit | 3080 // Convert all characters to upper case, assuming that they will fit |
3081 // in the buffer | 3081 // in the buffer |
3082 Access<StringInputBuffer> buffer(&runtime_string_input_buffer); | 3082 Access<StringInputBuffer> buffer(&runtime_string_input_buffer); |
3083 buffer->Reset(s); | 3083 buffer->Reset(s); |
3084 unibrow::uchar chars[Converter::kMaxWidth]; | 3084 unibrow::uchar chars[Converter::kMaxWidth]; |
3085 // We can assume that the string is not empty | 3085 // We can assume that the string is not empty |
3086 uc32 current = buffer->GetNext(); | 3086 uc32 current = buffer->GetNext(); |
3087 for (int i = 0; i < length; ) { | 3087 for (int i = 0; i < length;) { |
3088 bool has_next = buffer->has_more(); | 3088 bool has_next = buffer->has_more(); |
3089 uc32 next = has_next ? buffer->GetNext() : 0; | 3089 uc32 next = has_next ? buffer->GetNext() : 0; |
3090 int char_length = mapping->get(current, next, chars); | 3090 int char_length = mapping->get(current, next, chars); |
3091 if (char_length == 0) { | 3091 if (char_length == 0) { |
3092 // The case conversion of this character is the character itself. | 3092 // The case conversion of this character is the character itself. |
3093 result->Set(i, current); | 3093 result->Set(i, current); |
3094 i++; | 3094 i++; |
3095 } else if (char_length == 1) { | 3095 } else if (char_length == 1) { |
3096 // Common case: converting the letter resulted in one character. | 3096 // Common case: converting the letter resulted in one character. |
3097 ASSERT(static_cast<uc32>(chars[0]) != current); | 3097 ASSERT(static_cast<uc32>(chars[0]) != current); |
(...skipping 3542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6640 } else { | 6640 } else { |
6641 // Handle last resort GC and make sure to allow future allocations | 6641 // Handle last resort GC and make sure to allow future allocations |
6642 // to grow the heap without causing GCs (if possible). | 6642 // to grow the heap without causing GCs (if possible). |
6643 Counters::gc_last_resort_from_js.Increment(); | 6643 Counters::gc_last_resort_from_js.Increment(); |
6644 Heap::CollectAllGarbage(); | 6644 Heap::CollectAllGarbage(); |
6645 } | 6645 } |
6646 } | 6646 } |
6647 | 6647 |
6648 | 6648 |
6649 } } // namespace v8::internal | 6649 } } // namespace v8::internal |
OLD | NEW |