OLD | NEW |
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 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 TRACED_FOREACH(double, v2, kFloatValues) { | 351 TRACED_FOREACH(double, v2, kFloatValues) { |
352 const Operator* op1 = common()->NumberConstant(v1); | 352 const Operator* op1 = common()->NumberConstant(v1); |
353 const Operator* op2 = common()->NumberConstant(v2); | 353 const Operator* op2 = common()->NumberConstant(v2); |
354 EXPECT_EQ(bit_cast<uint64_t>(v1) == bit_cast<uint64_t>(v2), | 354 EXPECT_EQ(bit_cast<uint64_t>(v1) == bit_cast<uint64_t>(v2), |
355 op1->Equals(op2)); | 355 op1->Equals(op2)); |
356 } | 356 } |
357 } | 357 } |
358 } | 358 } |
359 | 359 |
360 | 360 |
361 TEST_F(CommonOperatorTest, ValueEffect) { | 361 TEST_F(CommonOperatorTest, BeginRegion) { |
362 TRACED_FOREACH(int, arguments, kArguments) { | 362 const Operator* op = common()->BeginRegion(); |
363 const Operator* op = common()->ValueEffect(arguments); | 363 EXPECT_EQ(1, op->EffectInputCount()); |
364 EXPECT_EQ(arguments, op->ValueInputCount()); | 364 EXPECT_EQ(1, OperatorProperties::GetTotalInputCount(op)); |
365 EXPECT_EQ(arguments, OperatorProperties::GetTotalInputCount(op)); | 365 EXPECT_EQ(0, op->ControlOutputCount()); |
366 EXPECT_EQ(0, op->ControlOutputCount()); | 366 EXPECT_EQ(1, op->EffectOutputCount()); |
367 EXPECT_EQ(1, op->EffectOutputCount()); | 367 EXPECT_EQ(0, op->ValueOutputCount()); |
368 EXPECT_EQ(0, op->ValueOutputCount()); | |
369 } | |
370 } | 368 } |
371 | 369 |
372 | 370 |
373 TEST_F(CommonOperatorTest, Finish) { | 371 TEST_F(CommonOperatorTest, FinishRegion) { |
374 TRACED_FOREACH(int, arguments, kArguments) { | 372 const Operator* op = common()->FinishRegion(); |
375 const Operator* op = common()->Finish(arguments); | 373 EXPECT_EQ(1, op->ValueInputCount()); |
376 EXPECT_EQ(1, op->ValueInputCount()); | 374 EXPECT_EQ(1, op->EffectInputCount()); |
377 EXPECT_EQ(arguments, op->EffectInputCount()); | 375 EXPECT_EQ(2, OperatorProperties::GetTotalInputCount(op)); |
378 EXPECT_EQ(arguments + 1, OperatorProperties::GetTotalInputCount(op)); | 376 EXPECT_EQ(0, op->ControlOutputCount()); |
379 EXPECT_EQ(0, op->ControlOutputCount()); | 377 EXPECT_EQ(1, op->EffectOutputCount()); |
380 EXPECT_EQ(0, op->EffectOutputCount()); | 378 EXPECT_EQ(1, op->ValueOutputCount()); |
381 EXPECT_EQ(1, op->ValueOutputCount()); | |
382 } | |
383 } | 379 } |
384 | 380 |
385 } // namespace compiler | 381 } // namespace compiler |
386 } // namespace internal | 382 } // namespace internal |
387 } // namespace v8 | 383 } // namespace v8 |
OLD | NEW |