blob: 995046b74e46e72a4cb1e6811c4cc3f75c55f403 [file] [log] [blame]
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001// 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
5#include "src/compiler/graph.h"
6
7#include "src/compiler/common-operator.h"
Ben Murdochb8a8cc12014-11-26 15:28:44 +00008#include "src/compiler/graph-inl.h"
9#include "src/compiler/node.h"
10#include "src/compiler/node-aux-data-inl.h"
11#include "src/compiler/node-properties.h"
12#include "src/compiler/node-properties-inl.h"
Emily Bernierd0a1eb72015-03-24 16:35:39 -040013#include "src/compiler/opcodes.h"
Ben Murdochb8a8cc12014-11-26 15:28:44 +000014#include "src/compiler/operator-properties.h"
Ben Murdochb8a8cc12014-11-26 15:28:44 +000015
16namespace v8 {
17namespace internal {
18namespace compiler {
19
Emily Bernierd0a1eb72015-03-24 16:35:39 -040020Graph::Graph(Zone* zone)
21 : zone_(zone),
22 start_(NULL),
23 end_(NULL),
24 mark_max_(0),
25 next_node_id_(0),
26 decorators_(zone) {}
Ben Murdochb8a8cc12014-11-26 15:28:44 +000027
28
Emily Bernierd0a1eb72015-03-24 16:35:39 -040029void Graph::Decorate(Node* node) {
Ben Murdochb8a8cc12014-11-26 15:28:44 +000030 for (ZoneVector<GraphDecorator*>::iterator i = decorators_.begin();
31 i != decorators_.end(); ++i) {
Emily Bernierd0a1eb72015-03-24 16:35:39 -040032 (*i)->Decorate(node);
33 }
34}
35
36
37Node* Graph::NewNode(const Operator* op, int input_count, Node** inputs,
38 bool incomplete) {
39 DCHECK_LE(op->ValueInputCount(), input_count);
40 Node* result = Node::New(this, input_count, inputs, incomplete);
41 result->Initialize(op);
42 if (!incomplete) {
43 Decorate(result);
Ben Murdochb8a8cc12014-11-26 15:28:44 +000044 }
45 return result;
46}
47
48} // namespace compiler
49} // namespace internal
50} // namespace v8