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

Unified Diff: src/interpreter/bytecodes.cc

Issue 1822043005: [Interpreter] Add ValidBytecodeOperandSizeCombinationsIterator. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@move-hasbch-to-bytecodes
Patch Set: Rename class. Created 4 years, 9 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/interpreter/bytecodes.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/interpreter/bytecodes.cc
diff --git a/src/interpreter/bytecodes.cc b/src/interpreter/bytecodes.cc
index 9fa1209d51b6075817e097918324483e41fb1a4d..f2d38f15693e209622366b216069f5d3787f4a10 100644
--- a/src/interpreter/bytecodes.cc
+++ b/src/interpreter/bytecodes.cc
@@ -697,6 +697,41 @@ std::string Register::ToString(int parameter_count) {
}
}
+ValidBytecodeOperandSizeCombinationsIterator::
+ ValidBytecodeOperandSizeCombinationsIterator()
+ : reached_end_(false),
+ operand_scale_(OperandScale::kSingle),
+ bytecode_(kFirstBytecode) {
+ // Advance to the first valid combination
+ while (!done() && !CurrentCombinationIsValid()) {
+ IncrementPosition();
+ }
+ DCHECK(!done());
+}
+
+void ValidBytecodeOperandSizeCombinationsIterator::Advance() {
+ do {
+ IncrementPosition();
+ } while (!done() && !CurrentCombinationIsValid());
+}
+
+void ValidBytecodeOperandSizeCombinationsIterator::IncrementPosition() {
+ if (bytecode_ == Bytecode::kLast) {
+ if (operand_scale_ == OperandScale::kMaxValid) {
+ reached_end_ = true;
+ return;
+ }
+ bytecode_ = kFirstBytecode;
+ operand_scale_ = Bytecodes::NextOperandScale(operand_scale_);
+ } else {
+ bytecode_ = Bytecodes::FromByte(static_cast<int>(bytecode_) + 1);
+ }
+}
+
+bool ValidBytecodeOperandSizeCombinationsIterator::CurrentCombinationIsValid() {
+ return Bytecodes::BytecodeHasHandler(bytecode_, operand_scale_);
+}
+
} // namespace interpreter
} // namespace internal
} // namespace v8
« no previous file with comments | « src/interpreter/bytecodes.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698