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 2695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2706 int start, end; | 2706 int start, end; |
2707 { | 2707 { |
2708 AssertNoAllocation match_info_array_is_not_in_a_handle; | 2708 AssertNoAllocation match_info_array_is_not_in_a_handle; |
2709 FixedArray* match_info_array = | 2709 FixedArray* match_info_array = |
2710 FixedArray::cast(last_match_info_handle->elements()); | 2710 FixedArray::cast(last_match_info_handle->elements()); |
2711 | 2711 |
2712 start = RegExpImpl::GetCapture(match_info_array, 0); | 2712 start = RegExpImpl::GetCapture(match_info_array, 0); |
2713 end = RegExpImpl::GetCapture(match_info_array, 1); | 2713 end = RegExpImpl::GetCapture(match_info_array, 1); |
2714 } | 2714 } |
2715 | 2715 |
2716 int length = subject->length(); | 2716 int length = subject_handle->length(); |
2717 int new_length = length - (end - start); | 2717 int new_length = length - (end - start); |
2718 if (new_length == 0) { | 2718 if (new_length == 0) { |
2719 return isolate->heap()->empty_string(); | 2719 return isolate->heap()->empty_string(); |
2720 } | 2720 } |
2721 Handle<ResultSeqString> answer; | 2721 Handle<ResultSeqString> answer; |
2722 if (ResultSeqString::kHasAsciiEncoding) { | 2722 if (ResultSeqString::kHasAsciiEncoding) { |
2723 answer = Handle<ResultSeqString>::cast( | 2723 answer = Handle<ResultSeqString>::cast( |
2724 isolate->factory()->NewRawAsciiString(new_length)); | 2724 isolate->factory()->NewRawAsciiString(new_length)); |
2725 } else { | 2725 } else { |
2726 answer = Handle<ResultSeqString>::cast( | 2726 answer = Handle<ResultSeqString>::cast( |
(...skipping 9258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11985 } else { | 11985 } else { |
11986 // Handle last resort GC and make sure to allow future allocations | 11986 // Handle last resort GC and make sure to allow future allocations |
11987 // to grow the heap without causing GCs (if possible). | 11987 // to grow the heap without causing GCs (if possible). |
11988 isolate->counters()->gc_last_resort_from_js()->Increment(); | 11988 isolate->counters()->gc_last_resort_from_js()->Increment(); |
11989 isolate->heap()->CollectAllGarbage(false); | 11989 isolate->heap()->CollectAllGarbage(false); |
11990 } | 11990 } |
11991 } | 11991 } |
11992 | 11992 |
11993 | 11993 |
11994 } } // namespace v8::internal | 11994 } } // namespace v8::internal |
OLD | NEW |