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

Side by Side Diff: test/unittests/compiler/schedule-unittest.cc

Issue 928213003: Model exceptional edges from call nodes in TurboFan. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebased. Created 5 years, 10 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 | « test/unittests/compiler/node-properties-unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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 #include "src/compiler/schedule.h" 6 #include "src/compiler/schedule.h"
7 #include "test/unittests/test-utils.h" 7 #include "test/unittests/test-utils.h"
8 #include "testing/gmock/include/gmock/gmock.h" 8 #include "testing/gmock/include/gmock/gmock.h"
9 9
10 using testing::ElementsAre; 10 using testing::ElementsAre;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 EXPECT_EQ(&b0, BasicBlock::GetCommonDominator(&b1, &b3)); 66 EXPECT_EQ(&b0, BasicBlock::GetCommonDominator(&b1, &b3));
67 EXPECT_EQ(&b0, BasicBlock::GetCommonDominator(&b3, &b1)); 67 EXPECT_EQ(&b0, BasicBlock::GetCommonDominator(&b3, &b1));
68 } 68 }
69 69
70 70
71 typedef TestWithZone ScheduleTest; 71 typedef TestWithZone ScheduleTest;
72 72
73 73
74 namespace { 74 namespace {
75 75
76 const Operator kCallOperator(IrOpcode::kCall, Operator::kNoProperties,
77 "MockCall", 0, 0, 0, 0, 0, 0);
76 const Operator kBranchOperator(IrOpcode::kBranch, Operator::kNoProperties, 78 const Operator kBranchOperator(IrOpcode::kBranch, Operator::kNoProperties,
77 "Branch", 0, 0, 0, 0, 0, 0); 79 "MockBranch", 0, 0, 0, 0, 0, 0);
78 const Operator kDummyOperator(IrOpcode::kParameter, Operator::kNoProperties, 80 const Operator kDummyOperator(IrOpcode::kParameter, Operator::kNoProperties,
79 "Dummy", 0, 0, 0, 0, 0, 0); 81 "Dummy", 0, 0, 0, 0, 0, 0);
80 82
81 } // namespace 83 } // namespace
82 84
83 85
84 TEST_F(ScheduleTest, Constructor) { 86 TEST_F(ScheduleTest, Constructor) {
85 Schedule schedule(zone()); 87 Schedule schedule(zone());
86 EXPECT_NE(nullptr, schedule.start()); 88 EXPECT_NE(nullptr, schedule.start());
87 EXPECT_EQ(schedule.start(), 89 EXPECT_EQ(schedule.start(),
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 EXPECT_EQ(1u, block->PredecessorCount()); 130 EXPECT_EQ(1u, block->PredecessorCount());
129 EXPECT_EQ(0u, block->SuccessorCount()); 131 EXPECT_EQ(0u, block->SuccessorCount());
130 EXPECT_EQ(start, block->PredecessorAt(0)); 132 EXPECT_EQ(start, block->PredecessorAt(0));
131 EXPECT_THAT(block->predecessors(), ElementsAre(start)); 133 EXPECT_THAT(block->predecessors(), ElementsAre(start));
132 134
133 EXPECT_EQ(0u, end->PredecessorCount()); 135 EXPECT_EQ(0u, end->PredecessorCount());
134 EXPECT_EQ(0u, end->SuccessorCount()); 136 EXPECT_EQ(0u, end->SuccessorCount());
135 } 137 }
136 138
137 139
140 TEST_F(ScheduleTest, AddCall) {
141 Schedule schedule(zone());
142 BasicBlock* start = schedule.start();
143
144 Node* call = Node::New(zone(), 0, &kCallOperator, 0, nullptr, false);
145 BasicBlock* sblock = schedule.NewBasicBlock();
146 BasicBlock* eblock = schedule.NewBasicBlock();
147 schedule.AddCall(start, call, sblock, eblock);
148
149 EXPECT_EQ(start, schedule.block(call));
150
151 EXPECT_EQ(0u, start->PredecessorCount());
152 EXPECT_EQ(2u, start->SuccessorCount());
153 EXPECT_EQ(sblock, start->SuccessorAt(0));
154 EXPECT_EQ(eblock, start->SuccessorAt(1));
155 EXPECT_THAT(start->successors(), ElementsAre(sblock, eblock));
156
157 EXPECT_EQ(1u, sblock->PredecessorCount());
158 EXPECT_EQ(0u, sblock->SuccessorCount());
159 EXPECT_EQ(start, sblock->PredecessorAt(0));
160 EXPECT_THAT(sblock->predecessors(), ElementsAre(start));
161
162 EXPECT_EQ(1u, eblock->PredecessorCount());
163 EXPECT_EQ(0u, eblock->SuccessorCount());
164 EXPECT_EQ(start, eblock->PredecessorAt(0));
165 EXPECT_THAT(eblock->predecessors(), ElementsAre(start));
166 }
167
168
138 TEST_F(ScheduleTest, AddBranch) { 169 TEST_F(ScheduleTest, AddBranch) {
139 Schedule schedule(zone()); 170 Schedule schedule(zone());
140 BasicBlock* start = schedule.start(); 171 BasicBlock* start = schedule.start();
141 172
142 Node* branch = Node::New(zone(), 0, &kBranchOperator, 0, nullptr, false); 173 Node* branch = Node::New(zone(), 0, &kBranchOperator, 0, nullptr, false);
143 BasicBlock* tblock = schedule.NewBasicBlock(); 174 BasicBlock* tblock = schedule.NewBasicBlock();
144 BasicBlock* fblock = schedule.NewBasicBlock(); 175 BasicBlock* fblock = schedule.NewBasicBlock();
145 schedule.AddBranch(start, branch, tblock, fblock); 176 schedule.AddBranch(start, branch, tblock, fblock);
146 177
147 EXPECT_EQ(start, schedule.block(branch)); 178 EXPECT_EQ(start, schedule.block(branch));
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 240
210 EXPECT_EQ(1u, end->PredecessorCount()); 241 EXPECT_EQ(1u, end->PredecessorCount());
211 EXPECT_EQ(0u, end->SuccessorCount()); 242 EXPECT_EQ(0u, end->SuccessorCount());
212 EXPECT_EQ(mblock, end->PredecessorAt(0)); 243 EXPECT_EQ(mblock, end->PredecessorAt(0));
213 EXPECT_THAT(end->predecessors(), ElementsAre(mblock)); 244 EXPECT_THAT(end->predecessors(), ElementsAre(mblock));
214 } 245 }
215 246
216 } // namespace compiler 247 } // namespace compiler
217 } // namespace internal 248 } // namespace internal
218 } // namespace v8 249 } // namespace v8
OLDNEW
« no previous file with comments | « test/unittests/compiler/node-properties-unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698