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

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

Issue 1738973002: [turbofan] More "auto" keyword cleanup (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 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/instruction-scheduler.cc ('k') | src/compiler/zone-pool.cc » ('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 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 <algorithm> 7 #include <algorithm>
8 #include <deque> 8 #include <deque>
9 #include <queue> 9 #include <queue>
10 #include <sstream> 10 #include <sstream>
(...skipping 11 matching lines...) Expand all
22 #include "src/compiler/schedule.h" 22 #include "src/compiler/schedule.h"
23 #include "src/compiler/simplified-operator.h" 23 #include "src/compiler/simplified-operator.h"
24 #include "src/ostreams.h" 24 #include "src/ostreams.h"
25 25
26 namespace v8 { 26 namespace v8 {
27 namespace internal { 27 namespace internal {
28 namespace compiler { 28 namespace compiler {
29 29
30 30
31 static bool IsDefUseChainLinkPresent(Node* def, Node* use) { 31 static bool IsDefUseChainLinkPresent(Node* def, Node* use) {
32 auto const uses = def->uses(); 32 const Node::Uses uses = def->uses();
33 return std::find(uses.begin(), uses.end(), use) != uses.end(); 33 return std::find(uses.begin(), uses.end(), use) != uses.end();
34 } 34 }
35 35
36 36
37 static bool IsUseDefChainLinkPresent(Node* def, Node* use) { 37 static bool IsUseDefChainLinkPresent(Node* def, Node* use) {
38 auto const inputs = use->inputs(); 38 const Node::Inputs inputs = use->inputs();
39 return std::find(inputs.begin(), inputs.end(), def) != inputs.end(); 39 return std::find(inputs.begin(), inputs.end(), def) != inputs.end();
40 } 40 }
41 41
42 42
43 class Verifier::Visitor { 43 class Verifier::Visitor {
44 public: 44 public:
45 Visitor(Zone* z, Typing typed) : zone(z), typing(typed) {} 45 Visitor(Zone* z, Typing typed) : zone(z), typing(typed) {}
46 46
47 void Check(Node* node); 47 void Check(Node* node);
48 48
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 // Type is empty. 187 // Type is empty.
188 CheckNotTyped(node); 188 CheckNotTyped(node);
189 break; 189 break;
190 case IrOpcode::kDead: 190 case IrOpcode::kDead:
191 // Dead is never connected to the graph. 191 // Dead is never connected to the graph.
192 UNREACHABLE(); 192 UNREACHABLE();
193 break; 193 break;
194 case IrOpcode::kBranch: { 194 case IrOpcode::kBranch: {
195 // Branch uses are IfTrue and IfFalse. 195 // Branch uses are IfTrue and IfFalse.
196 int count_true = 0, count_false = 0; 196 int count_true = 0, count_false = 0;
197 for (auto use : node->uses()) { 197 for (const Node* use : node->uses()) {
198 CHECK(use->opcode() == IrOpcode::kIfTrue || 198 CHECK(use->opcode() == IrOpcode::kIfTrue ||
199 use->opcode() == IrOpcode::kIfFalse); 199 use->opcode() == IrOpcode::kIfFalse);
200 if (use->opcode() == IrOpcode::kIfTrue) ++count_true; 200 if (use->opcode() == IrOpcode::kIfTrue) ++count_true;
201 if (use->opcode() == IrOpcode::kIfFalse) ++count_false; 201 if (use->opcode() == IrOpcode::kIfFalse) ++count_false;
202 } 202 }
203 CHECK_EQ(1, count_true); 203 CHECK_EQ(1, count_true);
204 CHECK_EQ(1, count_false); 204 CHECK_EQ(1, count_false);
205 // Type is empty. 205 // Type is empty.
206 CheckNotTyped(node); 206 CheckNotTyped(node);
207 break; 207 break;
(...skipping 17 matching lines...) Expand all
225 // IfSuccess and IfException continuation only on throwing nodes. 225 // IfSuccess and IfException continuation only on throwing nodes.
226 Node* input = NodeProperties::GetControlInput(node, 0); 226 Node* input = NodeProperties::GetControlInput(node, 0);
227 CHECK(!input->op()->HasProperty(Operator::kNoThrow)); 227 CHECK(!input->op()->HasProperty(Operator::kNoThrow));
228 // Type can be anything. 228 // Type can be anything.
229 CheckUpperIs(node, Type::Any()); 229 CheckUpperIs(node, Type::Any());
230 break; 230 break;
231 } 231 }
232 case IrOpcode::kSwitch: { 232 case IrOpcode::kSwitch: {
233 // Switch uses are Case and Default. 233 // Switch uses are Case and Default.
234 int count_case = 0, count_default = 0; 234 int count_case = 0, count_default = 0;
235 for (auto use : node->uses()) { 235 for (const Node* use : node->uses()) {
236 switch (use->opcode()) { 236 switch (use->opcode()) {
237 case IrOpcode::kIfValue: { 237 case IrOpcode::kIfValue: {
238 for (auto user : node->uses()) { 238 for (const Node* user : node->uses()) {
239 if (user != use && user->opcode() == IrOpcode::kIfValue) { 239 if (user != use && user->opcode() == IrOpcode::kIfValue) {
240 CHECK_NE(OpParameter<int32_t>(use->op()), 240 CHECK_NE(OpParameter<int32_t>(use->op()),
241 OpParameter<int32_t>(user->op())); 241 OpParameter<int32_t>(user->op()));
242 } 242 }
243 } 243 }
244 ++count_case; 244 ++count_case;
245 break; 245 break;
246 } 246 }
247 case IrOpcode::kIfDefault: { 247 case IrOpcode::kIfDefault: {
248 ++count_default; 248 ++count_default;
(...skipping 27 matching lines...) Expand all
276 break; 276 break;
277 case IrOpcode::kDeoptimizeIf: 277 case IrOpcode::kDeoptimizeIf:
278 case IrOpcode::kDeoptimizeUnless: 278 case IrOpcode::kDeoptimizeUnless:
279 // Type is empty. 279 // Type is empty.
280 CheckNotTyped(node); 280 CheckNotTyped(node);
281 break; 281 break;
282 case IrOpcode::kDeoptimize: 282 case IrOpcode::kDeoptimize:
283 case IrOpcode::kReturn: 283 case IrOpcode::kReturn:
284 case IrOpcode::kThrow: 284 case IrOpcode::kThrow:
285 // Deoptimize, Return and Throw uses are End. 285 // Deoptimize, Return and Throw uses are End.
286 for (auto use : node->uses()) { 286 for (const Node* use : node->uses()) {
287 CHECK_EQ(IrOpcode::kEnd, use->opcode()); 287 CHECK_EQ(IrOpcode::kEnd, use->opcode());
288 } 288 }
289 // Type is empty. 289 // Type is empty.
290 CheckNotTyped(node); 290 CheckNotTyped(node);
291 break; 291 break;
292 case IrOpcode::kTerminate: 292 case IrOpcode::kTerminate:
293 // Terminates take one loop and effect. 293 // Terminates take one loop and effect.
294 CHECK_EQ(1, control_count); 294 CHECK_EQ(1, control_count);
295 CHECK_EQ(1, effect_count); 295 CHECK_EQ(1, effect_count);
296 CHECK_EQ(2, input_count); 296 CHECK_EQ(2, input_count);
297 CHECK_EQ(IrOpcode::kLoop, 297 CHECK_EQ(IrOpcode::kLoop,
298 NodeProperties::GetControlInput(node)->opcode()); 298 NodeProperties::GetControlInput(node)->opcode());
299 // Terminate uses are End. 299 // Terminate uses are End.
300 for (auto use : node->uses()) { 300 for (const Node* use : node->uses()) {
301 CHECK_EQ(IrOpcode::kEnd, use->opcode()); 301 CHECK_EQ(IrOpcode::kEnd, use->opcode());
302 } 302 }
303 // Type is empty. 303 // Type is empty.
304 CheckNotTyped(node); 304 CheckNotTyped(node);
305 break; 305 break;
306 case IrOpcode::kOsrNormalEntry: 306 case IrOpcode::kOsrNormalEntry:
307 case IrOpcode::kOsrLoopEntry: 307 case IrOpcode::kOsrLoopEntry:
308 // Osr entries take one control and effect. 308 // Osr entries take one control and effect.
309 CHECK_EQ(1, control_count); 309 CHECK_EQ(1, control_count);
310 CHECK_EQ(1, effect_count); 310 CHECK_EQ(1, effect_count);
(...skipping 968 matching lines...) Expand 10 before | Expand all | Expand 10 after
1279 replacement->op()->EffectOutputCount() > 0); 1279 replacement->op()->EffectOutputCount() > 0);
1280 DCHECK(!NodeProperties::IsFrameStateEdge(edge) || 1280 DCHECK(!NodeProperties::IsFrameStateEdge(edge) ||
1281 replacement->opcode() == IrOpcode::kFrameState); 1281 replacement->opcode() == IrOpcode::kFrameState);
1282 } 1282 }
1283 1283
1284 #endif // DEBUG 1284 #endif // DEBUG
1285 1285
1286 } // namespace compiler 1286 } // namespace compiler
1287 } // namespace internal 1287 } // namespace internal
1288 } // namespace v8 1288 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/instruction-scheduler.cc ('k') | src/compiler/zone-pool.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698