Commit 3d6a477b authored by caitp's avatar caitp Committed by Commit bot

[cctest] print name instead of context index for CallJSRuntime

Change bytecode-expectations-printer.cc in the cctest application so
that intrinsic function names are printed rather than their native
context index.

This minimizes the amount of unnecessary changes to the bytecode
expectations that need to happen whenever the context fields are
changed.

BUG=v8:5769
R=neis@chromium.org, rmcilroy@chromium.org, adamk@chromium.org

Review-Url: https://codereview.chromium.org/2593823002
Cr-Commit-Position: refs/heads/master@{#41900}
parent 7cd573f4
......@@ -25,6 +25,21 @@ namespace v8 {
namespace internal {
namespace interpreter {
static const char* NameForNativeContextIntrinsicIndex(uint32_t idx) {
switch (idx) {
#define COMPARE_NATIVE_CONTEXT_INTRINSIC_IDX(NAME, Type, name) \
case Context::NAME: \
return #name;
NATIVE_CONTEXT_INTRINSIC_FUNCTIONS(COMPARE_NATIVE_CONTEXT_INTRINSIC_IDX)
default:
break;
}
return "UnknownIntrinsicIndex";
}
// static
const char* const BytecodeExpectationsPrinter::kDefaultTopFunctionName =
"__genbckexp_wrapper__";
......@@ -162,9 +177,15 @@ void BytecodeExpectationsPrinter::PrintBytecodeOperand(
case OperandType::kFlag8:
stream << bytecode_iterator.GetFlagOperand(op_index);
break;
case OperandType::kIdx:
stream << bytecode_iterator.GetIndexOperand(op_index);
case OperandType::kIdx: {
uint32_t idx = bytecode_iterator.GetIndexOperand(op_index);
if (bytecode == Bytecode::kCallJSRuntime && op_index == 0) {
stream << "%" << NameForNativeContextIntrinsicIndex(idx);
} else {
stream << idx;
}
break;
}
case OperandType::kUImm:
stream << bytecode_iterator.GetUnsignedImmediateOperand(op_index);
break;
......
......@@ -79,7 +79,7 @@ bytecodes: [
B(Star), R(0),
B(CreateArrayLiteral), U8(0), U8(0), U8(9),
B(Star), R(1),
B(CallJSRuntime), U8(157), R(0), U8(2),
B(CallJSRuntime), U8(%spread_iterable), R(0), U8(2),
/* 44 S> */ B(Return),
]
constant pool: [
......
......@@ -126,14 +126,14 @@ bytecodes: [
B(LdaUndefined),
B(Star), R(7),
B(Mov), R(2), R(8),
/* 152 E> */ B(CallJSRuntime), U8(157), R(7), U8(2),
/* 152 E> */ B(CallJSRuntime), U8(%spread_iterable), R(7), U8(2),
B(Star), R(7),
B(CreateArrayLiteral), U8(1), U8(1), U8(9),
B(Star), R(8),
B(CallJSRuntime), U8(156), R(5), U8(4),
B(CallJSRuntime), U8(%spread_arguments), R(5), U8(4),
B(Star), R(5),
B(Mov), R(0), R(6),
/* 140 E> */ B(CallJSRuntime), U8(153), R(3), U8(4),
/* 140 E> */ B(CallJSRuntime), U8(%reflect_construct), R(3), U8(4),
B(Star), R(3),
B(Ldar), R(this),
B(JumpIfNotHole), U8(4),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment