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 8347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14805 // Handle last resort GC and make sure to allow future allocations | 14805 // Handle last resort GC and make sure to allow future allocations |
14806 // to grow the heap without causing GCs (if possible). | 14806 // to grow the heap without causing GCs (if possible). |
14807 isolate->counters()->gc_last_resort_from_js()->Increment(); | 14807 isolate->counters()->gc_last_resort_from_js()->Increment(); |
14808 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 14808 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
14809 "Runtime::PerformGC"); | 14809 "Runtime::PerformGC"); |
14810 } | 14810 } |
14811 } | 14811 } |
14812 | 14812 |
14813 | 14813 |
14814 } } // namespace v8::internal | 14814 } } // namespace v8::internal |
OLD | NEW |