Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(262)

Side by Side Diff: src/runtime.cc

Issue 10830304: Ensure capacity when adding parts in String.replace. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-2289.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 3110 matching lines...) Expand 10 before | Expand all | Expand 10 after
3121 3121
3122 // Only continue checking for global regexps. 3122 // Only continue checking for global regexps.
3123 if (!is_global) break; 3123 if (!is_global) break;
3124 3124
3125 current_match = global_cache.FetchNext(); 3125 current_match = global_cache.FetchNext();
3126 } while (current_match != NULL); 3126 } while (current_match != NULL);
3127 3127
3128 if (global_cache.HasException()) return Failure::Exception(); 3128 if (global_cache.HasException()) return Failure::Exception();
3129 3129
3130 if (prev < subject_length) { 3130 if (prev < subject_length) {
3131 builder.EnsureCapacity(2);
3131 builder.AddSubjectSlice(prev, subject_length); 3132 builder.AddSubjectSlice(prev, subject_length);
3132 } 3133 }
3133 3134
3134 RegExpImpl::SetLastMatchInfo(last_match_info, 3135 RegExpImpl::SetLastMatchInfo(last_match_info,
3135 subject, 3136 subject,
3136 capture_count, 3137 capture_count,
3137 global_cache.LastSuccessfulMatch()); 3138 global_cache.LastSuccessfulMatch());
3138 3139
3139 return *(builder.ToString()); 3140 return *(builder.ToString());
3140 } 3141 }
(...skipping 10205 matching lines...) Expand 10 before | Expand all | Expand 10 after
13346 // Handle last resort GC and make sure to allow future allocations 13347 // Handle last resort GC and make sure to allow future allocations
13347 // to grow the heap without causing GCs (if possible). 13348 // to grow the heap without causing GCs (if possible).
13348 isolate->counters()->gc_last_resort_from_js()->Increment(); 13349 isolate->counters()->gc_last_resort_from_js()->Increment();
13349 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 13350 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
13350 "Runtime::PerformGC"); 13351 "Runtime::PerformGC");
13351 } 13352 }
13352 } 13353 }
13353 13354
13354 13355
13355 } } // namespace v8::internal 13356 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-2289.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698