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 2623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2634 if (match.is_null()) { | 2634 if (match.is_null()) { |
2635 return Failure::Exception(); | 2635 return Failure::Exception(); |
2636 } | 2636 } |
2637 if (match->IsNull()) { | 2637 if (match->IsNull()) { |
2638 return *subject_handle; | 2638 return *subject_handle; |
2639 } | 2639 } |
2640 | 2640 |
2641 int capture_count = regexp_handle->CaptureCount(); | 2641 int capture_count = regexp_handle->CaptureCount(); |
2642 | 2642 |
2643 // CompiledReplacement uses zone allocation. | 2643 // CompiledReplacement uses zone allocation. |
2644 CompilationZoneScope zone(isolate, DELETE_ON_EXIT); | 2644 ZoneScope zone(isolate, DELETE_ON_EXIT); |
2645 CompiledReplacement compiled_replacement; | 2645 CompiledReplacement compiled_replacement; |
2646 compiled_replacement.Compile(replacement_handle, | 2646 compiled_replacement.Compile(replacement_handle, |
2647 capture_count, | 2647 capture_count, |
2648 length); | 2648 length); |
2649 | 2649 |
2650 bool is_global = regexp_handle->GetFlags().is_global(); | 2650 bool is_global = regexp_handle->GetFlags().is_global(); |
2651 | 2651 |
2652 // Guessing the number of parts that the final result string is built | 2652 // Guessing the number of parts that the final result string is built |
2653 // from. Global regexps can match any number of times, so we guess | 2653 // from. Global regexps can match any number of times, so we guess |
2654 // conservatively. | 2654 // conservatively. |
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3148 Handle<Object> match = RegExpImpl::Exec(regexp, subject, 0, regexp_info); | 3148 Handle<Object> match = RegExpImpl::Exec(regexp, subject, 0, regexp_info); |
3149 | 3149 |
3150 if (match.is_null()) { | 3150 if (match.is_null()) { |
3151 return Failure::Exception(); | 3151 return Failure::Exception(); |
3152 } | 3152 } |
3153 if (match->IsNull()) { | 3153 if (match->IsNull()) { |
3154 return isolate->heap()->null_value(); | 3154 return isolate->heap()->null_value(); |
3155 } | 3155 } |
3156 int length = subject->length(); | 3156 int length = subject->length(); |
3157 | 3157 |
3158 CompilationZoneScope zone_space(isolate, DELETE_ON_EXIT); | 3158 ZoneScope zone_space(isolate, DELETE_ON_EXIT); |
3159 ZoneList<int> offsets(8); | 3159 ZoneList<int> offsets(8); |
3160 do { | 3160 do { |
3161 int start; | 3161 int start; |
3162 int end; | 3162 int end; |
3163 { | 3163 { |
3164 AssertNoAllocation no_alloc; | 3164 AssertNoAllocation no_alloc; |
3165 FixedArray* elements = FixedArray::cast(regexp_info->elements()); | 3165 FixedArray* elements = FixedArray::cast(regexp_info->elements()); |
3166 start = Smi::cast(elements->get(RegExpImpl::kFirstCapture))->value(); | 3166 start = Smi::cast(elements->get(RegExpImpl::kFirstCapture))->value(); |
3167 end = Smi::cast(elements->get(RegExpImpl::kFirstCapture + 1))->value(); | 3167 end = Smi::cast(elements->get(RegExpImpl::kFirstCapture + 1))->value(); |
3168 } | 3168 } |
(...skipping 9182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12351 } else { | 12351 } else { |
12352 // Handle last resort GC and make sure to allow future allocations | 12352 // Handle last resort GC and make sure to allow future allocations |
12353 // to grow the heap without causing GCs (if possible). | 12353 // to grow the heap without causing GCs (if possible). |
12354 isolate->counters()->gc_last_resort_from_js()->Increment(); | 12354 isolate->counters()->gc_last_resort_from_js()->Increment(); |
12355 isolate->heap()->CollectAllGarbage(false); | 12355 isolate->heap()->CollectAllGarbage(false); |
12356 } | 12356 } |
12357 } | 12357 } |
12358 | 12358 |
12359 | 12359 |
12360 } } // namespace v8::internal | 12360 } } // namespace v8::internal |
OLD | NEW |