| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 2426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2437 : Heap::AllocateRawTwoByteString(length); | 2437 : Heap::AllocateRawTwoByteString(length); |
| 2438 if (o->IsFailure()) return o; | 2438 if (o->IsFailure()) return o; |
| 2439 String* result = String::cast(o); | 2439 String* result = String::cast(o); |
| 2440 StringShape result_shape(result); | 2440 StringShape result_shape(result); |
| 2441 bool has_changed_character = false; | 2441 bool has_changed_character = false; |
| 2442 | 2442 |
| 2443 // Convert all characters to upper case, assuming that they will fit | 2443 // Convert all characters to upper case, assuming that they will fit |
| 2444 // in the buffer | 2444 // in the buffer |
| 2445 Access<StringInputBuffer> buffer(&string_input_buffer); | 2445 Access<StringInputBuffer> buffer(&string_input_buffer); |
| 2446 buffer->Reset(s); | 2446 buffer->Reset(s); |
| 2447 unibrow::uchar chars[unibrow::kMaxMappingSize]; | 2447 unibrow::uchar chars[Converter::kMaxWidth]; |
| 2448 int i = 0; | 2448 int i = 0; |
| 2449 // We can assume that the string is not empty | 2449 // We can assume that the string is not empty |
| 2450 uc32 current = buffer->GetNext(); | 2450 uc32 current = buffer->GetNext(); |
| 2451 while (i < length) { | 2451 while (i < length) { |
| 2452 bool has_next = buffer->has_more(); | 2452 bool has_next = buffer->has_more(); |
| 2453 uc32 next = has_next ? buffer->GetNext() : 0; | 2453 uc32 next = has_next ? buffer->GetNext() : 0; |
| 2454 int char_length = mapping->get(current, next, chars); | 2454 int char_length = mapping->get(current, next, chars); |
| 2455 if (char_length == 0) { | 2455 if (char_length == 0) { |
| 2456 // The case conversion of this character is the character itself. | 2456 // The case conversion of this character is the character itself. |
| 2457 result->Set(result_shape, i, current); | 2457 result->Set(result_shape, i, current); |
| (...skipping 3414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5872 } else { | 5872 } else { |
| 5873 // Handle last resort GC and make sure to allow future allocations | 5873 // Handle last resort GC and make sure to allow future allocations |
| 5874 // to grow the heap without causing GCs (if possible). | 5874 // to grow the heap without causing GCs (if possible). |
| 5875 Counters::gc_last_resort_from_js.Increment(); | 5875 Counters::gc_last_resort_from_js.Increment(); |
| 5876 Heap::CollectAllGarbage(); | 5876 Heap::CollectAllGarbage(); |
| 5877 } | 5877 } |
| 5878 } | 5878 } |
| 5879 | 5879 |
| 5880 | 5880 |
| 5881 } } // namespace v8::internal | 5881 } } // namespace v8::internal |
| OLD | NEW |