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

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

Issue 642883003: [turbofan] Add support for deferred code. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Add cctest Created 6 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 | Annotate | Revision Log
« no previous file with comments | « test/cctest/compiler/test-scheduler.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 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 29 matching lines...) Expand all
40 const SharedOperator kSharedOperators[] = { 40 const SharedOperator kSharedOperators[] = {
41 #define SHARED(Name, properties, value_input_count, effect_input_count, \ 41 #define SHARED(Name, properties, value_input_count, effect_input_count, \
42 control_input_count, effect_output_count, control_output_count) \ 42 control_input_count, effect_output_count, control_output_count) \
43 { \ 43 { \
44 &CommonOperatorBuilder::Name, IrOpcode::k##Name, properties, \ 44 &CommonOperatorBuilder::Name, IrOpcode::k##Name, properties, \
45 value_input_count, effect_input_count, control_input_count, \ 45 value_input_count, effect_input_count, control_input_count, \
46 effect_output_count, control_output_count \ 46 effect_output_count, control_output_count \
47 } 47 }
48 SHARED(Dead, Operator::kFoldable, 0, 0, 0, 0, 1), 48 SHARED(Dead, Operator::kFoldable, 0, 0, 0, 0, 1),
49 SHARED(End, Operator::kFoldable, 0, 0, 1, 0, 0), 49 SHARED(End, Operator::kFoldable, 0, 0, 1, 0, 0),
50 SHARED(Branch, Operator::kFoldable, 1, 0, 1, 0, 2),
51 SHARED(IfTrue, Operator::kFoldable, 0, 0, 1, 0, 1), 50 SHARED(IfTrue, Operator::kFoldable, 0, 0, 1, 0, 1),
52 SHARED(IfFalse, Operator::kFoldable, 0, 0, 1, 0, 1), 51 SHARED(IfFalse, Operator::kFoldable, 0, 0, 1, 0, 1),
53 SHARED(Throw, Operator::kFoldable, 1, 0, 1, 0, 1), 52 SHARED(Throw, Operator::kFoldable, 1, 0, 1, 0, 1),
54 SHARED(Return, Operator::kNoProperties, 1, 1, 1, 1, 1) 53 SHARED(Return, Operator::kNoProperties, 1, 1, 1, 1, 1)
55 #undef SHARED 54 #undef SHARED
56 }; 55 };
57 56
58 57
59 class CommonSharedOperatorTest 58 class CommonSharedOperatorTest
60 : public TestWithZone, 59 : public TestWithZone,
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 0.0, 152 0.0,
154 1.0, 153 1.0,
155 std::numeric_limits<double>::max(), 154 std::numeric_limits<double>::max(),
156 std::numeric_limits<double>::infinity(), 155 std::numeric_limits<double>::infinity(),
157 std::numeric_limits<double>::quiet_NaN(), 156 std::numeric_limits<double>::quiet_NaN(),
158 std::numeric_limits<double>::signaling_NaN()}; 157 std::numeric_limits<double>::signaling_NaN()};
159 158
160 } // namespace 159 } // namespace
161 160
162 161
162 TEST_F(CommonOperatorTest, Branch) {
163 static const BranchHint kHints[] = {BranchHint::kNone, BranchHint::kTrue,
164 BranchHint::kFalse};
165 TRACED_FOREACH(BranchHint, hint, kHints) {
166 const Operator* const op = common()->Branch(hint);
167 EXPECT_EQ(IrOpcode::kBranch, op->opcode());
168 EXPECT_EQ(Operator::kFoldable, op->properties());
169 EXPECT_EQ(1, OperatorProperties::GetValueInputCount(op));
170 EXPECT_EQ(0, OperatorProperties::GetEffectInputCount(op));
171 EXPECT_EQ(1, OperatorProperties::GetControlInputCount(op));
172 EXPECT_EQ(2, OperatorProperties::GetTotalInputCount(op));
173 EXPECT_EQ(0, OperatorProperties::GetValueOutputCount(op));
174 EXPECT_EQ(0, OperatorProperties::GetEffectOutputCount(op));
175 EXPECT_EQ(2, OperatorProperties::GetControlOutputCount(op));
176 }
177 }
178
179
163 TEST_F(CommonOperatorTest, Float32Constant) { 180 TEST_F(CommonOperatorTest, Float32Constant) {
164 TRACED_FOREACH(float, value, kFloatValues) { 181 TRACED_FOREACH(float, value, kFloatValues) {
165 const Operator* op = common()->Float32Constant(value); 182 const Operator* op = common()->Float32Constant(value);
166 EXPECT_PRED2(base::bit_equal_to<float>(), value, OpParameter<float>(op)); 183 EXPECT_PRED2(base::bit_equal_to<float>(), value, OpParameter<float>(op));
167 EXPECT_EQ(0, OperatorProperties::GetValueInputCount(op)); 184 EXPECT_EQ(0, OperatorProperties::GetValueInputCount(op));
168 EXPECT_EQ(0, OperatorProperties::GetTotalInputCount(op)); 185 EXPECT_EQ(0, OperatorProperties::GetTotalInputCount(op));
169 EXPECT_EQ(0, OperatorProperties::GetControlOutputCount(op)); 186 EXPECT_EQ(0, OperatorProperties::GetControlOutputCount(op));
170 EXPECT_EQ(0, OperatorProperties::GetEffectOutputCount(op)); 187 EXPECT_EQ(0, OperatorProperties::GetEffectOutputCount(op));
171 EXPECT_EQ(1, OperatorProperties::GetValueOutputCount(op)); 188 EXPECT_EQ(1, OperatorProperties::GetValueOutputCount(op));
172 } 189 }
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 EXPECT_EQ(arguments + 1, OperatorProperties::GetTotalInputCount(op)); 260 EXPECT_EQ(arguments + 1, OperatorProperties::GetTotalInputCount(op));
244 EXPECT_EQ(0, OperatorProperties::GetControlOutputCount(op)); 261 EXPECT_EQ(0, OperatorProperties::GetControlOutputCount(op));
245 EXPECT_EQ(0, OperatorProperties::GetEffectOutputCount(op)); 262 EXPECT_EQ(0, OperatorProperties::GetEffectOutputCount(op));
246 EXPECT_EQ(1, OperatorProperties::GetValueOutputCount(op)); 263 EXPECT_EQ(1, OperatorProperties::GetValueOutputCount(op));
247 } 264 }
248 } 265 }
249 266
250 } // namespace compiler 267 } // namespace compiler
251 } // namespace internal 268 } // namespace internal
252 } // namespace v8 269 } // namespace v8
OLDNEW
« no previous file with comments | « test/cctest/compiler/test-scheduler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698