v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
turbofan-graph.cc
Go to the documentation of this file.
1// Copyright 2013 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
6
7#include <algorithm>
8
9#include "src/compiler/node.h"
12
13namespace v8 {
14namespace internal {
15namespace compiler {
16
18 : zone_(zone),
19 start_(nullptr),
20 end_(nullptr),
21 mark_max_(0),
22 next_node_id_(0),
23 decorators_(zone),
24 has_simd_(false),
25 simd_stores_(zone) {
26 // Nodes use compressed pointers, so zone must support pointer compression.
27 // If the check fails, ensure the zone is created with kCompressGraphZone
28 // flag.
30}
31
33 for (GraphDecorator* const decorator : decorators_) {
34 decorator->Decorate(node);
35 }
36}
37
39 decorators_.push_back(decorator);
40}
41
43 auto const it = std::find(decorators_.begin(), decorators_.end(), decorator);
44 DCHECK(it != decorators_.end());
45 decorators_.erase(it);
46}
47
48Node* TFGraph::NewNode(const Operator* op, int input_count, Node* const* inputs,
49 bool incomplete) {
50 Node* node = NewNodeUnchecked(op, input_count, inputs, incomplete);
52 return node;
53}
54
55Node* TFGraph::NewNodeUnchecked(const Operator* op, int input_count,
56 Node* const* inputs, bool incomplete) {
57 Node* const node =
58 Node::New(zone(), NextNodeId(), op, input_count, inputs, incomplete);
59 Decorate(node);
60 return node;
61}
62
64 DCHECK_NOT_NULL(node);
65 Node* const clone = Node::Clone(zone(), NextNodeId(), node);
66 Decorate(clone);
67 return clone;
68}
69
71 // A node's id is internally stored in a bit field using fewer bits than
72 // NodeId (see Node::IdField). Hence the addition below won't ever overflow.
73 DCHECK_LT(next_node_id_, std::numeric_limits<NodeId>::max());
74 return next_node_id_++;
75}
76
77void TFGraph::Print() const { StdoutStream{} << AsRPO(*this); }
78
80
82
83} // namespace compiler
84} // namespace internal
85} // namespace v8
void push_back(const T &value)
bool supports_compression() const
Definition zone.h:50
static Node * New(Zone *zone, NodeId id, const Operator *op, int input_count, Node *const *inputs, bool has_extensible_inputs)
Definition node.cc:131
static Node * Clone(Zone *zone, NodeId id, const Node *node)
Definition node.cc:136
void AddDecorator(GraphDecorator *decorator)
ZoneVector< Node * > simd_stores_
Node * CloneNode(const Node *node)
Node * NewNodeUnchecked(const Operator *op, int input_count, Node *const *inputs, bool incomplete=false)
ZoneVector< Node * > const & GetSimdStoreNodes()
Node * NewNode(const Operator *op, int input_count, Node *const *inputs, bool incomplete=false)
ZoneVector< GraphDecorator * > decorators_
void RemoveDecorator(GraphDecorator *decorator)
static void VerifyNode(Node *node)
Definition verifier.h:51
Zone * zone_
uint8_t *const start_
Definition assembler.cc:131
const v8::base::TimeTicks end_
Definition sweeper.cc:54
Node * node
static constexpr bool kCompressGraphZone
Definition globals.h:525
#define CHECK_IMPLIES(lhs, rhs)
#define DCHECK_NOT_NULL(val)
Definition logging.h:492
#define DCHECK(condition)
Definition logging.h:482
#define DCHECK_LT(v1, v2)
Definition logging.h:489