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

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

Issue 912393002: Mark some common operator with Property::kNoThrow. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix GVN failures. 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
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 <limits> 5 #include <limits>
6 6
7 #include "src/compiler/common-operator.h" 7 #include "src/compiler/common-operator.h"
8 #include "src/compiler/opcodes.h" 8 #include "src/compiler/opcodes.h"
9 #include "src/compiler/operator.h" 9 #include "src/compiler/operator.h"
10 #include "src/compiler/operator-properties.h" 10 #include "src/compiler/operator-properties.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 #define SHARED(Name, properties, value_input_count, effect_input_count, \ 43 #define SHARED(Name, properties, value_input_count, effect_input_count, \
44 control_input_count, value_output_count, effect_output_count, \ 44 control_input_count, value_output_count, effect_output_count, \
45 control_output_count) \ 45 control_output_count) \
46 { \ 46 { \
47 &CommonOperatorBuilder::Name, IrOpcode::k##Name, properties, \ 47 &CommonOperatorBuilder::Name, IrOpcode::k##Name, properties, \
48 value_input_count, effect_input_count, control_input_count, \ 48 value_input_count, effect_input_count, control_input_count, \
49 value_output_count, effect_output_count, control_output_count \ 49 value_output_count, effect_output_count, control_output_count \
50 } 50 }
51 SHARED(Always, Operator::kPure, 0, 0, 0, 1, 0, 0), 51 SHARED(Always, Operator::kPure, 0, 0, 0, 1, 0, 0),
52 SHARED(Dead, Operator::kFoldable, 0, 0, 0, 0, 0, 1), 52 SHARED(Dead, Operator::kFoldable, 0, 0, 0, 0, 0, 1),
53 SHARED(End, Operator::kFoldable, 0, 0, 1, 0, 0, 0), 53 SHARED(End, Operator::kKontrol, 0, 0, 1, 0, 0, 0),
54 SHARED(IfTrue, Operator::kFoldable, 0, 0, 1, 0, 0, 1), 54 SHARED(IfTrue, Operator::kKontrol, 0, 0, 1, 0, 0, 1),
55 SHARED(IfFalse, Operator::kFoldable, 0, 0, 1, 0, 0, 1), 55 SHARED(IfFalse, Operator::kKontrol, 0, 0, 1, 0, 0, 1),
56 SHARED(Throw, Operator::kFoldable, 1, 1, 1, 0, 0, 1), 56 SHARED(Throw, Operator::kFoldable, 1, 1, 1, 0, 0, 1),
57 SHARED(Return, Operator::kNoProperties, 1, 1, 1, 0, 0, 1) 57 SHARED(Return, Operator::kNoThrow, 1, 1, 1, 0, 0, 1)
58 #undef SHARED 58 #undef SHARED
59 }; 59 };
60 60
61 61
62 class CommonSharedOperatorTest 62 class CommonSharedOperatorTest
63 : public TestWithZone, 63 : public TestWithZone,
64 public ::testing::WithParamInterface<SharedOperator> {}; 64 public ::testing::WithParamInterface<SharedOperator> {};
65 65
66 } // namespace 66 } // namespace
67 67
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 const BranchHint kHints[] = {BranchHint::kNone, BranchHint::kTrue, 163 const BranchHint kHints[] = {BranchHint::kNone, BranchHint::kTrue,
164 BranchHint::kFalse}; 164 BranchHint::kFalse};
165 165
166 } // namespace 166 } // namespace
167 167
168 168
169 TEST_F(CommonOperatorTest, Branch) { 169 TEST_F(CommonOperatorTest, Branch) {
170 TRACED_FOREACH(BranchHint, hint, kHints) { 170 TRACED_FOREACH(BranchHint, hint, kHints) {
171 const Operator* const op = common()->Branch(hint); 171 const Operator* const op = common()->Branch(hint);
172 EXPECT_EQ(IrOpcode::kBranch, op->opcode()); 172 EXPECT_EQ(IrOpcode::kBranch, op->opcode());
173 EXPECT_EQ(Operator::kFoldable, op->properties()); 173 EXPECT_EQ(Operator::kKontrol, op->properties());
174 EXPECT_EQ(hint, BranchHintOf(op)); 174 EXPECT_EQ(hint, BranchHintOf(op));
175 EXPECT_EQ(1, op->ValueInputCount()); 175 EXPECT_EQ(1, op->ValueInputCount());
176 EXPECT_EQ(0, op->EffectInputCount()); 176 EXPECT_EQ(0, op->EffectInputCount());
177 EXPECT_EQ(1, op->ControlInputCount()); 177 EXPECT_EQ(1, op->ControlInputCount());
178 EXPECT_EQ(2, OperatorProperties::GetTotalInputCount(op)); 178 EXPECT_EQ(2, OperatorProperties::GetTotalInputCount(op));
179 EXPECT_EQ(0, op->ValueOutputCount()); 179 EXPECT_EQ(0, op->ValueOutputCount());
180 EXPECT_EQ(0, op->EffectOutputCount()); 180 EXPECT_EQ(0, op->EffectOutputCount());
181 EXPECT_EQ(2, op->ControlOutputCount()); 181 EXPECT_EQ(2, op->ControlOutputCount());
182 } 182 }
183 } 183 }
184 184
185 185
186 TEST_F(CommonOperatorTest, Switch) { 186 TEST_F(CommonOperatorTest, Switch) {
187 TRACED_FOREACH(size_t, cases, kCases) { 187 TRACED_FOREACH(size_t, cases, kCases) {
188 const Operator* const op = common()->Switch(cases); 188 const Operator* const op = common()->Switch(cases);
189 EXPECT_EQ(IrOpcode::kSwitch, op->opcode()); 189 EXPECT_EQ(IrOpcode::kSwitch, op->opcode());
190 EXPECT_EQ(Operator::kFoldable, op->properties()); 190 EXPECT_EQ(Operator::kKontrol, op->properties());
191 EXPECT_EQ(1, op->ValueInputCount()); 191 EXPECT_EQ(1, op->ValueInputCount());
192 EXPECT_EQ(0, op->EffectInputCount()); 192 EXPECT_EQ(0, op->EffectInputCount());
193 EXPECT_EQ(1, op->ControlInputCount()); 193 EXPECT_EQ(1, op->ControlInputCount());
194 EXPECT_EQ(2, OperatorProperties::GetTotalInputCount(op)); 194 EXPECT_EQ(2, OperatorProperties::GetTotalInputCount(op));
195 EXPECT_EQ(0, op->ValueOutputCount()); 195 EXPECT_EQ(0, op->ValueOutputCount());
196 EXPECT_EQ(0, op->EffectOutputCount()); 196 EXPECT_EQ(0, op->EffectOutputCount());
197 EXPECT_EQ(static_cast<int>(cases), op->ControlOutputCount()); 197 EXPECT_EQ(static_cast<int>(cases), op->ControlOutputCount());
198 } 198 }
199 } 199 }
200 200
201 201
202 TEST_F(CommonOperatorTest, Case) { 202 TEST_F(CommonOperatorTest, Case) {
203 TRACED_FORRANGE(size_t, index, 0, 1024) { 203 TRACED_FORRANGE(size_t, index, 0, 1024) {
204 const Operator* const op = common()->Case(index); 204 const Operator* const op = common()->Case(index);
205 EXPECT_EQ(IrOpcode::kCase, op->opcode()); 205 EXPECT_EQ(IrOpcode::kCase, op->opcode());
206 EXPECT_EQ(Operator::kFoldable, op->properties()); 206 EXPECT_EQ(Operator::kKontrol, op->properties());
207 EXPECT_EQ(index, CaseIndexOf(op)); 207 EXPECT_EQ(index, CaseIndexOf(op));
208 EXPECT_EQ(0, op->ValueInputCount()); 208 EXPECT_EQ(0, op->ValueInputCount());
209 EXPECT_EQ(0, op->EffectInputCount()); 209 EXPECT_EQ(0, op->EffectInputCount());
210 EXPECT_EQ(1, op->ControlInputCount()); 210 EXPECT_EQ(1, op->ControlInputCount());
211 EXPECT_EQ(1, OperatorProperties::GetTotalInputCount(op)); 211 EXPECT_EQ(1, OperatorProperties::GetTotalInputCount(op));
212 EXPECT_EQ(0, op->ValueOutputCount()); 212 EXPECT_EQ(0, op->ValueOutputCount());
213 EXPECT_EQ(0, op->EffectOutputCount()); 213 EXPECT_EQ(0, op->EffectOutputCount());
214 EXPECT_EQ(1, op->ControlOutputCount()); 214 EXPECT_EQ(1, op->ControlOutputCount());
215 } 215 }
216 } 216 }
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 EXPECT_EQ(arguments + 1, OperatorProperties::GetTotalInputCount(op)); 323 EXPECT_EQ(arguments + 1, OperatorProperties::GetTotalInputCount(op));
324 EXPECT_EQ(0, op->ControlOutputCount()); 324 EXPECT_EQ(0, op->ControlOutputCount());
325 EXPECT_EQ(0, op->EffectOutputCount()); 325 EXPECT_EQ(0, op->EffectOutputCount());
326 EXPECT_EQ(1, op->ValueOutputCount()); 326 EXPECT_EQ(1, op->ValueOutputCount());
327 } 327 }
328 } 328 }
329 329
330 } // namespace compiler 330 } // namespace compiler
331 } // namespace internal 331 } // namespace internal
332 } // namespace v8 332 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/value-numbering-reducer.cc ('k') | test/unittests/compiler/value-numbering-reducer-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698