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 |