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

Unified Diff: src/interpreter/bytecode-array-builder.cc

Issue 2382273002: [Interpreter]: Add kRegList operand type for register list operands. (Closed)
Patch Set: 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
Index: src/interpreter/bytecode-array-builder.cc
diff --git a/src/interpreter/bytecode-array-builder.cc b/src/interpreter/bytecode-array-builder.cc
index d8698fe9595a62e796d27f6b0dffd59e04ed1e84..5978f51d563f5fd9b8c3a21a0dc4bcfa1b0577ee 100644
--- a/src/interpreter/bytecode-array-builder.cc
+++ b/src/interpreter/bytecode-array-builder.cc
@@ -865,19 +865,6 @@ bool BytecodeArrayBuilder::OperandsAreValid(
switch (operand_types[i]) {
case OperandType::kNone:
return false;
- case OperandType::kRegCount: {
- CHECK_NE(i, 0);
- CHECK(operand_types[i - 1] == OperandType::kMaybeReg ||
- operand_types[i - 1] == OperandType::kReg);
- if (i > 0 && operands[i] > 0) {
- Register start = Register::FromOperand(operands[i - 1]);
- Register end(start.index() + static_cast<int>(operands[i]) - 1);
- if (!RegisterIsValid(start) || !RegisterIsValid(end) || start > end) {
- return false;
- }
- }
- break;
- }
case OperandType::kFlag8:
case OperandType::kIntrinsicId:
if (Bytecodes::SizeForUnsignedOperand(operands[i]) >
@@ -898,11 +885,22 @@ bool BytecodeArrayBuilder::OperandsAreValid(
case OperandType::kUImm:
case OperandType::kImm:
break;
- case OperandType::kMaybeReg:
- if (Register::FromOperand(operands[i]) == Register(0)) {
- break;
+ case OperandType::kRegList: {
+ CHECK_LT(i, operand_count - 1);
+ CHECK(operand_types[i + 1] == OperandType::kRegCount);
+ int reg_count = static_cast<int>(operands[i + 1]);
+ if (reg_count == 0) {
+ return Register::FromOperand(operands[i]) == Register(0);
+ } else {
+ Register start = Register::FromOperand(operands[i]);
+ Register end(start.index() + reg_count - 1);
+ if (!RegisterIsValid(start) || !RegisterIsValid(end) || start > end) {
+ return false;
+ }
}
- // Fall-through to kReg case.
+ i++; // Skip past kRegCount operand.
+ break;
+ }
case OperandType::kReg:
case OperandType::kRegOut: {
Register reg = Register::FromOperand(operands[i]);
@@ -930,6 +928,8 @@ bool BytecodeArrayBuilder::OperandsAreValid(
}
break;
}
+ case OperandType::kRegCount:
+ UNREACHABLE(); // Dealt with in kRegList above.
}
}
« no previous file with comments | « no previous file | src/interpreter/bytecode-array-iterator.cc » ('j') | test/unittests/interpreter/bytecode-decoder-unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698