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

Unified Diff: src/compiler/node-aux-data.h

Issue 985023002: [turbofan] Add schedule to visualizer output (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Tweaks Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/compiler/pipeline.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/node-aux-data.h
diff --git a/src/compiler/node-aux-data.h b/src/compiler/node-aux-data.h
index 6c236aa4da75d8be538cd2bdd980e4d4c060f6a4..7a882921a71db37cc2727683a501dfe448e9365a 100644
--- a/src/compiler/node-aux-data.h
+++ b/src/compiler/node-aux-data.h
@@ -31,10 +31,61 @@ class NodeAuxData {
return (id < aux_data_.size()) ? aux_data_[id] : T();
}
+ class const_iterator;
+ friend class const_iterator;
+
+ const_iterator begin() const;
+ const_iterator end() const;
+
private:
ZoneVector<T> aux_data_;
};
+
+template <class T>
+class NodeAuxData<T>::const_iterator {
+ public:
+ typedef std::forward_iterator_tag iterator_category;
+ typedef int difference_type;
+ typedef std::pair<size_t, T> value_type;
+ typedef value_type* pointer;
+ typedef value_type& reference;
+
+ const_iterator(const ZoneVector<T>* data, size_t current)
+ : data_(data), current_(current) {}
+ const_iterator(const const_iterator& other)
+ : data_(other.data_), current_(other.current_) {}
+
+ value_type operator*() const {
+ return std::make_pair(current_, (*data_)[current_]);
+ }
+ bool operator==(const const_iterator& other) const {
+ return current_ == other.current_ && data_ == other.data_;
+ }
+ bool operator!=(const const_iterator& other) const {
+ return !(*this == other);
+ }
+ const_iterator& operator++() {
+ ++current_;
+ return *this;
+ }
+ const_iterator operator++(int);
+
+ private:
+ const ZoneVector<T>* data_;
+ size_t current_;
+};
+
+template <class T>
+typename NodeAuxData<T>::const_iterator NodeAuxData<T>::begin() const {
+ return typename NodeAuxData<T>::const_iterator(&aux_data_, 0);
+}
+
+template <class T>
+typename NodeAuxData<T>::const_iterator NodeAuxData<T>::end() const {
+ return typename NodeAuxData<T>::const_iterator(&aux_data_, aux_data_.size());
+}
+
} // namespace compiler
} // namespace internal
} // namespace v8
« no previous file with comments | « no previous file | src/compiler/pipeline.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698