| OLD | NEW |
| 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 1705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1716 if (match.is_null()) { | 1716 if (match.is_null()) { |
| 1717 return Failure::Exception(); | 1717 return Failure::Exception(); |
| 1718 } | 1718 } |
| 1719 if (match->IsNull()) { | 1719 if (match->IsNull()) { |
| 1720 return *subject_handle; | 1720 return *subject_handle; |
| 1721 } | 1721 } |
| 1722 | 1722 |
| 1723 int capture_count = regexp_handle->CaptureCount(); | 1723 int capture_count = regexp_handle->CaptureCount(); |
| 1724 | 1724 |
| 1725 // CompiledReplacement uses zone allocation. | 1725 // CompiledReplacement uses zone allocation. |
| 1726 ZoneScope zone(DELETE_ON_EXIT); | 1726 CompilationZoneScope zone(DELETE_ON_EXIT); |
| 1727 CompiledReplacement compiled_replacement; | 1727 CompiledReplacement compiled_replacement; |
| 1728 compiled_replacement.Compile(replacement_handle, | 1728 compiled_replacement.Compile(replacement_handle, |
| 1729 capture_count, | 1729 capture_count, |
| 1730 length); | 1730 length); |
| 1731 | 1731 |
| 1732 bool is_global = regexp_handle->GetFlags().is_global(); | 1732 bool is_global = regexp_handle->GetFlags().is_global(); |
| 1733 | 1733 |
| 1734 // Guessing the number of parts that the final result string is built | 1734 // Guessing the number of parts that the final result string is built |
| 1735 // from. Global regexps can match any number of times, so we guess | 1735 // from. Global regexps can match any number of times, so we guess |
| 1736 // conservatively. | 1736 // conservatively. |
| (...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2369 Handle<Object> match = RegExpImpl::Exec(regexp, subject, 0, regexp_info); | 2369 Handle<Object> match = RegExpImpl::Exec(regexp, subject, 0, regexp_info); |
| 2370 | 2370 |
| 2371 if (match.is_null()) { | 2371 if (match.is_null()) { |
| 2372 return Failure::Exception(); | 2372 return Failure::Exception(); |
| 2373 } | 2373 } |
| 2374 if (match->IsNull()) { | 2374 if (match->IsNull()) { |
| 2375 return Heap::null_value(); | 2375 return Heap::null_value(); |
| 2376 } | 2376 } |
| 2377 int length = subject->length(); | 2377 int length = subject->length(); |
| 2378 | 2378 |
| 2379 ZoneScope zone_space(DELETE_ON_EXIT); | 2379 CompilationZoneScope zone_space(DELETE_ON_EXIT); |
| 2380 ZoneList<int> offsets(8); | 2380 ZoneList<int> offsets(8); |
| 2381 do { | 2381 do { |
| 2382 int start; | 2382 int start; |
| 2383 int end; | 2383 int end; |
| 2384 { | 2384 { |
| 2385 AssertNoAllocation no_alloc; | 2385 AssertNoAllocation no_alloc; |
| 2386 FixedArray* elements = regexp_info->elements(); | 2386 FixedArray* elements = regexp_info->elements(); |
| 2387 start = Smi::cast(elements->get(RegExpImpl::kFirstCapture))->value(); | 2387 start = Smi::cast(elements->get(RegExpImpl::kFirstCapture))->value(); |
| 2388 end = Smi::cast(elements->get(RegExpImpl::kFirstCapture + 1))->value(); | 2388 end = Smi::cast(elements->get(RegExpImpl::kFirstCapture + 1))->value(); |
| 2389 } | 2389 } |
| (...skipping 4693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7083 } else { | 7083 } else { |
| 7084 // Handle last resort GC and make sure to allow future allocations | 7084 // Handle last resort GC and make sure to allow future allocations |
| 7085 // to grow the heap without causing GCs (if possible). | 7085 // to grow the heap without causing GCs (if possible). |
| 7086 Counters::gc_last_resort_from_js.Increment(); | 7086 Counters::gc_last_resort_from_js.Increment(); |
| 7087 Heap::CollectAllGarbage(); | 7087 Heap::CollectAllGarbage(); |
| 7088 } | 7088 } |
| 7089 } | 7089 } |
| 7090 | 7090 |
| 7091 | 7091 |
| 7092 } } // namespace v8::internal | 7092 } } // namespace v8::internal |
| OLD | NEW |