| 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 2930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2941 // can't use the fast case code for short ASCII strings below, but | 2941 // can't use the fast case code for short ASCII strings below, but |
| 2942 // we can try to save memory if all chars actually fit in ASCII. | 2942 // we can try to save memory if all chars actually fit in ASCII. |
| 2943 is_ascii_data_in_two_byte_string = | 2943 is_ascii_data_in_two_byte_string = |
| 2944 first->HasOnlyAsciiChars() && second->HasOnlyAsciiChars(); | 2944 first->HasOnlyAsciiChars() && second->HasOnlyAsciiChars(); |
| 2945 if (is_ascii_data_in_two_byte_string) { | 2945 if (is_ascii_data_in_two_byte_string) { |
| 2946 isolate_->counters()->string_add_runtime_ext_to_ascii()->Increment(); | 2946 isolate_->counters()->string_add_runtime_ext_to_ascii()->Increment(); |
| 2947 } | 2947 } |
| 2948 } | 2948 } |
| 2949 | 2949 |
| 2950 // If the resulting string is small make a flat string. | 2950 // If the resulting string is small make a flat string. |
| 2951 if (length < String::kMinNonFlatLength) { | 2951 if (length < ConsString::kMinLength) { |
| 2952 // Note that neither of the two inputs can be a slice because: | 2952 // Note that neither of the two inputs can be a slice because: |
| 2953 STATIC_ASSERT(String::kMinNonFlatLength <= SlicedString::kMinLength); | 2953 STATIC_ASSERT(ConsString::kMinLength <= SlicedString::kMinLength); |
| 2954 ASSERT(first->IsFlat()); | 2954 ASSERT(first->IsFlat()); |
| 2955 ASSERT(second->IsFlat()); | 2955 ASSERT(second->IsFlat()); |
| 2956 if (is_ascii) { | 2956 if (is_ascii) { |
| 2957 Object* result; | 2957 Object* result; |
| 2958 { MaybeObject* maybe_result = AllocateRawAsciiString(length); | 2958 { MaybeObject* maybe_result = AllocateRawAsciiString(length); |
| 2959 if (!maybe_result->ToObject(&result)) return maybe_result; | 2959 if (!maybe_result->ToObject(&result)) return maybe_result; |
| 2960 } | 2960 } |
| 2961 // Copy the characters into the new object. | 2961 // Copy the characters into the new object. |
| 2962 char* dest = SeqAsciiString::cast(result)->GetChars(); | 2962 char* dest = SeqAsciiString::cast(result)->GetChars(); |
| 2963 // Copy first part. | 2963 // Copy first part. |
| (...skipping 3705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6669 isolate_->heap()->store_buffer()->Compact(); | 6669 isolate_->heap()->store_buffer()->Compact(); |
| 6670 isolate_->heap()->store_buffer()->Filter(MemoryChunk::ABOUT_TO_BE_FREED); | 6670 isolate_->heap()->store_buffer()->Filter(MemoryChunk::ABOUT_TO_BE_FREED); |
| 6671 for (chunk = chunks_queued_for_free_; chunk != NULL; chunk = next) { | 6671 for (chunk = chunks_queued_for_free_; chunk != NULL; chunk = next) { |
| 6672 next = chunk->next_chunk(); | 6672 next = chunk->next_chunk(); |
| 6673 isolate_->memory_allocator()->Free(chunk); | 6673 isolate_->memory_allocator()->Free(chunk); |
| 6674 } | 6674 } |
| 6675 chunks_queued_for_free_ = NULL; | 6675 chunks_queued_for_free_ = NULL; |
| 6676 } | 6676 } |
| 6677 | 6677 |
| 6678 } } // namespace v8::internal | 6678 } } // namespace v8::internal |
| OLD | NEW |