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

Side by Side Diff: test/cctest/compiler/test-loop-analysis.cc

Issue 1368913002: [turbofan] Check node input/use consistency for changed operators and new nodes. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Tweak Created 5 years, 2 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/select-lowering.cc ('k') | test/cctest/compiler/test-machine-operator-reducer.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/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/compiler/access-builder.h" 7 #include "src/compiler/access-builder.h"
8 #include "src/compiler/common-operator.h" 8 #include "src/compiler/common-operator.h"
9 #include "src/compiler/graph.h" 9 #include "src/compiler/graph.h"
10 #include "src/compiler/graph-visualizer.h" 10 #include "src/compiler/graph-visualizer.h"
11 #include "src/compiler/js-graph.h" 11 #include "src/compiler/js-graph.h"
12 #include "src/compiler/js-operator.h" 12 #include "src/compiler/js-operator.h"
13 #include "src/compiler/loop-analysis.h" 13 #include "src/compiler/loop-analysis.h"
14 #include "src/compiler/node.h" 14 #include "src/compiler/node.h"
15 #include "src/compiler/opcodes.h" 15 #include "src/compiler/opcodes.h"
16 #include "src/compiler/operator.h" 16 #include "src/compiler/operator.h"
17 #include "src/compiler/schedule.h" 17 #include "src/compiler/schedule.h"
18 #include "src/compiler/scheduler.h" 18 #include "src/compiler/scheduler.h"
19 #include "src/compiler/simplified-operator.h" 19 #include "src/compiler/simplified-operator.h"
20 #include "src/compiler/verifier.h" 20 #include "src/compiler/verifier.h"
21 #include "test/cctest/cctest.h" 21 #include "test/cctest/cctest.h"
22 22
23 using namespace v8::internal; 23 using namespace v8::internal;
24 using namespace v8::internal::compiler; 24 using namespace v8::internal::compiler;
25 25
26 static Operator kIntAdd(IrOpcode::kInt32Add, Operator::kPure, "Int32Add", 2, 0, 26 static Operator kIntAdd(IrOpcode::kInt32Add, Operator::kPure, "Int32Add", 2, 0,
27 0, 1, 0, 0); 27 0, 1, 0, 0);
28 static Operator kIntLt(IrOpcode::kInt32LessThan, Operator::kPure, 28 static Operator kIntLt(IrOpcode::kInt32LessThan, Operator::kPure,
29 "Int32LessThan", 2, 0, 0, 1, 0, 0); 29 "Int32LessThan", 2, 0, 0, 1, 0, 0);
30 static Operator kStore(IrOpcode::kStore, Operator::kNoProperties, "Store", 0, 2, 30 static Operator kStore(IrOpcode::kStore, Operator::kNoProperties, "Store", 1, 1,
31 1, 0, 1, 0); 31 1, 0, 1, 0);
32 32
33 static const int kNumLeafs = 4; 33 static const int kNumLeafs = 4;
34 34
35 // A helper for all tests dealing with LoopFinder. 35 // A helper for all tests dealing with LoopFinder.
36 class LoopFinderTester : HandleAndZoneScope { 36 class LoopFinderTester : HandleAndZoneScope {
37 public: 37 public:
38 LoopFinderTester() 38 LoopFinderTester()
39 : isolate(main_isolate()), 39 : isolate(main_isolate()),
40 common(main_zone()), 40 common(main_zone()),
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 }; 227 };
228 228
229 229
230 struct StoreLoop { 230 struct StoreLoop {
231 Node* base; 231 Node* base;
232 Node* val; 232 Node* val;
233 Node* phi; 233 Node* phi;
234 Node* store; 234 Node* store;
235 235
236 explicit StoreLoop(While& w) 236 explicit StoreLoop(While& w)
237 : base(w.t.jsgraph.Int32Constant(12)), 237 : base(w.t.graph.start()), val(w.t.jsgraph.Int32Constant(13)) {
238 val(w.t.jsgraph.Int32Constant(13)) {
239 Build(w); 238 Build(w);
240 } 239 }
241 240
242 StoreLoop(While& w, Node* b, Node* v) : base(b), val(v) { Build(w); } 241 StoreLoop(While& w, Node* b, Node* v) : base(b), val(v) { Build(w); }
243 242
244 void Build(While& w) { 243 void Build(While& w) {
245 phi = w.t.graph.NewNode(w.t.op(2, true), base, base, w.loop); 244 phi = w.t.graph.NewNode(w.t.op(2, true), base, base, w.loop);
246 store = w.t.graph.NewNode(&kStore, phi, val, w.loop); 245 store = w.t.graph.NewNode(&kStore, val, phi, w.loop);
247 phi->ReplaceInput(1, store); 246 phi->ReplaceInput(1, store);
248 } 247 }
249 }; 248 };
250 249
251 250
252 TEST(LaLoop1) { 251 TEST(LaLoop1) {
253 // One loop. 252 // One loop.
254 LoopFinderTester t; 253 LoopFinderTester t;
255 While w(t, t.p0); 254 While w(t, t.p0);
256 t.Return(t.p0, t.start, w.exit); 255 t.Return(t.p0, t.start, w.exit);
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 Node* p1b = t.graph.NewNode(op, t.p0, t.p0, w1.loop); 481 Node* p1b = t.graph.NewNode(op, t.p0, t.p0, w1.loop);
483 Node* p2a = t.graph.NewNode(op, p1a, t.p0, w2.loop); 482 Node* p2a = t.graph.NewNode(op, p1a, t.p0, w2.loop);
484 Node* p2b = t.graph.NewNode(op, p1b, t.p0, w2.loop); 483 Node* p2b = t.graph.NewNode(op, p1b, t.p0, w2.loop);
485 484
486 p1a->ReplaceInput(1, p2b); 485 p1a->ReplaceInput(1, p2b);
487 p1b->ReplaceInput(1, p2a); 486 p1b->ReplaceInput(1, p2a);
488 487
489 p2a->ReplaceInput(1, p2b); 488 p2a->ReplaceInput(1, p2b);
490 p2b->ReplaceInput(1, p2a); 489 p2b->ReplaceInput(1, p2a);
491 490
492 t.Return(t.p0, p1a, w1.exit); 491 t.Return(t.p0, t.start, w1.exit);
493 492
494 Node* chain[] = {w1.loop, w2.loop}; 493 Node* chain[] = {w1.loop, w2.loop};
495 t.CheckNestedLoops(chain, 2); 494 t.CheckNestedLoops(chain, 2);
496 495
497 Node* h1[] = {w1.loop, p1a, p1b}; 496 Node* h1[] = {w1.loop, p1a, p1b};
498 Node* b1[] = {w1.branch, w1.if_true, w2.loop, p2a, 497 Node* b1[] = {w1.branch, w1.if_true, w2.loop, p2a,
499 p2b, w2.branch, w2.if_true, w2.exit}; 498 p2b, w2.branch, w2.if_true, w2.exit};
500 t.CheckLoop(h1, 3, b1, 8); 499 t.CheckLoop(h1, 3, b1, 8);
501 500
502 Node* h2[] = {w2.loop, p2a, p2b}; 501 Node* h2[] = {w2.loop, p2a, p2b};
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after
1006 TEST(LaManyNested_31) { RunManyNestedLoops_i(31); } 1005 TEST(LaManyNested_31) { RunManyNestedLoops_i(31); }
1007 TEST(LaManyNested_32) { RunManyNestedLoops_i(32); } 1006 TEST(LaManyNested_32) { RunManyNestedLoops_i(32); }
1008 TEST(LaManyNested_33) { RunManyNestedLoops_i(33); } 1007 TEST(LaManyNested_33) { RunManyNestedLoops_i(33); }
1009 TEST(LaManyNested_34) { RunManyNestedLoops_i(34); } 1008 TEST(LaManyNested_34) { RunManyNestedLoops_i(34); }
1010 TEST(LaManyNested_62) { RunManyNestedLoops_i(62); } 1009 TEST(LaManyNested_62) { RunManyNestedLoops_i(62); }
1011 TEST(LaManyNested_63) { RunManyNestedLoops_i(63); } 1010 TEST(LaManyNested_63) { RunManyNestedLoops_i(63); }
1012 TEST(LaManyNested_64) { RunManyNestedLoops_i(64); } 1011 TEST(LaManyNested_64) { RunManyNestedLoops_i(64); }
1013 1012
1014 1013
1015 TEST(LaPhiTangle) { LoopFinderTester t; } 1014 TEST(LaPhiTangle) { LoopFinderTester t; }
OLDNEW
« no previous file with comments | « src/compiler/select-lowering.cc ('k') | test/cctest/compiler/test-machine-operator-reducer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698