5 #ifndef V8_COMPILER_NODE_AUX_DATA_H_ 6 #define V8_COMPILER_NODE_AUX_DATA_H_ 8 #include "src/compiler/node.h" 9 #include "src/zone/zone-containers.h" 19 T DefaultConstruct() {
23 template <
class T, T def() = DefaultConstruct<T>>
28 : aux_data_(initial_size, zone) {}
31 bool Set(
Node* node,
T const& data) {
32 size_t const id = node->id();
33 if (
id >= aux_data_.size()) aux_data_.resize(
id + 1, def());
34 if (aux_data_[
id] != data) {
41 T Get(
Node* node)
const {
42 size_t const id = node->id();
43 return (
id < aux_data_.size()) ? aux_data_[
id] : def();
56 template <
class T, T def()>
59 typedef std::forward_iterator_tag iterator_category;
61 typedef std::pair<size_t, T> value_type;
62 typedef value_type* pointer;
63 typedef value_type& reference;
66 : data_(data), current_(current) {}
68 : data_(other.data_), current_(other.current_) {}
70 value_type operator*()
const {
71 return std::make_pair(current_, (*data_)[current_]);
74 return current_ == other.current_ && data_ == other.data_;
77 return !(*
this == other);
90 template <
class T, T def()>
96 template <
class T, T def()>
106 #endif // V8_COMPILER_NODE_AUX_DATA_H_