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 3135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3146 Handle<String> subject, | 3146 Handle<String> subject, |
3147 Handle<JSRegExp> regexp, | 3147 Handle<JSRegExp> regexp, |
3148 Handle<JSArray> last_match_info) { | 3148 Handle<JSArray> last_match_info) { |
3149 ASSERT(subject->IsFlat()); | 3149 ASSERT(subject->IsFlat()); |
3150 | 3150 |
3151 bool is_global = regexp->GetFlags().is_global(); | 3151 bool is_global = regexp->GetFlags().is_global(); |
3152 | 3152 |
3153 // Shortcut for simple non-regexp global replacements | 3153 // Shortcut for simple non-regexp global replacements |
3154 if (is_global && | 3154 if (is_global && |
3155 regexp->TypeTag() == JSRegExp::ATOM) { | 3155 regexp->TypeTag() == JSRegExp::ATOM) { |
3156 Handle<String> empty_string(HEAP->empty_string()); | 3156 Handle<String> empty_string = isolate->factory()->empty_string(); |
3157 if (subject->HasOnlyAsciiChars()) { | 3157 if (subject->HasOnlyAsciiChars()) { |
3158 return StringReplaceAtomRegExpWithString<SeqOneByteString>( | 3158 return StringReplaceAtomRegExpWithString<SeqOneByteString>( |
3159 isolate, | 3159 isolate, |
3160 subject, | 3160 subject, |
3161 regexp, | 3161 regexp, |
3162 empty_string, | 3162 empty_string, |
3163 last_match_info); | 3163 last_match_info); |
3164 } else { | 3164 } else { |
3165 return StringReplaceAtomRegExpWithString<SeqTwoByteString>( | 3165 return StringReplaceAtomRegExpWithString<SeqTwoByteString>( |
3166 isolate, | 3166 isolate, |
(...skipping 10254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13421 // Handle last resort GC and make sure to allow future allocations | 13421 // Handle last resort GC and make sure to allow future allocations |
13422 // to grow the heap without causing GCs (if possible). | 13422 // to grow the heap without causing GCs (if possible). |
13423 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13423 isolate->counters()->gc_last_resort_from_js()->Increment(); |
13424 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 13424 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
13425 "Runtime::PerformGC"); | 13425 "Runtime::PerformGC"); |
13426 } | 13426 } |
13427 } | 13427 } |
13428 | 13428 |
13429 | 13429 |
13430 } } // namespace v8::internal | 13430 } } // namespace v8::internal |
OLD | NEW |