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 int expected_parts = | 1716 int expected_parts = |
1717 (compiled_replacement.parts() + 1) * (is_global ? 4 : 1) + 1; | 1717 (compiled_replacement.parts() + 1) * (is_global ? 4 : 1) + 1; |
1718 ReplacementStringBuilder builder(subject_handle, expected_parts); | 1718 ReplacementStringBuilder builder(subject_handle, expected_parts); |
1719 | 1719 |
1720 // Index of end of last match. | 1720 // Index of end of last match. |
1721 int prev = 0; | 1721 int prev = 0; |
1722 | 1722 |
1723 // Number of parts added by compiled replacement plus preceeding string | 1723 // Number of parts added by compiled replacement plus preceeding string |
1724 // and possibly suffix after last match. | 1724 // and possibly suffix after last match. |
1725 const int parts_added_per_loop = compiled_replacement.parts() + 2; | 1725 const int parts_added_per_loop = compiled_replacement.parts() + 2; |
1726 bool matched; | 1726 bool matched = true; |
1727 do { | 1727 do { |
1728 ASSERT(last_match_info_handle->HasFastElements()); | 1728 ASSERT(last_match_info_handle->HasFastElements()); |
1729 // Increase the capacity of the builder before entering local handle-scope, | 1729 // Increase the capacity of the builder before entering local handle-scope, |
1730 // so its internal buffer can safely allocate a new handle if it grows. | 1730 // so its internal buffer can safely allocate a new handle if it grows. |
1731 builder.EnsureCapacity(parts_added_per_loop); | 1731 builder.EnsureCapacity(parts_added_per_loop); |
1732 | 1732 |
1733 HandleScope loop_scope; | 1733 HandleScope loop_scope; |
1734 int start, end; | 1734 int start, end; |
1735 { | 1735 { |
1736 AssertNoAllocation match_info_array_is_not_in_a_handle; | 1736 AssertNoAllocation match_info_array_is_not_in_a_handle; |
(...skipping 5153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6890 } else { | 6890 } else { |
6891 // Handle last resort GC and make sure to allow future allocations | 6891 // Handle last resort GC and make sure to allow future allocations |
6892 // to grow the heap without causing GCs (if possible). | 6892 // to grow the heap without causing GCs (if possible). |
6893 Counters::gc_last_resort_from_js.Increment(); | 6893 Counters::gc_last_resort_from_js.Increment(); |
6894 Heap::CollectAllGarbage(); | 6894 Heap::CollectAllGarbage(); |
6895 } | 6895 } |
6896 } | 6896 } |
6897 | 6897 |
6898 | 6898 |
6899 } } // namespace v8::internal | 6899 } } // namespace v8::internal |
OLD | NEW |