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

Unified Diff: src/vector.h

Issue 1174713002: Reland of 'Optimize trivial regexp disjunctions' CL 1176453002 (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix for the out-of-bounds sort that caused the revert Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: src/vector.h
diff --git a/src/vector.h b/src/vector.h
index 895c61b4ece176acfe8820f13779140ff3c552c2..d022fde3a5bb25d88b7fba5e9ca4ae375e94d20b 100644
--- a/src/vector.h
+++ b/src/vector.h
@@ -69,6 +69,10 @@ class Vector {
return Vector<T>(result, length_);
}
+ void Sort(int (*cmp)(const T*, const T*), size_t s, size_t l) {
+ std::sort(start() + s, start() + s + l, RawComparer(cmp));
+ }
+
void Sort(int (*cmp)(const T*, const T*)) {
std::sort(start(), start() + length(), RawComparer(cmp));
}
@@ -77,6 +81,16 @@ class Vector {
std::sort(start(), start() + length());
}
+ void StableSort(int (*cmp)(const T*, const T*), size_t s, size_t l) {
+ std::stable_sort(start() + s, start() + s + l, RawComparer(cmp));
+ }
+
+ void StableSort(int (*cmp)(const T*, const T*)) {
+ std::stable_sort(start(), start() + length(), RawComparer(cmp));
+ }
+
+ void StableSort() { std::stable_sort(start(), start() + length()); }
+
void Truncate(int length) {
DCHECK(length <= length_);
length_ = length;
« src/jsregexp.cc ('K') | « src/list-inl.h ('k') | test/cctest/test-heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698