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

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

Issue 1157023002: [turbofan] Change End to take a variable number of inputs. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 const SharedOperator kSharedOperators[] = { 42 const SharedOperator kSharedOperators[] = {
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(Dead, Operator::kFoldable, 0, 0, 0, 0, 0, 1), 51 SHARED(Dead, Operator::kFoldable, 0, 0, 0, 0, 0, 1),
52 SHARED(End, Operator::kKontrol, 0, 0, 1, 0, 0, 0),
53 SHARED(IfTrue, Operator::kKontrol, 0, 0, 1, 0, 0, 1), 52 SHARED(IfTrue, Operator::kKontrol, 0, 0, 1, 0, 0, 1),
54 SHARED(IfFalse, Operator::kKontrol, 0, 0, 1, 0, 0, 1), 53 SHARED(IfFalse, Operator::kKontrol, 0, 0, 1, 0, 0, 1),
55 SHARED(IfSuccess, Operator::kKontrol, 0, 0, 1, 0, 0, 1), 54 SHARED(IfSuccess, Operator::kKontrol, 0, 0, 1, 0, 0, 1),
56 SHARED(IfException, Operator::kKontrol, 0, 0, 1, 1, 0, 1), 55 SHARED(IfException, Operator::kKontrol, 0, 0, 1, 1, 0, 1),
57 SHARED(Throw, Operator::kKontrol, 1, 1, 1, 0, 0, 1), 56 SHARED(Throw, Operator::kKontrol, 1, 1, 1, 0, 0, 1),
58 SHARED(Return, Operator::kNoThrow, 1, 1, 1, 0, 0, 1), 57 SHARED(Return, Operator::kNoThrow, 1, 1, 1, 0, 0, 1),
59 SHARED(Terminate, Operator::kNoThrow, 0, 1, 1, 0, 0, 1) 58 SHARED(Terminate, Operator::kNoThrow, 0, 1, 1, 0, 0, 1)
60 #undef SHARED 59 #undef SHARED
61 }; 60 };
62 61
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 -1.0, 154 -1.0,
156 -0.0, 155 -0.0,
157 0.0, 156 0.0,
158 1.0, 157 1.0,
159 std::numeric_limits<double>::max(), 158 std::numeric_limits<double>::max(),
160 std::numeric_limits<double>::infinity(), 159 std::numeric_limits<double>::infinity(),
161 std::numeric_limits<double>::quiet_NaN(), 160 std::numeric_limits<double>::quiet_NaN(),
162 std::numeric_limits<double>::signaling_NaN()}; 161 std::numeric_limits<double>::signaling_NaN()};
163 162
164 163
164 const size_t kInputCounts[] = {3, 4, 100, 255, 1024, 65000};
165
166
165 const int32_t kInt32Values[] = { 167 const int32_t kInt32Values[] = {
166 std::numeric_limits<int32_t>::min(), -1914954528, -1698749618, -1578693386, 168 std::numeric_limits<int32_t>::min(), -1914954528, -1698749618, -1578693386,
167 -1577976073, -1573998034, -1529085059, -1499540537, -1299205097, 169 -1577976073, -1573998034, -1529085059, -1499540537, -1299205097,
168 -1090814845, -938186388, -806828902, -750927650, -520676892, -513661538, 170 -1090814845, -938186388, -806828902, -750927650, -520676892, -513661538,
169 -453036354, -433622833, -282638793, -28375, -27788, -22770, -18806, -14173, 171 -453036354, -433622833, -282638793, -28375, -27788, -22770, -18806, -14173,
170 -11956, -11200, -10212, -8160, -3751, -2758, -1522, -121, -120, -118, -117, 172 -11956, -11200, -10212, -8160, -3751, -2758, -1522, -121, -120, -118, -117,
171 -106, -84, -80, -74, -59, -52, -48, -39, -35, -17, -11, -10, -9, -7, -5, 0, 173 -106, -84, -80, -74, -59, -52, -48, -39, -35, -17, -11, -10, -9, -7, -5, 0,
172 9, 12, 17, 23, 29, 31, 33, 35, 40, 47, 55, 56, 62, 64, 67, 68, 69, 74, 79, 174 9, 12, 17, 23, 29, 31, 33, 35, 40, 47, 55, 56, 62, 64, 67, 68, 69, 74, 79,
173 84, 89, 90, 97, 104, 118, 124, 126, 127, 7278, 17787, 24136, 24202, 25570, 175 84, 89, 90, 97, 104, 118, 124, 126, 127, 7278, 17787, 24136, 24202, 25570,
174 26680, 30242, 32399, 420886487, 642166225, 821912648, 822577803, 851385718, 176 26680, 30242, 32399, 420886487, 642166225, 821912648, 822577803, 851385718,
175 1212241078, 1411419304, 1589626102, 1596437184, 1876245816, 1954730266, 177 1212241078, 1411419304, 1589626102, 1596437184, 1876245816, 1954730266,
176 2008792749, 2045320228, std::numeric_limits<int32_t>::max()}; 178 2008792749, 2045320228, std::numeric_limits<int32_t>::max()};
177 179
178 180
179 const BranchHint kHints[] = {BranchHint::kNone, BranchHint::kTrue, 181 const BranchHint kHints[] = {BranchHint::kNone, BranchHint::kTrue,
180 BranchHint::kFalse}; 182 BranchHint::kFalse};
181 183
182 } // namespace 184 } // namespace
183 185
184 186
187 TEST_F(CommonOperatorTest, End) {
188 TRACED_FOREACH(size_t, input_count, kInputCounts) {
189 const Operator* const op = common()->End(input_count);
190 EXPECT_EQ(IrOpcode::kEnd, op->opcode());
191 EXPECT_EQ(Operator::kKontrol, op->properties());
192 EXPECT_EQ(0, op->ValueInputCount());
193 EXPECT_EQ(0, op->EffectInputCount());
194 EXPECT_EQ(input_count, op->ControlInputCount());
195 EXPECT_EQ(input_count, OperatorProperties::GetTotalInputCount(op));
196 EXPECT_EQ(0, op->ValueOutputCount());
197 EXPECT_EQ(0, op->EffectOutputCount());
198 EXPECT_EQ(0, op->ControlOutputCount());
199 }
200 }
201
202
185 TEST_F(CommonOperatorTest, Branch) { 203 TEST_F(CommonOperatorTest, Branch) {
186 TRACED_FOREACH(BranchHint, hint, kHints) { 204 TRACED_FOREACH(BranchHint, hint, kHints) {
187 const Operator* const op = common()->Branch(hint); 205 const Operator* const op = common()->Branch(hint);
188 EXPECT_EQ(IrOpcode::kBranch, op->opcode()); 206 EXPECT_EQ(IrOpcode::kBranch, op->opcode());
189 EXPECT_EQ(Operator::kKontrol, op->properties()); 207 EXPECT_EQ(Operator::kKontrol, op->properties());
190 EXPECT_EQ(hint, BranchHintOf(op)); 208 EXPECT_EQ(hint, BranchHintOf(op));
191 EXPECT_EQ(1, op->ValueInputCount()); 209 EXPECT_EQ(1, op->ValueInputCount());
192 EXPECT_EQ(0, op->EffectInputCount()); 210 EXPECT_EQ(0, op->EffectInputCount());
193 EXPECT_EQ(1, op->ControlInputCount()); 211 EXPECT_EQ(1, op->ControlInputCount());
194 EXPECT_EQ(2, OperatorProperties::GetTotalInputCount(op)); 212 EXPECT_EQ(2, OperatorProperties::GetTotalInputCount(op));
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 EXPECT_EQ(arguments + 1, OperatorProperties::GetTotalInputCount(op)); 357 EXPECT_EQ(arguments + 1, OperatorProperties::GetTotalInputCount(op));
340 EXPECT_EQ(0, op->ControlOutputCount()); 358 EXPECT_EQ(0, op->ControlOutputCount());
341 EXPECT_EQ(0, op->EffectOutputCount()); 359 EXPECT_EQ(0, op->EffectOutputCount());
342 EXPECT_EQ(1, op->ValueOutputCount()); 360 EXPECT_EQ(1, op->ValueOutputCount());
343 } 361 }
344 } 362 }
345 363
346 } // namespace compiler 364 } // namespace compiler
347 } // namespace internal 365 } // namespace internal
348 } // namespace v8 366 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698