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

Unified Diff: src/interpreter/bytecode-decoder.cc

Issue 2382273002: [Interpreter]: Add kRegList operand type for register list operands. (Closed)
Patch Set: Address comments Created 4 years, 2 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/bytecode-decoder.h ('k') | src/interpreter/bytecode-operands.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/interpreter/bytecode-decoder.cc
diff --git a/src/interpreter/bytecode-decoder.cc b/src/interpreter/bytecode-decoder.cc
index b47c0e281a4989ba04a8cfd9f01df307f88a2235..49751897ee8a46608829be148fdb2ae153b4835a 100644
--- a/src/interpreter/bytecode-decoder.cc
+++ b/src/interpreter/bytecode-decoder.cc
@@ -23,6 +23,15 @@ Register BytecodeDecoder::DecodeRegisterOperand(const uint8_t* operand_start,
}
// static
+RegisterList BytecodeDecoder::DecodeRegisterListOperand(
+ const uint8_t* operand_start, uint32_t count, OperandType operand_type,
+ OperandScale operand_scale) {
+ Register first_reg =
+ DecodeRegisterOperand(operand_start, operand_type, operand_scale);
+ return RegisterList(first_reg.index(), static_cast<int>(count));
+}
+
+// static
int32_t BytecodeDecoder::DecodeSignedOperand(const uint8_t* operand_start,
OperandType operand_type,
OperandScale operand_scale) {
@@ -94,7 +103,6 @@ std::ostream& BytecodeDecoder::Decode(std::ostream& os,
if (Bytecodes::IsDebugBreak(bytecode)) return os;
int number_of_operands = Bytecodes::NumberOfOperands(bytecode);
- int range = 0;
for (int i = 0; i < number_of_operands; i++) {
OperandType op_type = Bytecodes::GetOperandType(bytecode, i);
int operand_offset =
@@ -102,10 +110,6 @@ std::ostream& BytecodeDecoder::Decode(std::ostream& os,
const uint8_t* operand_start =
&bytecode_start[prefix_offset + operand_offset];
switch (op_type) {
- case interpreter::OperandType::kRegCount:
- os << "#"
- << DecodeUnsignedOperand(operand_start, op_type, operand_scale);
- break;
case interpreter::OperandType::kIdx:
case interpreter::OperandType::kUImm:
case interpreter::OperandType::kRuntimeId:
@@ -122,7 +126,6 @@ std::ostream& BytecodeDecoder::Decode(std::ostream& os,
os << "#"
<< DecodeUnsignedOperand(operand_start, op_type, operand_scale);
break;
- case interpreter::OperandType::kMaybeReg:
case interpreter::OperandType::kReg:
case interpreter::OperandType::kRegOut: {
Register reg =
@@ -130,19 +133,40 @@ std::ostream& BytecodeDecoder::Decode(std::ostream& os,
os << reg.ToString(parameter_count);
break;
}
- case interpreter::OperandType::kRegOutTriple:
- range += 1;
+ case interpreter::OperandType::kRegOutTriple: {
+ RegisterList reg_list =
+ DecodeRegisterListOperand(operand_start, 3, op_type, operand_scale);
+ os << reg_list.first_register().ToString(parameter_count) << "-"
+ << reg_list.last_register().ToString(parameter_count);
+ break;
+ }
case interpreter::OperandType::kRegOutPair:
case interpreter::OperandType::kRegPair: {
- range += 1;
- Register first_reg =
- DecodeRegisterOperand(operand_start, op_type, operand_scale);
- Register last_reg = Register(first_reg.index() + range);
- os << first_reg.ToString(parameter_count) << "-"
- << last_reg.ToString(parameter_count);
+ RegisterList reg_list =
+ DecodeRegisterListOperand(operand_start, 2, op_type, operand_scale);
+ os << reg_list.first_register().ToString(parameter_count) << "-"
+ << reg_list.last_register().ToString(parameter_count);
+ break;
+ }
+ case interpreter::OperandType::kRegList: {
+ DCHECK_LT(i, number_of_operands - 1);
+ DCHECK_EQ(Bytecodes::GetOperandType(bytecode, i + 1),
+ OperandType::kRegCount);
+ int reg_count_offset =
+ Bytecodes::GetOperandOffset(bytecode, i + 1, operand_scale);
+ const uint8_t* reg_count_operand =
+ &bytecode_start[prefix_offset + reg_count_offset];
+ uint32_t count = DecodeUnsignedOperand(
+ reg_count_operand, OperandType::kRegCount, operand_scale);
+ RegisterList reg_list = DecodeRegisterListOperand(
+ operand_start, count, op_type, operand_scale);
+ os << reg_list.first_register().ToString(parameter_count) << "-"
+ << reg_list.last_register().ToString(parameter_count);
+ i++; // Skip kRegCount.
break;
}
case interpreter::OperandType::kNone:
+ case interpreter::OperandType::kRegCount: // Dealt with in kRegList.
UNREACHABLE();
break;
}
« no previous file with comments | « src/interpreter/bytecode-decoder.h ('k') | src/interpreter/bytecode-operands.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698