Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Side by Side Diff: src/heap.cc

Issue 9231017: Recursion limit for one-char string replace and retire String::kMinNonFlatLength. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « src/arm/code-stubs-arm.cc ('k') | src/ia32/code-stubs-ia32.cc » ('j') | src/runtime.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698