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

Side by Side Diff: src/runtime.cc

Issue 17826004: Get rid of the ZoneScopeMode. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 5 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 | « src/liveedit.cc ('k') | src/zone.h » ('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 3583 matching lines...) Expand 10 before | Expand all | Expand 10 after
3594 MUST_USE_RESULT static MaybeObject* StringReplaceGlobalAtomRegExpWithString( 3594 MUST_USE_RESULT static MaybeObject* StringReplaceGlobalAtomRegExpWithString(
3595 Isolate* isolate, 3595 Isolate* isolate,
3596 Handle<String> subject, 3596 Handle<String> subject,
3597 Handle<JSRegExp> pattern_regexp, 3597 Handle<JSRegExp> pattern_regexp,
3598 Handle<String> replacement, 3598 Handle<String> replacement,
3599 Handle<JSArray> last_match_info) { 3599 Handle<JSArray> last_match_info) {
3600 ASSERT(subject->IsFlat()); 3600 ASSERT(subject->IsFlat());
3601 ASSERT(replacement->IsFlat()); 3601 ASSERT(replacement->IsFlat());
3602 3602
3603 Zone* zone = isolate->runtime_zone(); 3603 Zone* zone = isolate->runtime_zone();
3604 ZoneScope zone_space(zone, DELETE_ON_EXIT); 3604 ZoneScope zone_space(zone);
3605 ZoneList<int> indices(8, zone); 3605 ZoneList<int> indices(8, zone);
3606 ASSERT_EQ(JSRegExp::ATOM, pattern_regexp->TypeTag()); 3606 ASSERT_EQ(JSRegExp::ATOM, pattern_regexp->TypeTag());
3607 String* pattern = 3607 String* pattern =
3608 String::cast(pattern_regexp->DataAt(JSRegExp::kAtomPatternIndex)); 3608 String::cast(pattern_regexp->DataAt(JSRegExp::kAtomPatternIndex));
3609 int subject_len = subject->length(); 3609 int subject_len = subject->length();
3610 int pattern_len = pattern->length(); 3610 int pattern_len = pattern->length();
3611 int replacement_len = replacement->length(); 3611 int replacement_len = replacement->length();
3612 3612
3613 FindStringIndicesDispatch( 3613 FindStringIndicesDispatch(
3614 isolate, *subject, pattern, &indices, 0xffffffff, zone); 3614 isolate, *subject, pattern, &indices, 0xffffffff, zone);
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
3681 Handle<String> replacement, 3681 Handle<String> replacement,
3682 Handle<JSArray> last_match_info) { 3682 Handle<JSArray> last_match_info) {
3683 ASSERT(subject->IsFlat()); 3683 ASSERT(subject->IsFlat());
3684 ASSERT(replacement->IsFlat()); 3684 ASSERT(replacement->IsFlat());
3685 3685
3686 int capture_count = regexp->CaptureCount(); 3686 int capture_count = regexp->CaptureCount();
3687 int subject_length = subject->length(); 3687 int subject_length = subject->length();
3688 3688
3689 // CompiledReplacement uses zone allocation. 3689 // CompiledReplacement uses zone allocation.
3690 Zone* zone = isolate->runtime_zone(); 3690 Zone* zone = isolate->runtime_zone();
3691 ZoneScope zonescope(zone, DELETE_ON_EXIT); 3691 ZoneScope zonescope(zone);
3692 CompiledReplacement compiled_replacement(zone); 3692 CompiledReplacement compiled_replacement(zone);
3693 bool simple_replace = compiled_replacement.Compile(replacement, 3693 bool simple_replace = compiled_replacement.Compile(replacement,
3694 capture_count, 3694 capture_count,
3695 subject_length); 3695 subject_length);
3696 3696
3697 // Shortcut for simple non-regexp global replacements 3697 // Shortcut for simple non-regexp global replacements
3698 if (regexp->TypeTag() == JSRegExp::ATOM && simple_replace) { 3698 if (regexp->TypeTag() == JSRegExp::ATOM && simple_replace) {
3699 if (subject->HasOnlyOneByteChars() && 3699 if (subject->HasOnlyOneByteChars() &&
3700 replacement->HasOnlyOneByteChars()) { 3700 replacement->HasOnlyOneByteChars()) {
3701 return StringReplaceGlobalAtomRegExpWithString<SeqOneByteString>( 3701 return StringReplaceGlobalAtomRegExpWithString<SeqOneByteString>(
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after
4216 CONVERT_ARG_HANDLE_CHECKED(String, subject, 0); 4216 CONVERT_ARG_HANDLE_CHECKED(String, subject, 0);
4217 CONVERT_ARG_HANDLE_CHECKED(JSRegExp, regexp, 1); 4217 CONVERT_ARG_HANDLE_CHECKED(JSRegExp, regexp, 1);
4218 CONVERT_ARG_HANDLE_CHECKED(JSArray, regexp_info, 2); 4218 CONVERT_ARG_HANDLE_CHECKED(JSArray, regexp_info, 2);
4219 4219
4220 RegExpImpl::GlobalCache global_cache(regexp, subject, true, isolate); 4220 RegExpImpl::GlobalCache global_cache(regexp, subject, true, isolate);
4221 if (global_cache.HasException()) return Failure::Exception(); 4221 if (global_cache.HasException()) return Failure::Exception();
4222 4222
4223 int capture_count = regexp->CaptureCount(); 4223 int capture_count = regexp->CaptureCount();
4224 4224
4225 Zone* zone = isolate->runtime_zone(); 4225 Zone* zone = isolate->runtime_zone();
4226 ZoneScope zone_space(zone, DELETE_ON_EXIT); 4226 ZoneScope zone_space(zone);
4227 ZoneList<int> offsets(8, zone); 4227 ZoneList<int> offsets(8, zone);
4228 4228
4229 while (true) { 4229 while (true) {
4230 int32_t* match = global_cache.FetchNext(); 4230 int32_t* match = global_cache.FetchNext();
4231 if (match == NULL) break; 4231 if (match == NULL) break;
4232 offsets.Add(match[0], zone); // start 4232 offsets.Add(match[0], zone); // start
4233 offsets.Add(match[1], zone); // end 4233 offsets.Add(match[1], zone); // end
4234 } 4234 }
4235 4235
4236 if (global_cache.HasException()) return Failure::Exception(); 4236 if (global_cache.HasException()) return Failure::Exception();
(...skipping 2072 matching lines...) Expand 10 before | Expand all | Expand 10 after
6309 6309
6310 // The limit can be very large (0xffffffffu), but since the pattern 6310 // The limit can be very large (0xffffffffu), but since the pattern
6311 // isn't empty, we can never create more parts than ~half the length 6311 // isn't empty, we can never create more parts than ~half the length
6312 // of the subject. 6312 // of the subject.
6313 6313
6314 if (!subject->IsFlat()) FlattenString(subject); 6314 if (!subject->IsFlat()) FlattenString(subject);
6315 6315
6316 static const int kMaxInitialListCapacity = 16; 6316 static const int kMaxInitialListCapacity = 16;
6317 6317
6318 Zone* zone = isolate->runtime_zone(); 6318 Zone* zone = isolate->runtime_zone();
6319 ZoneScope scope(zone, DELETE_ON_EXIT); 6319 ZoneScope scope(zone);
6320 6320
6321 // Find (up to limit) indices of separator and end-of-string in subject 6321 // Find (up to limit) indices of separator and end-of-string in subject
6322 int initial_capacity = Min<uint32_t>(kMaxInitialListCapacity, limit); 6322 int initial_capacity = Min<uint32_t>(kMaxInitialListCapacity, limit);
6323 ZoneList<int> indices(initial_capacity, zone); 6323 ZoneList<int> indices(initial_capacity, zone);
6324 if (!pattern->IsFlat()) FlattenString(pattern); 6324 if (!pattern->IsFlat()) FlattenString(pattern);
6325 6325
6326 FindStringIndicesDispatch(isolate, *subject, *pattern, &indices, limit, zone); 6326 FindStringIndicesDispatch(isolate, *subject, *pattern, &indices, limit, zone);
6327 6327
6328 if (static_cast<uint32_t>(indices.length()) < limit) { 6328 if (static_cast<uint32_t>(indices.length()) < limit) {
6329 indices.Add(subject_length, zone); 6329 indices.Add(subject_length, zone);
(...skipping 7593 matching lines...) Expand 10 before | Expand all | Expand 10 after
13923 // Handle last resort GC and make sure to allow future allocations 13923 // Handle last resort GC and make sure to allow future allocations
13924 // to grow the heap without causing GCs (if possible). 13924 // to grow the heap without causing GCs (if possible).
13925 isolate->counters()->gc_last_resort_from_js()->Increment(); 13925 isolate->counters()->gc_last_resort_from_js()->Increment();
13926 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 13926 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
13927 "Runtime::PerformGC"); 13927 "Runtime::PerformGC");
13928 } 13928 }
13929 } 13929 }
13930 13930
13931 13931
13932 } } // namespace v8::internal 13932 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/liveedit.cc ('k') | src/zone.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698