OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 3160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3171 int string_size = ResultSeqString::SizeFor(position); | 3171 int string_size = ResultSeqString::SizeFor(position); |
3172 int allocated_string_size = ResultSeqString::SizeFor(new_length); | 3172 int allocated_string_size = ResultSeqString::SizeFor(new_length); |
3173 int delta = allocated_string_size - string_size; | 3173 int delta = allocated_string_size - string_size; |
3174 | 3174 |
3175 answer->set_length(position); | 3175 answer->set_length(position); |
3176 if (delta == 0) return *answer; | 3176 if (delta == 0) return *answer; |
3177 | 3177 |
3178 Address end_of_string = answer->address() + string_size; | 3178 Address end_of_string = answer->address() + string_size; |
3179 isolate->heap()->CreateFillerObjectAt(end_of_string, delta); | 3179 isolate->heap()->CreateFillerObjectAt(end_of_string, delta); |
3180 if (Marking::IsBlack(Marking::MarkBitFrom(*answer))) { | 3180 if (Marking::IsBlack(Marking::MarkBitFrom(*answer))) { |
3181 MemoryChunk::IncrementLiveBytes(answer->address(), -delta); | 3181 MemoryChunk::IncrementLiveBytesFromMutator(answer->address(), -delta); |
3182 } | 3182 } |
3183 | 3183 |
3184 return *answer; | 3184 return *answer; |
3185 } | 3185 } |
3186 | 3186 |
3187 | 3187 |
3188 RUNTIME_FUNCTION(MaybeObject*, Runtime_StringReplaceRegExpWithString) { | 3188 RUNTIME_FUNCTION(MaybeObject*, Runtime_StringReplaceRegExpWithString) { |
3189 ASSERT(args.length() == 4); | 3189 ASSERT(args.length() == 4); |
3190 | 3190 |
3191 CONVERT_CHECKED(String, subject, args[0]); | 3191 CONVERT_CHECKED(String, subject, args[0]); |
(...skipping 10433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13625 } else { | 13625 } else { |
13626 // Handle last resort GC and make sure to allow future allocations | 13626 // Handle last resort GC and make sure to allow future allocations |
13627 // to grow the heap without causing GCs (if possible). | 13627 // to grow the heap without causing GCs (if possible). |
13628 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13628 isolate->counters()->gc_last_resort_from_js()->Increment(); |
13629 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags); | 13629 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags); |
13630 } | 13630 } |
13631 } | 13631 } |
13632 | 13632 |
13633 | 13633 |
13634 } } // namespace v8::internal | 13634 } } // namespace v8::internal |
OLD | NEW |