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 4107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4118 | 4118 |
4119 // Shorten string and fill | 4119 // Shorten string and fill |
4120 int string_size = ResultSeqString::SizeFor(position); | 4120 int string_size = ResultSeqString::SizeFor(position); |
4121 int allocated_string_size = ResultSeqString::SizeFor(new_length); | 4121 int allocated_string_size = ResultSeqString::SizeFor(new_length); |
4122 int delta = allocated_string_size - string_size; | 4122 int delta = allocated_string_size - string_size; |
4123 | 4123 |
4124 answer->set_length(position); | 4124 answer->set_length(position); |
4125 if (delta == 0) return *answer; | 4125 if (delta == 0) return *answer; |
4126 | 4126 |
4127 Address end_of_string = answer->address() + string_size; | 4127 Address end_of_string = answer->address() + string_size; |
4128 isolate->heap()->CreateFillerObjectAt(end_of_string, delta); | 4128 Heap* heap = isolate->heap(); |
4129 if (Marking::IsBlack(Marking::MarkBitFrom(*answer))) { | 4129 heap->CreateFillerObjectAt(end_of_string, delta); |
4130 MemoryChunk::IncrementLiveBytesFromMutator(answer->address(), -delta); | 4130 heap->AdjustLiveBytes(answer->address(), -delta, Heap::FROM_MUTATOR); |
4131 } | |
4132 | |
4133 return *answer; | 4131 return *answer; |
4134 } | 4132 } |
4135 | 4133 |
4136 | 4134 |
4137 RUNTIME_FUNCTION(MaybeObject*, Runtime_StringReplaceGlobalRegExpWithString) { | 4135 RUNTIME_FUNCTION(MaybeObject*, Runtime_StringReplaceGlobalRegExpWithString) { |
4138 HandleScope scope(isolate); | 4136 HandleScope scope(isolate); |
4139 ASSERT(args.length() == 4); | 4137 ASSERT(args.length() == 4); |
4140 | 4138 |
4141 CONVERT_ARG_HANDLE_CHECKED(String, subject, 0); | 4139 CONVERT_ARG_HANDLE_CHECKED(String, subject, 0); |
4142 CONVERT_ARG_HANDLE_CHECKED(String, replacement, 2); | 4140 CONVERT_ARG_HANDLE_CHECKED(String, replacement, 2); |
(...skipping 10876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15019 // Handle last resort GC and make sure to allow future allocations | 15017 // Handle last resort GC and make sure to allow future allocations |
15020 // to grow the heap without causing GCs (if possible). | 15018 // to grow the heap without causing GCs (if possible). |
15021 isolate->counters()->gc_last_resort_from_js()->Increment(); | 15019 isolate->counters()->gc_last_resort_from_js()->Increment(); |
15022 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 15020 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
15023 "Runtime::PerformGC"); | 15021 "Runtime::PerformGC"); |
15024 } | 15022 } |
15025 } | 15023 } |
15026 | 15024 |
15027 | 15025 |
15028 } } // namespace v8::internal | 15026 } } // namespace v8::internal |
OLD | NEW |