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

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

Issue 1852213002: [interpreter] Add accumulator use description to bytecodes. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase. Created 4 years, 8 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 | « src/runtime/runtime-interpreter.cc ('k') | test/unittests/interpreter/interpreter-assembler-unittest.h » ('j') | 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 58f72c4424319b53ef14dd6d3c6d982cbba47acb..b3554c385372869de67591df26a31a14b0e6ead8 100644
--- a/test/unittests/interpreter/bytecodes-unittest.cc
+++ b/test/unittests/interpreter/bytecodes-unittest.cc
@@ -280,6 +280,41 @@ TEST(OperandScale, PrefixesRequired) {
Bytecode::kExtraWide);
}
+TEST(AccumulatorUse, LogicalOperators) {
+ CHECK_EQ(AccumulatorUse::kNone | AccumulatorUse::kRead,
+ AccumulatorUse::kRead);
+ CHECK_EQ(AccumulatorUse::kRead | AccumulatorUse::kWrite,
+ AccumulatorUse::kReadWrite);
+ CHECK_EQ(AccumulatorUse::kRead & AccumulatorUse::kReadWrite,
+ AccumulatorUse::kRead);
+ CHECK_EQ(AccumulatorUse::kRead & AccumulatorUse::kWrite,
+ AccumulatorUse::kNone);
+}
+
+TEST(AccumulatorUse, SampleBytecodes) {
+ CHECK(Bytecodes::ReadsAccumulator(Bytecode::kStar));
+ CHECK(!Bytecodes::WritesAccumulator(Bytecode::kStar));
+ CHECK_EQ(Bytecodes::GetAccumulatorUse(Bytecode::kStar),
+ AccumulatorUse::kRead);
+ CHECK(!Bytecodes::ReadsAccumulator(Bytecode::kLdar));
+ CHECK(Bytecodes::WritesAccumulator(Bytecode::kLdar));
+ CHECK_EQ(Bytecodes::GetAccumulatorUse(Bytecode::kLdar),
+ AccumulatorUse::kWrite);
+ CHECK(Bytecodes::ReadsAccumulator(Bytecode::kAdd));
+ CHECK(Bytecodes::WritesAccumulator(Bytecode::kAdd));
+ CHECK_EQ(Bytecodes::GetAccumulatorUse(Bytecode::kAdd),
+ 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 | « src/runtime/runtime-interpreter.cc ('k') | test/unittests/interpreter/interpreter-assembler-unittest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698