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

Side by Side Diff: src/runtime.cc

Issue 6905035: Fix raw pointer misuse in StringReplaceRegExpWithEmptyString. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 8 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698