Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(167)

Side by Side Diff: src/compiler/node.cc

Issue 838783002: [turbofan] Cleanup Graph and related classes. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Parameter pack causes compile errors. Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/compiler/node.h ('k') | src/compiler/node-marker.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler/node.h" 5 #include "src/compiler/node.h"
6 6
7 #include "src/compiler/graph.h"
8 #include "src/zone.h"
9
10 namespace v8 { 7 namespace v8 {
11 namespace internal { 8 namespace internal {
12 namespace compiler { 9 namespace compiler {
13 10
14 Node::Node(NodeId id, int input_count, int reserved_input_count) 11 Node::Node(NodeId id, const Operator* op, int input_count,
15 : id_(id), 12 int reserved_input_count)
13 : op_(op),
14 mark_(0),
15 id_(id),
16 bit_field_(InputCountField::encode(input_count) | 16 bit_field_(InputCountField::encode(input_count) |
17 ReservedInputCountField::encode(reserved_input_count) | 17 ReservedInputCountField::encode(reserved_input_count) |
18 HasAppendableInputsField::encode(false)), 18 HasAppendableInputsField::encode(false)),
19 first_use_(nullptr), 19 first_use_(nullptr),
20 last_use_(nullptr) { 20 last_use_(nullptr) {
21 inputs_.static_ = reinterpret_cast<Input*>(this + 1); 21 inputs_.static_ = reinterpret_cast<Input*>(this + 1);
22 } 22 }
23 23
24 24
25 Node* Node::New(Graph* graph, int input_count, Node** inputs, 25 Node* Node::New(Zone* zone, NodeId id, const Operator* op, int input_count,
26 bool has_extensible_inputs) { 26 Node** inputs, bool has_extensible_inputs) {
27 size_t node_size = sizeof(Node); 27 size_t node_size = sizeof(Node);
28 int reserve_input_count = has_extensible_inputs ? kDefaultReservedInputs : 0; 28 int reserve_input_count = has_extensible_inputs ? kDefaultReservedInputs : 0;
29 size_t inputs_size = (input_count + reserve_input_count) * sizeof(Input); 29 size_t inputs_size = (input_count + reserve_input_count) * sizeof(Input);
30 size_t uses_size = input_count * sizeof(Use); 30 size_t uses_size = input_count * sizeof(Use);
31 int size = static_cast<int>(node_size + inputs_size + uses_size); 31 int size = static_cast<int>(node_size + inputs_size + uses_size);
32 Zone* zone = graph->zone();
33 void* buffer = zone->New(size); 32 void* buffer = zone->New(size);
34 Node* result = 33 Node* result = new (buffer) Node(id, op, input_count, reserve_input_count);
35 new (buffer) Node(graph->NextNodeID(), input_count, reserve_input_count);
36 Input* input = 34 Input* input =
37 reinterpret_cast<Input*>(reinterpret_cast<char*>(buffer) + node_size); 35 reinterpret_cast<Input*>(reinterpret_cast<char*>(buffer) + node_size);
38 Use* use = 36 Use* use =
39 reinterpret_cast<Use*>(reinterpret_cast<char*>(input) + inputs_size); 37 reinterpret_cast<Use*>(reinterpret_cast<char*>(input) + inputs_size);
40 38
41 for (int current = 0; current < input_count; ++current) { 39 for (int current = 0; current < input_count; ++current) {
42 Node* to = *inputs++; 40 Node* to = *inputs++;
43 input->to = to; 41 input->to = to;
44 input->use = use; 42 input->use = use;
45 use->input_index = current; 43 use->input_index = current;
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 os << n.InputAt(i)->id(); 111 os << n.InputAt(i)->id();
114 } 112 }
115 os << ")"; 113 os << ")";
116 } 114 }
117 return os; 115 return os;
118 } 116 }
119 117
120 } // namespace compiler 118 } // namespace compiler
121 } // namespace internal 119 } // namespace internal
122 } // namespace v8 120 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/node.h ('k') | src/compiler/node-marker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698