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

Unified Diff: src/list-inl.h

Issue 7839030: Support for precise stepping in functions compiled before debugging was started (step 1) (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Removed #if 0 / #endif Created 9 years, 3 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
« no previous file with comments | « src/list.h ('k') | src/objects.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/list-inl.h
diff --git a/src/list-inl.h b/src/list-inl.h
index 8ef7514f4f61d5bad8b374d95f8aae8ab0cff296..80bccc9bc3216cc992897d95993f4eac62e4d95e 100644
--- a/src/list-inl.h
+++ b/src/list-inl.h
@@ -207,6 +207,35 @@ void List<T, P>::Initialize(int capacity) {
}
+template <typename T>
+int SortedListBSearch(
+ const List<T>& list, T elem, int (*cmp)(const T* x, const T* y)) {
+ int low = 0;
+ int high = list.length() - 1;
+ while (low <= high) {
+ int mid = (low + high) / 2;
+ T mid_elem = list[mid];
+
+ if (mid_elem > elem) {
+ high = mid - 1;
+ continue;
+ }
+ if (mid_elem < elem) {
+ low = mid + 1;
+ continue;
+ }
+ // Found the elememt.
+ return mid;
+ }
+ return -1;
+}
+
+
+template <typename T>
+int SortedListBSearch(const List<T>& list, T elem) {
+ return SortedListBSearch<T>(list, elem, PointerValueCompare<T>);
+}
+
} } // namespace v8::internal
#endif // V8_LIST_INL_H_
« no previous file with comments | « src/list.h ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698