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 2863 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2874 } | 2874 } |
2875 | 2875 |
2876 | 2876 |
2877 template<typename ResultSeqString> | 2877 template<typename ResultSeqString> |
2878 MUST_USE_RESULT static MaybeObject* StringReplaceStringWithString( | 2878 MUST_USE_RESULT static MaybeObject* StringReplaceStringWithString( |
2879 Isolate* isolate, | 2879 Isolate* isolate, |
2880 Handle<String> subject, | 2880 Handle<String> subject, |
2881 Handle<JSRegExp> pattern_regexp, | 2881 Handle<JSRegExp> pattern_regexp, |
2882 Handle<String> replacement = Handle<String>::null()) { | 2882 Handle<String> replacement = Handle<String>::null()) { |
2883 ASSERT(subject->IsFlat()); | 2883 ASSERT(subject->IsFlat()); |
2884 ASSERT(replacement->IsFlat()); | 2884 ASSERT(replacement.is_null() || replacement->IsFlat()); |
2885 | 2885 |
2886 ZoneScope zone_space(isolate, DELETE_ON_EXIT); | 2886 ZoneScope zone_space(isolate, DELETE_ON_EXIT); |
2887 ZoneList<int> indices(8); | 2887 ZoneList<int> indices(8); |
2888 String* pattern = | 2888 String* pattern = |
2889 String::cast(pattern_regexp->DataAt(JSRegExp::kAtomPatternIndex)); | 2889 String::cast(pattern_regexp->DataAt(JSRegExp::kAtomPatternIndex)); |
2890 int subject_len = subject->length(); | 2890 int subject_len = subject->length(); |
2891 int pattern_len = pattern->length(); | 2891 int pattern_len = pattern->length(); |
2892 int replacement_len = (replacement.is_null()) ? 0 : replacement->length(); | 2892 int replacement_len = (replacement.is_null()) ? 0 : replacement->length(); |
2893 | 2893 |
2894 FindStringIndicesDispatch(isolate, *subject, pattern, &indices, 0xffffffff); | 2894 FindStringIndicesDispatch(isolate, *subject, pattern, &indices, 0xffffffff); |
(...skipping 10233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13128 } else { | 13128 } else { |
13129 // Handle last resort GC and make sure to allow future allocations | 13129 // Handle last resort GC and make sure to allow future allocations |
13130 // to grow the heap without causing GCs (if possible). | 13130 // to grow the heap without causing GCs (if possible). |
13131 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13131 isolate->counters()->gc_last_resort_from_js()->Increment(); |
13132 isolate->heap()->CollectAllGarbage(false); | 13132 isolate->heap()->CollectAllGarbage(false); |
13133 } | 13133 } |
13134 } | 13134 } |
13135 | 13135 |
13136 | 13136 |
13137 } } // namespace v8::internal | 13137 } } // namespace v8::internal |
OLD | NEW |