| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 2829 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2840 if (is_ascii) { | 2840 if (is_ascii) { |
| 2841 Object* result; | 2841 Object* result; |
| 2842 { MaybeObject* maybe_result = AllocateRawAsciiString(length); | 2842 { MaybeObject* maybe_result = AllocateRawAsciiString(length); |
| 2843 if (!maybe_result->ToObject(&result)) return maybe_result; | 2843 if (!maybe_result->ToObject(&result)) return maybe_result; |
| 2844 } | 2844 } |
| 2845 // Copy the characters into the new object. | 2845 // Copy the characters into the new object. |
| 2846 char* dest = SeqAsciiString::cast(result)->GetChars(); | 2846 char* dest = SeqAsciiString::cast(result)->GetChars(); |
| 2847 // Copy first part. | 2847 // Copy first part. |
| 2848 const char* src; | 2848 const char* src; |
| 2849 if (first->IsExternalString()) { | 2849 if (first->IsExternalString()) { |
| 2850 src = ExternalAsciiString::cast(first)->resource()->data(); | 2850 src = ExternalAsciiString::cast(first)->GetChars(); |
| 2851 } else { | 2851 } else { |
| 2852 src = SeqAsciiString::cast(first)->GetChars(); | 2852 src = SeqAsciiString::cast(first)->GetChars(); |
| 2853 } | 2853 } |
| 2854 for (int i = 0; i < first_length; i++) *dest++ = src[i]; | 2854 for (int i = 0; i < first_length; i++) *dest++ = src[i]; |
| 2855 // Copy second part. | 2855 // Copy second part. |
| 2856 if (second->IsExternalString()) { | 2856 if (second->IsExternalString()) { |
| 2857 src = ExternalAsciiString::cast(second)->resource()->data(); | 2857 src = ExternalAsciiString::cast(second)->GetChars(); |
| 2858 } else { | 2858 } else { |
| 2859 src = SeqAsciiString::cast(second)->GetChars(); | 2859 src = SeqAsciiString::cast(second)->GetChars(); |
| 2860 } | 2860 } |
| 2861 for (int i = 0; i < second_length; i++) *dest++ = src[i]; | 2861 for (int i = 0; i < second_length; i++) *dest++ = src[i]; |
| 2862 return result; | 2862 return result; |
| 2863 } else { | 2863 } else { |
| 2864 if (is_ascii_data_in_two_byte_string) { | 2864 if (is_ascii_data_in_two_byte_string) { |
| 2865 Object* result; | 2865 Object* result; |
| 2866 { MaybeObject* maybe_result = AllocateRawAsciiString(length); | 2866 { MaybeObject* maybe_result = AllocateRawAsciiString(length); |
| 2867 if (!maybe_result->ToObject(&result)) return maybe_result; | 2867 if (!maybe_result->ToObject(&result)) return maybe_result; |
| (...skipping 3590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6458 isolate_->heap()->store_buffer()->Compact(); | 6458 isolate_->heap()->store_buffer()->Compact(); |
| 6459 isolate_->heap()->store_buffer()->Filter(MemoryChunk::ABOUT_TO_BE_FREED); | 6459 isolate_->heap()->store_buffer()->Filter(MemoryChunk::ABOUT_TO_BE_FREED); |
| 6460 for (chunk = chunks_queued_for_free_; chunk != NULL; chunk = next) { | 6460 for (chunk = chunks_queued_for_free_; chunk != NULL; chunk = next) { |
| 6461 next = chunk->next_chunk(); | 6461 next = chunk->next_chunk(); |
| 6462 isolate_->memory_allocator()->Free(chunk); | 6462 isolate_->memory_allocator()->Free(chunk); |
| 6463 } | 6463 } |
| 6464 chunks_queued_for_free_ = NULL; | 6464 chunks_queued_for_free_ = NULL; |
| 6465 } | 6465 } |
| 6466 | 6466 |
| 6467 } } // namespace v8::internal | 6467 } } // namespace v8::internal |
| OLD | NEW |