| 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 4793 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4804 *data++ = *ascii_data++; | 4804 *data++ = *ascii_data++; |
| 4805 } | 4805 } |
| 4806 } | 4806 } |
| 4807 // Now write the remainder. | 4807 // Now write the remainder. |
| 4808 decoder->WriteUtf16(data, utf16_length); | 4808 decoder->WriteUtf16(data, utf16_length); |
| 4809 return result; | 4809 return result; |
| 4810 } | 4810 } |
| 4811 | 4811 |
| 4812 | 4812 |
| 4813 MaybeObject* Heap::AllocateStringFromTwoByte(Vector<const uc16> string, | 4813 MaybeObject* Heap::AllocateStringFromTwoByte(Vector<const uc16> string, |
| 4814 bool check_for_one_byte, |
| 4814 PretenureFlag pretenure) { | 4815 PretenureFlag pretenure) { |
| 4815 // Check if the string is an ASCII string. | 4816 // Check if the string is an ASCII string. |
| 4816 Object* result; | 4817 Object* result; |
| 4817 int length = string.length(); | 4818 int length = string.length(); |
| 4818 const uc16* start = string.start(); | 4819 const uc16* start = string.start(); |
| 4819 | 4820 |
| 4820 if (String::IsOneByte(start, length)) { | 4821 if (check_for_one_byte && String::IsOneByte(start, length)) { |
| 4821 MaybeObject* maybe_result = AllocateRawOneByteString(length, pretenure); | 4822 MaybeObject* maybe_result = AllocateRawOneByteString(length, pretenure); |
| 4822 if (!maybe_result->ToObject(&result)) return maybe_result; | 4823 if (!maybe_result->ToObject(&result)) return maybe_result; |
| 4823 CopyChars(SeqOneByteString::cast(result)->GetChars(), start, length); | 4824 CopyChars(SeqOneByteString::cast(result)->GetChars(), start, length); |
| 4824 } else { // It's not a one byte string. | 4825 } else { // It's not a one byte string. |
| 4825 MaybeObject* maybe_result = AllocateRawTwoByteString(length, pretenure); | 4826 MaybeObject* maybe_result = AllocateRawTwoByteString(length, pretenure); |
| 4826 if (!maybe_result->ToObject(&result)) return maybe_result; | 4827 if (!maybe_result->ToObject(&result)) return maybe_result; |
| 4827 CopyChars(SeqTwoByteString::cast(result)->GetChars(), start, length); | 4828 CopyChars(SeqTwoByteString::cast(result)->GetChars(), start, length); |
| 4828 } | 4829 } |
| 4829 return result; | 4830 return result; |
| 4830 } | 4831 } |
| (...skipping 2883 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7714 static_cast<int>(object_sizes_last_time_[index])); | 7715 static_cast<int>(object_sizes_last_time_[index])); |
| 7715 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 7716 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) |
| 7716 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 7717 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
| 7717 | 7718 |
| 7718 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 7719 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
| 7719 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 7720 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
| 7720 ClearObjectStats(); | 7721 ClearObjectStats(); |
| 7721 } | 7722 } |
| 7722 | 7723 |
| 7723 } } // namespace v8::internal | 7724 } } // namespace v8::internal |
| OLD | NEW |