Index: test/unittests/interpreter/bytecodes-unittest.cc |
diff --git a/test/unittests/interpreter/bytecodes-unittest.cc b/test/unittests/interpreter/bytecodes-unittest.cc |
index 47c7abb77244d5d5dd361651b4ba9519d627bbfb..0e68e188c7a8238055c45d5941878696cb9727a8 100644 |
--- a/test/unittests/interpreter/bytecodes-unittest.cc |
+++ b/test/unittests/interpreter/bytecodes-unittest.cc |
@@ -161,47 +161,18 @@ |
} |
} |
-TEST(Bytecodes, ScaleForSignedOperand) { |
- CHECK(Bytecodes::ScaleForSignedOperand(0) == OperandScale::kSingle); |
- CHECK(Bytecodes::ScaleForSignedOperand(kMaxInt8) == OperandScale::kSingle); |
- CHECK(Bytecodes::ScaleForSignedOperand(kMinInt8) == OperandScale::kSingle); |
- CHECK(Bytecodes::ScaleForSignedOperand(kMaxInt8 + 1) == |
- OperandScale::kDouble); |
- CHECK(Bytecodes::ScaleForSignedOperand(kMinInt8 - 1) == |
- OperandScale::kDouble); |
- CHECK(Bytecodes::ScaleForSignedOperand(kMaxInt16) == OperandScale::kDouble); |
- CHECK(Bytecodes::ScaleForSignedOperand(kMinInt16) == OperandScale::kDouble); |
- CHECK(Bytecodes::ScaleForSignedOperand(kMaxInt16 + 1) == |
- OperandScale::kQuadruple); |
- CHECK(Bytecodes::ScaleForSignedOperand(kMinInt16 - 1) == |
- OperandScale::kQuadruple); |
- CHECK(Bytecodes::ScaleForSignedOperand(kMaxInt) == OperandScale::kQuadruple); |
- CHECK(Bytecodes::ScaleForSignedOperand(kMinInt) == OperandScale::kQuadruple); |
-} |
- |
-TEST(Bytecodes, ScaleForUnsignedOperands) { |
- // int overloads |
- CHECK(Bytecodes::ScaleForUnsignedOperand(0) == OperandScale::kSingle); |
- CHECK(Bytecodes::ScaleForUnsignedOperand(kMaxUInt8) == OperandScale::kSingle); |
- CHECK(Bytecodes::ScaleForUnsignedOperand(kMaxUInt8 + 1) == |
- OperandScale::kDouble); |
- CHECK(Bytecodes::ScaleForUnsignedOperand(kMaxUInt16) == |
- OperandScale::kDouble); |
- CHECK(Bytecodes::ScaleForUnsignedOperand(kMaxUInt16 + 1) == |
- OperandScale::kQuadruple); |
- // size_t overloads |
- CHECK(Bytecodes::ScaleForUnsignedOperand(static_cast<size_t>(0)) == |
- OperandScale::kSingle); |
- CHECK(Bytecodes::ScaleForUnsignedOperand(static_cast<size_t>(kMaxUInt8)) == |
- OperandScale::kSingle); |
- CHECK(Bytecodes::ScaleForUnsignedOperand( |
- static_cast<size_t>(kMaxUInt8 + 1)) == OperandScale::kDouble); |
- CHECK(Bytecodes::ScaleForUnsignedOperand(static_cast<size_t>(kMaxUInt16)) == |
- OperandScale::kDouble); |
- CHECK(Bytecodes::ScaleForUnsignedOperand( |
- static_cast<size_t>(kMaxUInt16 + 1)) == OperandScale::kQuadruple); |
- CHECK(Bytecodes::ScaleForUnsignedOperand(static_cast<size_t>(kMaxUInt32)) == |
- OperandScale::kQuadruple); |
+TEST(Bytecodes, SizesForSignedOperands) { |
+ CHECK(Bytecodes::SizeForSignedOperand(0) == OperandSize::kByte); |
+ CHECK(Bytecodes::SizeForSignedOperand(kMaxInt8) == OperandSize::kByte); |
+ CHECK(Bytecodes::SizeForSignedOperand(kMinInt8) == OperandSize::kByte); |
+ CHECK(Bytecodes::SizeForSignedOperand(kMaxInt8 + 1) == OperandSize::kShort); |
+ CHECK(Bytecodes::SizeForSignedOperand(kMinInt8 - 1) == OperandSize::kShort); |
+ CHECK(Bytecodes::SizeForSignedOperand(kMaxInt16) == OperandSize::kShort); |
+ CHECK(Bytecodes::SizeForSignedOperand(kMinInt16) == OperandSize::kShort); |
+ CHECK(Bytecodes::SizeForSignedOperand(kMaxInt16 + 1) == OperandSize::kQuad); |
+ CHECK(Bytecodes::SizeForSignedOperand(kMinInt16 - 1) == OperandSize::kQuad); |
+ CHECK(Bytecodes::SizeForSignedOperand(kMaxInt) == OperandSize::kQuad); |
+ CHECK(Bytecodes::SizeForSignedOperand(kMinInt) == OperandSize::kQuad); |
} |
TEST(Bytecodes, SizesForUnsignedOperands) { |
@@ -265,6 +236,14 @@ |
AccumulatorUse::kReadWrite); |
} |
+TEST(AccumulatorUse, AccumulatorUseToString) { |
+ std::set<std::string> names; |
+ names.insert(Bytecodes::AccumulatorUseToString(AccumulatorUse::kNone)); |
+ names.insert(Bytecodes::AccumulatorUseToString(AccumulatorUse::kRead)); |
+ names.insert(Bytecodes::AccumulatorUseToString(AccumulatorUse::kWrite)); |
+ names.insert(Bytecodes::AccumulatorUseToString(AccumulatorUse::kReadWrite)); |
+ CHECK_EQ(names.size(), 4); |
+} |
} // namespace interpreter |
} // namespace internal |
} // namespace v8 |