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

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

Issue 756073004: De-generify the GenericNode. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix compilation on Windows. Created 6 years 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-matchers.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 #include "src/compiler/graph.h"
7 #include "src/compiler/generic-node-inl.h" 7 #include "src/zone.h"
8 8
9 namespace v8 { 9 namespace v8 {
10 namespace internal { 10 namespace internal {
11 namespace compiler { 11 namespace compiler {
12 12
13 Node::Node(Graph* graph, int input_count, int reserve_input_count)
14 : NodeData(graph->zone()),
15 input_count_(input_count),
16 reserve_input_count_(reserve_input_count),
17 has_appendable_inputs_(false),
18 use_count_(0),
19 first_use_(NULL),
20 last_use_(NULL) {
21 DCHECK(reserve_input_count <= kMaxReservedInputs);
22 inputs_.static_ = reinterpret_cast<Input*>(this + 1);
23 id_ = graph->NextNodeID();
24 }
25
26
27 Node* Node::New(Graph* graph, int input_count, Node** inputs,
28 bool has_extensible_inputs) {
29 size_t node_size = sizeof(Node);
30 int reserve_input_count = has_extensible_inputs ? kDefaultReservedInputs : 0;
31 size_t inputs_size = (input_count + reserve_input_count) * sizeof(Input);
32 size_t uses_size = input_count * sizeof(Use);
33 int size = static_cast<int>(node_size + inputs_size + uses_size);
34 Zone* zone = graph->zone();
35 void* buffer = zone->New(size);
36 Node* result = new (buffer) Node(graph, input_count, reserve_input_count);
37 Input* input =
38 reinterpret_cast<Input*>(reinterpret_cast<char*>(buffer) + node_size);
39 Use* use =
40 reinterpret_cast<Use*>(reinterpret_cast<char*>(input) + inputs_size);
41
42 for (int current = 0; current < input_count; ++current) {
43 Node* to = *inputs++;
44 input->to = to;
45 input->use = use;
46 use->input_index = current;
47 use->from = result;
48 to->AppendUse(use);
49 ++use;
50 ++input;
51 }
52 return result;
53 }
54
55
13 void Node::Kill() { 56 void Node::Kill() {
14 DCHECK_NOT_NULL(op()); 57 DCHECK_NOT_NULL(op());
15 RemoveAllInputs(); 58 RemoveAllInputs();
16 DCHECK(uses().empty()); 59 DCHECK(uses().empty());
17 } 60 }
18 61
19 62
20 void Node::CollectProjections(NodeVector* projections) { 63 void Node::CollectProjections(NodeVector* projections) {
21 for (size_t i = 0; i < projections->size(); i++) { 64 for (size_t i = 0; i < projections->size(); i++) {
22 (*projections)[i] = NULL; 65 (*projections)[i] = NULL;
(...skipping 28 matching lines...) Expand all
51 os << n.InputAt(i)->id(); 94 os << n.InputAt(i)->id();
52 } 95 }
53 os << ")"; 96 os << ")";
54 } 97 }
55 return os; 98 return os;
56 } 99 }
57 100
58 } // namespace compiler 101 } // namespace compiler
59 } // namespace internal 102 } // namespace internal
60 } // namespace v8 103 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/node.h ('k') | src/compiler/node-matchers.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698