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

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

Issue 437183002: Make start node a value input to parameter nodes. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Add start node as input to parameter nodes. Created 6 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/verifier.h" 5 #include "src/compiler/verifier.h"
6 6
7 #include "src/compiler/generic-algorithm.h" 7 #include "src/compiler/generic-algorithm.h"
8 #include "src/compiler/generic-node-inl.h" 8 #include "src/compiler/generic-node-inl.h"
9 #include "src/compiler/generic-node.h" 9 #include "src/compiler/generic-node.h"
10 #include "src/compiler/graph-inl.h" 10 #include "src/compiler/graph-inl.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 CHECK(NodeProperties::HasControlOutput(control)); 95 CHECK(NodeProperties::HasControlOutput(control));
96 CHECK(IsDefUseChainLinkPresent(control, node)); 96 CHECK(IsDefUseChainLinkPresent(control, node));
97 CHECK(IsUseDefChainLinkPresent(control, node)); 97 CHECK(IsUseDefChainLinkPresent(control, node));
98 } 98 }
99 99
100 // Verify all successors are projections if multiple value outputs exist. 100 // Verify all successors are projections if multiple value outputs exist.
101 if (NodeProperties::GetValueOutputCount(node) > 1) { 101 if (NodeProperties::GetValueOutputCount(node) > 1) {
102 Node::Uses uses = node->uses(); 102 Node::Uses uses = node->uses();
103 for (Node::Uses::iterator it = uses.begin(); it != uses.end(); ++it) { 103 for (Node::Uses::iterator it = uses.begin(); it != uses.end(); ++it) {
104 CHECK(!NodeProperties::IsValueEdge(it.edge()) || 104 CHECK(!NodeProperties::IsValueEdge(it.edge()) ||
105 (*it)->opcode() == IrOpcode::kProjection); 105 (*it)->opcode() == IrOpcode::kProjection ||
106 (*it)->opcode() == IrOpcode::kParameter);
106 } 107 }
107 } 108 }
108 109
109 switch (node->opcode()) { 110 switch (node->opcode()) {
110 case IrOpcode::kStart: 111 case IrOpcode::kStart:
111 // Start has no inputs. 112 // Start has no inputs.
112 CHECK_EQ(0, input_count); 113 CHECK_EQ(0, input_count);
113 break; 114 break;
114 case IrOpcode::kEnd: 115 case IrOpcode::kEnd:
115 // End has no outputs. 116 // End has no outputs.
(...skipping 25 matching lines...) Expand all
141 break; 142 break;
142 case IrOpcode::kLoop: 143 case IrOpcode::kLoop:
143 case IrOpcode::kMerge: 144 case IrOpcode::kMerge:
144 break; 145 break;
145 case IrOpcode::kReturn: 146 case IrOpcode::kReturn:
146 // TODO(rossberg): check successor is End 147 // TODO(rossberg): check successor is End
147 break; 148 break;
148 case IrOpcode::kThrow: 149 case IrOpcode::kThrow:
149 // TODO(rossberg): what are the constraints on these? 150 // TODO(rossberg): what are the constraints on these?
150 break; 151 break;
151 case IrOpcode::kParameter: 152 case IrOpcode::kParameter: {
152 // Parameters have no inputs. 153 // Parameters have the start node as inputs.
153 CHECK_EQ(0, input_count); 154 CHECK_EQ(1, input_count);
155 CHECK_EQ(IrOpcode::kStart,
156 NodeProperties::GetValueInput(node, 0)->opcode());
157 // Parameter has an input that produces enough values.
158 int index = static_cast<Operator1<int>*>(node->op())->parameter();
159 Node* input = NodeProperties::GetValueInput(node, 0);
160 // Currently, parameter indices start at -1 instead of 0.
161 CHECK_GT(NodeProperties::GetValueOutputCount(input), index + 1);
154 break; 162 break;
163 }
155 case IrOpcode::kInt32Constant: 164 case IrOpcode::kInt32Constant:
156 case IrOpcode::kInt64Constant: 165 case IrOpcode::kInt64Constant:
157 case IrOpcode::kFloat64Constant: 166 case IrOpcode::kFloat64Constant:
158 case IrOpcode::kExternalConstant: 167 case IrOpcode::kExternalConstant:
159 case IrOpcode::kNumberConstant: 168 case IrOpcode::kNumberConstant:
160 case IrOpcode::kHeapConstant: 169 case IrOpcode::kHeapConstant:
161 // Constants have no inputs. 170 // Constants have no inputs.
162 CHECK_EQ(0, input_count); 171 CHECK_EQ(0, input_count);
163 break; 172 break;
164 case IrOpcode::kPhi: { 173 case IrOpcode::kPhi: {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 // All control nodes reachable from end are reachable from start. 232 // All control nodes reachable from end are reachable from start.
224 for (NodeSet::iterator it = visitor.reached_from_end.begin(); 233 for (NodeSet::iterator it = visitor.reached_from_end.begin();
225 it != visitor.reached_from_end.end(); ++it) { 234 it != visitor.reached_from_end.end(); ++it) {
226 CHECK(!NodeProperties::IsControl(*it) || 235 CHECK(!NodeProperties::IsControl(*it) ||
227 visitor.reached_from_start.count(*it)); 236 visitor.reached_from_start.count(*it));
228 } 237 }
229 } 238 }
230 } 239 }
231 } 240 }
232 } // namespace v8::internal::compiler 241 } // namespace v8::internal::compiler
OLDNEW
« no previous file with comments | « src/compiler/structured-machine-assembler.cc ('k') | test/cctest/compiler/graph-builder-tester.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698