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

Unified Diff: test/cctest/interpreter/bytecode-expectations-printer.cc

Issue 1783483002: [interpreter] Add support for scalable operands. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Operand renaming. 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
Index: test/cctest/interpreter/bytecode-expectations-printer.cc
diff --git a/test/cctest/interpreter/bytecode-expectations-printer.cc b/test/cctest/interpreter/bytecode-expectations-printer.cc
index cc0713f3d26bdaaef07a86985ec0a556ca169b6e..d906787fc0441721b68ef029dbe10bcf230fe6ec 100644
--- a/test/cctest/interpreter/bytecode-expectations-printer.cc
+++ b/test/cctest/interpreter/bytecode-expectations-printer.cc
@@ -96,7 +96,7 @@ void BytecodeExpectationsPrinter::PrintEscapedString(
}
namespace {
-i::Runtime::FunctionId IndexToFunctionId(int index) {
+i::Runtime::FunctionId IndexToFunctionId(uint32_t index) {
return static_cast<i::Runtime::FunctionId>(index);
}
} // namespace
@@ -105,7 +105,8 @@ void BytecodeExpectationsPrinter::PrintBytecodeOperand(
std::ostream& stream, const BytecodeArrayIterator& bytecode_iter,
const Bytecode& bytecode, int op_index, int parameter_count) const {
OperandType op_type = Bytecodes::GetOperandType(bytecode, op_index);
- OperandSize op_size = Bytecodes::GetOperandSize(bytecode, op_index);
+ OperandSize op_size = Bytecodes::GetOperandSize(
+ bytecode, op_index, bytecode_iter.current_operand_scale());
const char* size_tag;
switch (op_size) {
@@ -115,6 +116,9 @@ void BytecodeExpectationsPrinter::PrintBytecodeOperand(
case OperandSize::kShort:
size_tag = "16";
break;
+ case OperandSize::kQuad:
+ size_tag = "32";
+ break;
default:
UNREACHABLE();
return;
@@ -143,16 +147,16 @@ void BytecodeExpectationsPrinter::PrintBytecodeOperand(
} else {
stream << 'U' << size_tag << '(';
- if (op_index == 0 && Bytecodes::IsCallRuntime(bytecode)) {
- DCHECK_EQ(op_type, OperandType::kIdx16);
- int operand = bytecode_iter.GetIndexOperand(op_index);
+ if (Bytecodes::IsRuntimeIdOperandType(op_type)) {
+ uint32_t operand = bytecode_iter.GetRuntimeIdOperand(op_index);
stream << "Runtime::k"
<< i::Runtime::FunctionForId(IndexToFunctionId(operand))->name;
} else if (Bytecodes::IsImmediateOperandType(op_type)) {
- // We need a cast, otherwise the result is printed as char.
- stream << static_cast<int>(bytecode_iter.GetImmediateOperand(op_index));
+ stream << bytecode_iter.GetImmediateOperand(op_index);
} else if (Bytecodes::IsRegisterCountOperandType(op_type)) {
stream << bytecode_iter.GetRegisterCountOperand(op_index);
+ } else if (Bytecodes::IsFlagOperandType(op_type)) {
+ stream << bytecode_iter.GetFlagOperand(op_index);
} else if (Bytecodes::IsIndexOperandType(op_type)) {
stream << bytecode_iter.GetIndexOperand(op_index);
} else {
@@ -168,6 +172,19 @@ void BytecodeExpectationsPrinter::PrintBytecode(
int parameter_count) const {
Bytecode bytecode = bytecode_iter.current_bytecode();
+ switch (bytecode_iter.current_operand_scale()) {
+ case 1:
+ break;
+ case 2:
+ stream << "B(" << Bytecodes::ToString(Bytecode::kWide) << "), ";
+ break;
+ case 4:
+ stream << "B(" << Bytecodes::ToString(Bytecode::kExtraWide) << "), ";
+ break;
+ default:
+ UNREACHABLE();
+ break;
+ }
stream << "B(" << Bytecodes::ToString(bytecode) << ')';
int operands_count = Bytecodes::NumberOfOperands(bytecode);

Powered by Google App Engine
This is Rietveld 408576698