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 2935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2946 ZoneScope zone(isolate, DELETE_ON_EXIT); | 2946 ZoneScope zone(isolate, DELETE_ON_EXIT); |
2947 CompiledReplacement compiled_replacement; | 2947 CompiledReplacement compiled_replacement; |
2948 compiled_replacement.Compile(replacement_handle, | 2948 compiled_replacement.Compile(replacement_handle, |
2949 capture_count, | 2949 capture_count, |
2950 length); | 2950 length); |
2951 | 2951 |
2952 bool is_global = regexp_handle->GetFlags().is_global(); | 2952 bool is_global = regexp_handle->GetFlags().is_global(); |
2953 | 2953 |
2954 // Shortcut for simple non-regexp global replacements | 2954 // Shortcut for simple non-regexp global replacements |
2955 if (is_global && | 2955 if (is_global && |
2956 regexp->TypeTag() == JSRegExp::ATOM && | 2956 regexp_handle->TypeTag() == JSRegExp::ATOM && |
2957 compiled_replacement.simple_hint()) { | 2957 compiled_replacement.simple_hint()) { |
2958 if (subject_handle->HasOnlyAsciiChars() && | 2958 if (subject_handle->HasOnlyAsciiChars() && |
2959 replacement_handle->HasOnlyAsciiChars()) { | 2959 replacement_handle->HasOnlyAsciiChars()) { |
2960 return StringReplaceStringWithString<SeqAsciiString>( | 2960 return StringReplaceStringWithString<SeqAsciiString>( |
2961 isolate, subject_handle, regexp_handle, replacement_handle); | 2961 isolate, subject_handle, regexp_handle, replacement_handle); |
2962 } else { | 2962 } else { |
2963 return StringReplaceStringWithString<SeqTwoByteString>( | 2963 return StringReplaceStringWithString<SeqTwoByteString>( |
2964 isolate, subject_handle, regexp_handle, replacement_handle); | 2964 isolate, subject_handle, regexp_handle, replacement_handle); |
2965 } | 2965 } |
2966 } | 2966 } |
(...skipping 10250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13217 } else { | 13217 } else { |
13218 // Handle last resort GC and make sure to allow future allocations | 13218 // Handle last resort GC and make sure to allow future allocations |
13219 // to grow the heap without causing GCs (if possible). | 13219 // to grow the heap without causing GCs (if possible). |
13220 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13220 isolate->counters()->gc_last_resort_from_js()->Increment(); |
13221 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags); | 13221 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags); |
13222 } | 13222 } |
13223 } | 13223 } |
13224 | 13224 |
13225 | 13225 |
13226 } } // namespace v8::internal | 13226 } } // namespace v8::internal |
OLD | NEW |