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

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

Issue 691513002: [turbofan] Introduce new Select operator to improve bounds checking. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 1 month 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 | Annotate | Revision Log
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/common-operator.h" 5 #include "src/compiler/common-operator.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "src/compiler/operator-properties-inl.h" 9 #include "src/compiler/operator-properties-inl.h"
10 #include "test/unittests/test-utils.h" 10 #include "test/unittests/test-utils.h"
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 std::numeric_limits<double>::min(), 149 std::numeric_limits<double>::min(),
150 -1.0, 150 -1.0,
151 -0.0, 151 -0.0,
152 0.0, 152 0.0,
153 1.0, 153 1.0,
154 std::numeric_limits<double>::max(), 154 std::numeric_limits<double>::max(),
155 std::numeric_limits<double>::infinity(), 155 std::numeric_limits<double>::infinity(),
156 std::numeric_limits<double>::quiet_NaN(), 156 std::numeric_limits<double>::quiet_NaN(),
157 std::numeric_limits<double>::signaling_NaN()}; 157 std::numeric_limits<double>::signaling_NaN()};
158 158
159
160 const BranchHint kHints[] = {BranchHint::kNone, BranchHint::kTrue,
161 BranchHint::kFalse};
162
159 } // namespace 163 } // namespace
160 164
161 165
162 TEST_F(CommonOperatorTest, Branch) { 166 TEST_F(CommonOperatorTest, Branch) {
163 static const BranchHint kHints[] = {BranchHint::kNone, BranchHint::kTrue,
164 BranchHint::kFalse};
165 TRACED_FOREACH(BranchHint, hint, kHints) { 167 TRACED_FOREACH(BranchHint, hint, kHints) {
166 const Operator* const op = common()->Branch(hint); 168 const Operator* const op = common()->Branch(hint);
167 EXPECT_EQ(IrOpcode::kBranch, op->opcode()); 169 EXPECT_EQ(IrOpcode::kBranch, op->opcode());
168 EXPECT_EQ(Operator::kFoldable, op->properties()); 170 EXPECT_EQ(Operator::kFoldable, op->properties());
171 EXPECT_EQ(hint, BranchHintOf(op));
169 EXPECT_EQ(1, OperatorProperties::GetValueInputCount(op)); 172 EXPECT_EQ(1, OperatorProperties::GetValueInputCount(op));
170 EXPECT_EQ(0, OperatorProperties::GetEffectInputCount(op)); 173 EXPECT_EQ(0, OperatorProperties::GetEffectInputCount(op));
171 EXPECT_EQ(1, OperatorProperties::GetControlInputCount(op)); 174 EXPECT_EQ(1, OperatorProperties::GetControlInputCount(op));
172 EXPECT_EQ(2, OperatorProperties::GetTotalInputCount(op)); 175 EXPECT_EQ(2, OperatorProperties::GetTotalInputCount(op));
173 EXPECT_EQ(0, OperatorProperties::GetValueOutputCount(op)); 176 EXPECT_EQ(0, OperatorProperties::GetValueOutputCount(op));
174 EXPECT_EQ(0, OperatorProperties::GetEffectOutputCount(op)); 177 EXPECT_EQ(0, OperatorProperties::GetEffectOutputCount(op));
175 EXPECT_EQ(2, OperatorProperties::GetControlOutputCount(op)); 178 EXPECT_EQ(2, OperatorProperties::GetControlOutputCount(op));
176 } 179 }
177 } 180 }
178 181
179 182
183 TEST_F(CommonOperatorTest, Select) {
184 static const MachineType kTypes[] = {
185 kMachInt8, kMachUint8, kMachInt16, kMachUint16,
186 kMachInt32, kMachUint32, kMachInt64, kMachUint64,
187 kMachFloat32, kMachFloat64, kMachAnyTagged};
188 TRACED_FOREACH(MachineType, type, kTypes) {
189 TRACED_FOREACH(BranchHint, hint, kHints) {
190 const Operator* const op = common()->Select(type, hint);
191 EXPECT_EQ(IrOpcode::kSelect, op->opcode());
192 EXPECT_EQ(Operator::kPure, op->properties());
193 EXPECT_EQ(type, SelectParametersOf(op).type());
194 EXPECT_EQ(hint, SelectParametersOf(op).hint());
195 EXPECT_EQ(3, OperatorProperties::GetValueInputCount(op));
196 EXPECT_EQ(0, OperatorProperties::GetEffectInputCount(op));
197 EXPECT_EQ(0, OperatorProperties::GetControlInputCount(op));
198 EXPECT_EQ(3, OperatorProperties::GetTotalInputCount(op));
199 EXPECT_EQ(1, OperatorProperties::GetValueOutputCount(op));
200 EXPECT_EQ(0, OperatorProperties::GetEffectOutputCount(op));
201 EXPECT_EQ(0, OperatorProperties::GetControlOutputCount(op));
202 }
203 }
204 }
205
206
180 TEST_F(CommonOperatorTest, Float32Constant) { 207 TEST_F(CommonOperatorTest, Float32Constant) {
181 TRACED_FOREACH(float, value, kFloatValues) { 208 TRACED_FOREACH(float, value, kFloatValues) {
182 const Operator* op = common()->Float32Constant(value); 209 const Operator* op = common()->Float32Constant(value);
183 EXPECT_PRED2(base::bit_equal_to<float>(), value, OpParameter<float>(op)); 210 EXPECT_PRED2(base::bit_equal_to<float>(), value, OpParameter<float>(op));
184 EXPECT_EQ(0, OperatorProperties::GetValueInputCount(op)); 211 EXPECT_EQ(0, OperatorProperties::GetValueInputCount(op));
185 EXPECT_EQ(0, OperatorProperties::GetTotalInputCount(op)); 212 EXPECT_EQ(0, OperatorProperties::GetTotalInputCount(op));
186 EXPECT_EQ(0, OperatorProperties::GetControlOutputCount(op)); 213 EXPECT_EQ(0, OperatorProperties::GetControlOutputCount(op));
187 EXPECT_EQ(0, OperatorProperties::GetEffectOutputCount(op)); 214 EXPECT_EQ(0, OperatorProperties::GetEffectOutputCount(op));
188 EXPECT_EQ(1, OperatorProperties::GetValueOutputCount(op)); 215 EXPECT_EQ(1, OperatorProperties::GetValueOutputCount(op));
189 } 216 }
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 EXPECT_EQ(arguments + 1, OperatorProperties::GetTotalInputCount(op)); 287 EXPECT_EQ(arguments + 1, OperatorProperties::GetTotalInputCount(op));
261 EXPECT_EQ(0, OperatorProperties::GetControlOutputCount(op)); 288 EXPECT_EQ(0, OperatorProperties::GetControlOutputCount(op));
262 EXPECT_EQ(0, OperatorProperties::GetEffectOutputCount(op)); 289 EXPECT_EQ(0, OperatorProperties::GetEffectOutputCount(op));
263 EXPECT_EQ(1, OperatorProperties::GetValueOutputCount(op)); 290 EXPECT_EQ(1, OperatorProperties::GetValueOutputCount(op));
264 } 291 }
265 } 292 }
266 293
267 } // namespace compiler 294 } // namespace compiler
268 } // namespace internal 295 } // namespace internal
269 } // namespace v8 296 } // namespace v8
OLDNEW
« no previous file with comments | « test/mjsunit/asm/int16array-outofbounds.js ('k') | test/unittests/compiler/js-typed-lowering-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698