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

Side by Side Diff: src/runtime.cc

Issue 10445038: Merged r11661, r11662 into trunk branch. (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: Created 8 years, 7 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 | src/version.cc » ('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 3928 matching lines...) Expand 10 before | Expand all | Expand 10 after
3939 isolate->factory()->NewFixedArray(3 + capture_count); 3939 isolate->factory()->NewFixedArray(3 + capture_count);
3940 Handle<String> match; 3940 Handle<String> match;
3941 if (!first) { 3941 if (!first) {
3942 match = isolate->factory()->NewProperSubString(subject, 3942 match = isolate->factory()->NewProperSubString(subject,
3943 match_start, 3943 match_start,
3944 match_end); 3944 match_end);
3945 } else { 3945 } else {
3946 match = isolate->factory()->NewSubString(subject, 3946 match = isolate->factory()->NewSubString(subject,
3947 match_start, 3947 match_start,
3948 match_end); 3948 match_end);
3949 first = false;
3950 } 3949 }
3951 elements->set(0, *match); 3950 elements->set(0, *match);
3952 for (int i = 1; i <= capture_count; i++) { 3951 for (int i = 1; i <= capture_count; i++) {
3953 int start = current_match[i * 2]; 3952 int start = current_match[i * 2];
3954 if (start >= 0) { 3953 if (start >= 0) {
3955 int end = current_match[i * 2 + 1]; 3954 int end = current_match[i * 2 + 1];
3956 ASSERT(start <= end); 3955 ASSERT(start <= end);
3957 Handle<String> substring = 3956 Handle<String> substring;
3958 isolate->factory()->NewProperSubString(subject, start, end); 3957 if (!first) {
3958 substring =
3959 isolate->factory()->NewProperSubString(subject, start, end);
3960 } else {
3961 substring =
3962 isolate->factory()->NewSubString(subject, start, end);
3963 }
3959 elements->set(i, *substring); 3964 elements->set(i, *substring);
3960 } else { 3965 } else {
3961 ASSERT(current_match[i * 2 + 1] < 0); 3966 ASSERT(current_match[i * 2 + 1] < 0);
3962 elements->set(i, isolate->heap()->undefined_value()); 3967 elements->set(i, isolate->heap()->undefined_value());
3963 } 3968 }
3964 } 3969 }
3965 elements->set(capture_count + 1, Smi::FromInt(match_start)); 3970 elements->set(capture_count + 1, Smi::FromInt(match_start));
3966 elements->set(capture_count + 2, *subject); 3971 elements->set(capture_count + 2, *subject);
3967 builder->Add(*isolate->factory()->NewJSArrayWithElements(elements)); 3972 builder->Add(*isolate->factory()->NewJSArrayWithElements(elements));
3968 } 3973 }
3974 first = false;
3969 } 3975 }
3970 3976
3971 // If we did not get the maximum number of matches, we can stop here 3977 // If we did not get the maximum number of matches, we can stop here
3972 // since there are no matches left. 3978 // since there are no matches left.
3973 if (num_matches < max_matches) break; 3979 if (num_matches < max_matches) break;
3974 3980
3975 if (match_end > match_start) { 3981 if (match_end > match_start) {
3976 pos = match_end; 3982 pos = match_end;
3977 } else { 3983 } else {
3978 pos = match_end + 1; 3984 pos = match_end + 1;
(...skipping 9514 matching lines...) Expand 10 before | Expand all | Expand 10 after
13493 // Handle last resort GC and make sure to allow future allocations 13499 // Handle last resort GC and make sure to allow future allocations
13494 // to grow the heap without causing GCs (if possible). 13500 // to grow the heap without causing GCs (if possible).
13495 isolate->counters()->gc_last_resort_from_js()->Increment(); 13501 isolate->counters()->gc_last_resort_from_js()->Increment();
13496 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 13502 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
13497 "Runtime::PerformGC"); 13503 "Runtime::PerformGC");
13498 } 13504 }
13499 } 13505 }
13500 13506
13501 13507
13502 } } // namespace v8::internal 13508 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/version.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698