Index: src/compiler/node-aux-data-inl.h |
diff --git a/src/compiler/node-aux-data-inl.h b/src/compiler/node-aux-data-inl.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..0ec8eca73da90810e76ea8b839372637e6fa88b7 |
--- /dev/null |
+++ b/src/compiler/node-aux-data-inl.h |
@@ -0,0 +1,43 @@ |
+// 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_INL_H_ |
+#define V8_COMPILER_NODE_AUX_DATA_INL_H_ |
+ |
+#include "src/compiler/graph.h" |
+#include "src/compiler/node.h" |
+#include "src/compiler/node-aux-data.h" |
+ |
+namespace v8 { |
+namespace internal { |
+namespace compiler { |
+ |
+template <class T> |
+NodeAuxData<T>::NodeAuxData(Graph* graph) |
+ : aux_data_(ZoneAllocator(graph->zone())) {} |
+ |
+ |
+template <class T> |
+void NodeAuxData<T>::Set(Node* node, const T& data) { |
+ int id = node->id(); |
+ if (id >= static_cast<int>(aux_data_.size())) { |
+ aux_data_.resize(id + 1); |
+ } |
+ aux_data_[id] = data; |
+} |
+ |
+ |
+template <class T> |
+T NodeAuxData<T>::Get(Node* node) { |
+ int id = node->id(); |
+ if (id >= static_cast<int>(aux_data_.size())) { |
+ return T(); |
+ } |
+ return aux_data_[id]; |
+} |
+} |
+} |
+} // namespace v8::internal::compiler |
+ |
+#endif |