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 1536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1547 int expected_parts = | 1547 int expected_parts = |
1548 (compiled_replacement.parts() + 1) * (is_global ? 4 : 1) + 1; | 1548 (compiled_replacement.parts() + 1) * (is_global ? 4 : 1) + 1; |
1549 ReplacementStringBuilder builder(subject_handle, expected_parts); | 1549 ReplacementStringBuilder builder(subject_handle, expected_parts); |
1550 | 1550 |
1551 // Index of end of last match. | 1551 // Index of end of last match. |
1552 int prev = 0; | 1552 int prev = 0; |
1553 | 1553 |
1554 // Number of parts added by compiled replacement plus preceeding string | 1554 // Number of parts added by compiled replacement plus preceeding string |
1555 // and possibly suffix after last match. | 1555 // and possibly suffix after last match. |
1556 const int parts_added_per_loop = compiled_replacement.parts() + 2; | 1556 const int parts_added_per_loop = compiled_replacement.parts() + 2; |
1557 bool matched; | 1557 bool matched = true; |
1558 do { | 1558 do { |
1559 ASSERT(last_match_info_handle->HasFastElements()); | 1559 ASSERT(last_match_info_handle->HasFastElements()); |
1560 // Increase the capacity of the builder before entering local handle-scope, | 1560 // Increase the capacity of the builder before entering local handle-scope, |
1561 // so its internal buffer can safely allocate a new handle if it grows. | 1561 // so its internal buffer can safely allocate a new handle if it grows. |
1562 builder.EnsureCapacity(parts_added_per_loop); | 1562 builder.EnsureCapacity(parts_added_per_loop); |
1563 | 1563 |
1564 HandleScope loop_scope; | 1564 HandleScope loop_scope; |
1565 int start, end; | 1565 int start, end; |
1566 { | 1566 { |
1567 AssertNoAllocation match_info_array_is_not_in_a_handle; | 1567 AssertNoAllocation match_info_array_is_not_in_a_handle; |
(...skipping 5153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6721 } else { | 6721 } else { |
6722 // Handle last resort GC and make sure to allow future allocations | 6722 // Handle last resort GC and make sure to allow future allocations |
6723 // to grow the heap without causing GCs (if possible). | 6723 // to grow the heap without causing GCs (if possible). |
6724 Counters::gc_last_resort_from_js.Increment(); | 6724 Counters::gc_last_resort_from_js.Increment(); |
6725 Heap::CollectAllGarbage(); | 6725 Heap::CollectAllGarbage(); |
6726 } | 6726 } |
6727 } | 6727 } |
6728 | 6728 |
6729 | 6729 |
6730 } } // namespace v8::internal | 6730 } } // namespace v8::internal |
OLD | NEW |