chromium/v8/src/compiler/node-aux-data.h

// Copyright 2014 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef V8_COMPILER_NODE_AUX_DATA_H_
#define V8_COMPILER_NODE_AUX_DATA_H_

#include "src/compiler/node.h"
#include "src/zone/zone-containers.h"

namespace v8 {
namespace internal {
namespace compiler {

// Forward declarations.
class Node;

template <class T>
T DefaultConstruct(Zone* zone) {}

template <class T>
T ZoneConstruct(Zone* zone) {}

template <class T, T def(Zone*) = DefaultConstruct<T>>
class NodeAuxData {
 public:
  explicit NodeAuxData(Zone* zone) :{}
  explicit NodeAuxData(size_t initial_size, Zone* zone)
      :{}

  // Update entry. Returns true iff entry was changed.
  bool Set(Node* node, T const& data) {}

  bool Set(NodeId id, T const& data) {}

  T Get(Node* node) const {}

  T Get(NodeId id) const {}

  class const_iterator;
  friend class const_iterator;

  const_iterator begin() const;
  const_iterator end() const;

 private:
  Zone* zone_;
  ZoneVector<T> aux_data_;
};

template <class T, T def(Zone*)>
class NodeAuxData<T, def>::const_iterator {};

template <class T, T def(Zone*)>
typename NodeAuxData<T, def>::const_iterator NodeAuxData<T, def>::begin()
    const {
  return typename NodeAuxData<T, def>::const_iterator(&aux_data_, 0);
}

template <class T, T def(Zone*)>
typename NodeAuxData<T, def>::const_iterator NodeAuxData<T, def>::end() const {
  return typename NodeAuxData<T, def>::const_iterator(&aux_data_,
                                                      aux_data_.size());
}

template <class T, T kNonExistent>
class NodeAuxDataMap {};

}  // namespace compiler
}  // namespace internal
}  // namespace v8

#endif  // V8_COMPILER_NODE_AUX_DATA_H_