| 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 2801 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2812 // Shorten string and fill | 2812 // Shorten string and fill |
| 2813 int string_size = ResultSeqString::SizeFor(position); | 2813 int string_size = ResultSeqString::SizeFor(position); |
| 2814 int allocated_string_size = ResultSeqString::SizeFor(new_length); | 2814 int allocated_string_size = ResultSeqString::SizeFor(new_length); |
| 2815 int delta = allocated_string_size - string_size; | 2815 int delta = allocated_string_size - string_size; |
| 2816 | 2816 |
| 2817 answer->set_length(position); | 2817 answer->set_length(position); |
| 2818 if (delta == 0) return *answer; | 2818 if (delta == 0) return *answer; |
| 2819 | 2819 |
| 2820 Address end_of_string = answer->address() + string_size; | 2820 Address end_of_string = answer->address() + string_size; |
| 2821 isolate->heap()->CreateFillerObjectAt(end_of_string, delta); | 2821 isolate->heap()->CreateFillerObjectAt(end_of_string, delta); |
| 2822 if (Marking::IsBlack(Marking::MarkBitFrom(*answer))) { |
| 2823 MemoryChunk::IncrementLiveBytes(answer->address(), -delta); |
| 2824 } |
| 2822 | 2825 |
| 2823 return *answer; | 2826 return *answer; |
| 2824 } | 2827 } |
| 2825 | 2828 |
| 2826 | 2829 |
| 2827 RUNTIME_FUNCTION(MaybeObject*, Runtime_StringReplaceRegExpWithString) { | 2830 RUNTIME_FUNCTION(MaybeObject*, Runtime_StringReplaceRegExpWithString) { |
| 2828 ASSERT(args.length() == 4); | 2831 ASSERT(args.length() == 4); |
| 2829 | 2832 |
| 2830 CONVERT_CHECKED(String, subject, args[0]); | 2833 CONVERT_CHECKED(String, subject, args[0]); |
| 2831 if (!subject->IsFlat()) { | 2834 if (!subject->IsFlat()) { |
| (...skipping 9429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12261 } else { | 12264 } else { |
| 12262 // Handle last resort GC and make sure to allow future allocations | 12265 // Handle last resort GC and make sure to allow future allocations |
| 12263 // to grow the heap without causing GCs (if possible). | 12266 // to grow the heap without causing GCs (if possible). |
| 12264 isolate->counters()->gc_last_resort_from_js()->Increment(); | 12267 isolate->counters()->gc_last_resort_from_js()->Increment(); |
| 12265 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags); | 12268 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags); |
| 12266 } | 12269 } |
| 12267 } | 12270 } |
| 12268 | 12271 |
| 12269 | 12272 |
| 12270 } } // namespace v8::internal | 12273 } } // namespace v8::internal |
| OLD | NEW |