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

Unified Diff: test/unittests/interpreter/bytecodes-unittest.cc

Issue 2351763002: [Interpreter] Optimize BytecodeArrayBuilder and BytecodeArrayWriter. (Closed)
Patch Set: Fix Chromium Windows bots. Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/unittests/interpreter/bytecode-register-optimizer-unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/unittests/interpreter/bytecodes-unittest.cc
diff --git a/test/unittests/interpreter/bytecodes-unittest.cc b/test/unittests/interpreter/bytecodes-unittest.cc
index 0e68e188c7a8238055c45d5941878696cb9727a8..47c7abb77244d5d5dd361651b4ba9519d627bbfb 100644
--- a/test/unittests/interpreter/bytecodes-unittest.cc
+++ b/test/unittests/interpreter/bytecodes-unittest.cc
@@ -161,18 +161,47 @@ TEST(Bytecodes, PrefixMappings) {
}
}
-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, 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, SizesForUnsignedOperands) {
@@ -236,14 +265,6 @@ TEST(AccumulatorUse, SampleBytecodes) {
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
« no previous file with comments | « test/unittests/interpreter/bytecode-register-optimizer-unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698