diff options
author | Refael Ackermann <refack@gmail.com> | 2014-09-29 13:20:04 +0400 |
---|---|---|
committer | Fedor Indutny <fedor@indutny.com> | 2014-10-08 15:35:57 +0400 |
commit | 939278ac059b44439d41aab12bf552c8ae3c52d0 (patch) | |
tree | 86c586915a96d308b1b04de679a8ae293caf3e41 /deps/v8/src/compiler/node.h | |
parent | 4412a71d76a0fa002f627ec21d2337e089da6764 (diff) | |
download | node-new-939278ac059b44439d41aab12bf552c8ae3c52d0.tar.gz |
deps: update v8 to 3.28.73
Reviewed-By: Fedor Indutny <fedor@indutny.com>
PR-URL: https://github.com/joyent/node/pull/8476
Diffstat (limited to 'deps/v8/src/compiler/node.h')
-rw-r--r-- | deps/v8/src/compiler/node.h | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/deps/v8/src/compiler/node.h b/deps/v8/src/compiler/node.h new file mode 100644 index 0000000000..ddca510a0e --- /dev/null +++ b/deps/v8/src/compiler/node.h @@ -0,0 +1,95 @@ +// Copyright 2013 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_H_ +#define V8_COMPILER_NODE_H_ + +#include <deque> +#include <set> +#include <vector> + +#include "src/compiler/generic-algorithm.h" +#include "src/compiler/generic-node.h" +#include "src/compiler/opcodes.h" +#include "src/compiler/operator.h" +#include "src/types.h" +#include "src/zone.h" +#include "src/zone-allocator.h" + +namespace v8 { +namespace internal { +namespace compiler { + +class NodeData { + public: + Operator* op() const { return op_; } + void set_op(Operator* op) { op_ = op; } + + IrOpcode::Value opcode() const { + DCHECK(op_->opcode() <= IrOpcode::kLast); + return static_cast<IrOpcode::Value>(op_->opcode()); + } + + Bounds bounds() { return bounds_; } + + protected: + Operator* op_; + Bounds bounds_; + explicit NodeData(Zone* zone) : bounds_(Bounds(Type::None(zone))) {} + + friend class NodeProperties; + void set_bounds(Bounds b) { bounds_ = b; } +}; + +// A Node is the basic primitive of an IR graph. In addition to the members +// inherited from Vector, Nodes only contain a mutable Operator that may change +// during compilation, e.g. during lowering passes. Other information that +// needs to be associated with Nodes during compilation must be stored +// out-of-line indexed by the Node's id. +class Node : public GenericNode<NodeData, Node> { + public: + Node(GenericGraphBase* graph, int input_count) + : GenericNode<NodeData, Node>(graph, input_count) {} + + void Initialize(Operator* op) { set_op(op); } + + void CollectProjections(int projection_count, Node** projections); + Node* FindProjection(int32_t projection_index); +}; + +OStream& operator<<(OStream& os, const Node& n); + +typedef GenericGraphVisit::NullNodeVisitor<NodeData, Node> NullNodeVisitor; + +typedef zone_allocator<Node*> NodePtrZoneAllocator; + +typedef std::set<Node*, std::less<Node*>, NodePtrZoneAllocator> NodeSet; +typedef NodeSet::iterator NodeSetIter; +typedef NodeSet::reverse_iterator NodeSetRIter; + +typedef std::deque<Node*, NodePtrZoneAllocator> NodeDeque; +typedef NodeDeque::iterator NodeDequeIter; + +typedef std::vector<Node*, NodePtrZoneAllocator> NodeVector; +typedef NodeVector::iterator NodeVectorIter; +typedef NodeVector::reverse_iterator NodeVectorRIter; + +typedef zone_allocator<NodeVector> ZoneNodeVectorAllocator; +typedef std::vector<NodeVector, ZoneNodeVectorAllocator> NodeVectorVector; +typedef NodeVectorVector::iterator NodeVectorVectorIter; +typedef NodeVectorVector::reverse_iterator NodeVectorVectorRIter; + +typedef Node::Uses::iterator UseIter; +typedef Node::Inputs::iterator InputIter; + +// Helper to extract parameters from Operator1<*> nodes. +template <typename T> +static inline T OpParameter(Node* node) { + return reinterpret_cast<Operator1<T>*>(node->op())->parameter(); +} +} +} +} // namespace v8::internal::compiler + +#endif // V8_COMPILER_NODE_H_ |