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

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: Re-generate golden files. 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..bf43b954025a9f1043281cd17cccdaea87695aaf 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,20 +147,27 @@ 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);
- 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));
- } else if (Bytecodes::IsRegisterCountOperandType(op_type)) {
- stream << bytecode_iter.GetRegisterCountOperand(op_index);
- } else if (Bytecodes::IsIndexOperandType(op_type)) {
- stream << bytecode_iter.GetIndexOperand(op_index);
- } else {
- UNREACHABLE();
+ switch (op_type) {
+ case OperandType::kFlag8:
+ stream << bytecode_iter.GetFlagOperand(op_index);
+ break;
+ case OperandType::kIdx:
+ stream << bytecode_iter.GetIndexOperand(op_index);
+ break;
+ case OperandType::kImm:
+ stream << bytecode_iter.GetImmediateOperand(op_index);
+ break;
+ case OperandType::kRegCount:
+ stream << bytecode_iter.GetRegisterCountOperand(op_index);
+ break;
+ case OperandType::kRuntimeId: {
+ uint32_t operand = bytecode_iter.GetRuntimeIdOperand(op_index);
+ stream << "Runtime::k"
+ << i::Runtime::FunctionForId(IndexToFunctionId(operand))->name;
+ break;
+ }
+ default:
+ UNREACHABLE();
}
stream << ')';
@@ -167,9 +178,12 @@ void BytecodeExpectationsPrinter::PrintBytecode(
std::ostream& stream, const BytecodeArrayIterator& bytecode_iter,
int parameter_count) const {
Bytecode bytecode = bytecode_iter.current_bytecode();
-
+ OperandScale operand_scale = bytecode_iter.current_operand_scale();
+ if (Bytecodes::OperandScaleRequiresPrefixBytecode(operand_scale)) {
+ Bytecode prefix = Bytecodes::OperandScaleToPrefixBytecode(operand_scale);
+ stream << "B(" << Bytecodes::ToString(prefix) << "), ";
+ }
stream << "B(" << Bytecodes::ToString(bytecode) << ')';
-
int operands_count = Bytecodes::NumberOfOperands(bytecode);
for (int op_index = 0; op_index < operands_count; ++op_index) {
stream << ", ";
« no previous file with comments | « src/runtime/runtime-interpreter.cc ('k') | test/cctest/interpreter/bytecode_expectations/ArrayLiterals.golden » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698