| 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 3136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3147 | 3147 |
| 3148 // Shorten string and fill | 3148 // Shorten string and fill |
| 3149 int string_size = ResultSeqString::SizeFor(position); | 3149 int string_size = ResultSeqString::SizeFor(position); |
| 3150 int allocated_string_size = ResultSeqString::SizeFor(new_length); | 3150 int allocated_string_size = ResultSeqString::SizeFor(new_length); |
| 3151 int delta = allocated_string_size - string_size; | 3151 int delta = allocated_string_size - string_size; |
| 3152 | 3152 |
| 3153 answer->set_length(position); | 3153 answer->set_length(position); |
| 3154 if (delta == 0) return *answer; | 3154 if (delta == 0) return *answer; |
| 3155 | 3155 |
| 3156 Address end_of_string = answer->address() + string_size; | 3156 Address end_of_string = answer->address() + string_size; |
| 3157 isolate->heap()->CreateFillerObjectAt(end_of_string, delta); | 3157 Heap* heap = isolate->heap(); |
| 3158 if (Marking::IsBlack(Marking::MarkBitFrom(*answer))) { | 3158 heap->CreateFillerObjectAt(end_of_string, delta); |
| 3159 if (MarkCompactCollector::IsLiveBytesUpdateRequired(*answer)) { |
| 3159 MemoryChunk::IncrementLiveBytes(answer->address(), -delta); | 3160 MemoryChunk::IncrementLiveBytes(answer->address(), -delta); |
| 3160 } | 3161 } |
| 3161 | 3162 |
| 3162 return *answer; | 3163 return *answer; |
| 3163 } | 3164 } |
| 3164 | 3165 |
| 3165 | 3166 |
| 3166 RUNTIME_FUNCTION(MaybeObject*, Runtime_StringReplaceRegExpWithString) { | 3167 RUNTIME_FUNCTION(MaybeObject*, Runtime_StringReplaceRegExpWithString) { |
| 3167 ASSERT(args.length() == 4); | 3168 ASSERT(args.length() == 4); |
| 3168 | 3169 |
| (...skipping 10243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13412 } else { | 13413 } else { |
| 13413 // Handle last resort GC and make sure to allow future allocations | 13414 // Handle last resort GC and make sure to allow future allocations |
| 13414 // to grow the heap without causing GCs (if possible). | 13415 // to grow the heap without causing GCs (if possible). |
| 13415 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13416 isolate->counters()->gc_last_resort_from_js()->Increment(); |
| 13416 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags); | 13417 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags); |
| 13417 } | 13418 } |
| 13418 } | 13419 } |
| 13419 | 13420 |
| 13420 | 13421 |
| 13421 } } // namespace v8::internal | 13422 } } // namespace v8::internal |
| OLD | NEW |