| 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 6483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6494 // NOTE: This assumes that the upper/lower case of an ASCII | 6494 // NOTE: This assumes that the upper/lower case of an ASCII |
| 6495 // character is also ASCII. This is currently the case, but it | 6495 // character is also ASCII. This is currently the case, but it |
| 6496 // might break in the future if we implement more context and locale | 6496 // might break in the future if we implement more context and locale |
| 6497 // dependent upper/lower conversions. | 6497 // dependent upper/lower conversions. |
| 6498 if (s->IsSeqOneByteString()) { | 6498 if (s->IsSeqOneByteString()) { |
| 6499 Object* o; | 6499 Object* o; |
| 6500 { MaybeObject* maybe_o = isolate->heap()->AllocateRawOneByteString(length); | 6500 { MaybeObject* maybe_o = isolate->heap()->AllocateRawOneByteString(length); |
| 6501 if (!maybe_o->ToObject(&o)) return maybe_o; | 6501 if (!maybe_o->ToObject(&o)) return maybe_o; |
| 6502 } | 6502 } |
| 6503 SeqOneByteString* result = SeqOneByteString::cast(o); | 6503 SeqOneByteString* result = SeqOneByteString::cast(o); |
| 6504 bool has_changed_character; | 6504 bool has_changed_character = false; |
| 6505 bool is_ascii = FastAsciiConvert<Converter>( | 6505 bool is_ascii = FastAsciiConvert<Converter>( |
| 6506 reinterpret_cast<char*>(result->GetChars()), | 6506 reinterpret_cast<char*>(result->GetChars()), |
| 6507 reinterpret_cast<char*>(SeqOneByteString::cast(s)->GetChars()), | 6507 reinterpret_cast<char*>(SeqOneByteString::cast(s)->GetChars()), |
| 6508 length, | 6508 length, |
| 6509 &has_changed_character); | 6509 &has_changed_character); |
| 6510 // If not ASCII, we discard the result and take the 2 byte path. | 6510 // If not ASCII, we discard the result and take the 2 byte path. |
| 6511 if (is_ascii) { | 6511 if (is_ascii) { |
| 6512 return has_changed_character ? result : s; | 6512 return has_changed_character ? result : s; |
| 6513 } | 6513 } |
| 6514 } | 6514 } |
| (...skipping 8387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14902 // Handle last resort GC and make sure to allow future allocations | 14902 // Handle last resort GC and make sure to allow future allocations |
| 14903 // to grow the heap without causing GCs (if possible). | 14903 // to grow the heap without causing GCs (if possible). |
| 14904 isolate->counters()->gc_last_resort_from_js()->Increment(); | 14904 isolate->counters()->gc_last_resort_from_js()->Increment(); |
| 14905 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 14905 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
| 14906 "Runtime::PerformGC"); | 14906 "Runtime::PerformGC"); |
| 14907 } | 14907 } |
| 14908 } | 14908 } |
| 14909 | 14909 |
| 14910 | 14910 |
| 14911 } } // namespace v8::internal | 14911 } } // namespace v8::internal |
| OLD | NEW |