| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 6426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6437 reinterpret_cast<char*>(result->GetChars()), | 6437 reinterpret_cast<char*>(result->GetChars()), |
| 6438 reinterpret_cast<char*>(SeqOneByteString::cast(s)->GetChars()), | 6438 reinterpret_cast<char*>(SeqOneByteString::cast(s)->GetChars()), |
| 6439 length, | 6439 length, |
| 6440 &has_changed_character); | 6440 &has_changed_character); |
| 6441 // If not ASCII, we discard the result and take the 2 byte path. | 6441 // If not ASCII, we discard the result and take the 2 byte path. |
| 6442 if (is_ascii) { | 6442 if (is_ascii) { |
| 6443 return has_changed_character ? result : s; | 6443 return has_changed_character ? result : s; |
| 6444 } | 6444 } |
| 6445 } | 6445 } |
| 6446 | 6446 |
| 6447 String::Encoding result_encoding = s->IsOneByteRepresentationUnderneath() | 6447 String::Encoding result_encoding = s->IsOneByteRepresentation() |
| 6448 ? String::ONE_BYTE_ENCODING : String::TWO_BYTE_ENCODING; | 6448 ? String::ONE_BYTE_ENCODING : String::TWO_BYTE_ENCODING; |
| 6449 Object* answer; | 6449 Object* answer; |
| 6450 { MaybeObject* maybe_answer = ConvertCaseHelper( | 6450 { MaybeObject* maybe_answer = ConvertCaseHelper( |
| 6451 isolate, s, result_encoding, length, length, mapping); | 6451 isolate, s, result_encoding, length, length, mapping); |
| 6452 if (!maybe_answer->ToObject(&answer)) return maybe_answer; | 6452 if (!maybe_answer->ToObject(&answer)) return maybe_answer; |
| 6453 } | 6453 } |
| 6454 if (answer->IsSmi()) { | 6454 if (answer->IsSmi()) { |
| 6455 int new_length = Smi::cast(answer)->value(); | 6455 int new_length = Smi::cast(answer)->value(); |
| 6456 if (new_length < 0) { | 6456 if (new_length < 0) { |
| 6457 result_encoding = String::TWO_BYTE_ENCODING; | 6457 result_encoding = String::TWO_BYTE_ENCODING; |
| (...skipping 8352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14810 // Handle last resort GC and make sure to allow future allocations | 14810 // Handle last resort GC and make sure to allow future allocations |
| 14811 // to grow the heap without causing GCs (if possible). | 14811 // to grow the heap without causing GCs (if possible). |
| 14812 isolate->counters()->gc_last_resort_from_js()->Increment(); | 14812 isolate->counters()->gc_last_resort_from_js()->Increment(); |
| 14813 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 14813 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
| 14814 "Runtime::PerformGC"); | 14814 "Runtime::PerformGC"); |
| 14815 } | 14815 } |
| 14816 } | 14816 } |
| 14817 | 14817 |
| 14818 | 14818 |
| 14819 } } // namespace v8::internal | 14819 } } // namespace v8::internal |
| OLD | NEW |