[ia32] Fix disassembler tests to test instruction disassembly
Change-Id: I1fe7ba0a942c6da2d1c85c2391762cb434098cf1 Reviewed-on: https://chromium-review.googlesource.com/907346 Reviewed-by: Jakob Kummerow <jkummerow@chromium.org> Commit-Queue: Deepti Gandluri <gdeepti@chromium.org> Cr-Commit-Position: refs/heads/master@{#51165}
This commit is contained in:
parent
601f5f7897
commit
2b67f8de57
@ -2564,6 +2564,11 @@ int Disassembler::InstructionDecode(v8::internal::Vector<char> buffer,
|
||||
return d.InstructionDecode(buffer, instruction);
|
||||
}
|
||||
|
||||
int Disassembler::InstructionDecodeForTesting(v8::internal::Vector<char> buffer,
|
||||
byte* instruction) {
|
||||
DisassemblerIA32 d(converter_, true /*crash if unimplemented*/);
|
||||
return d.InstructionDecode(buffer, instruction);
|
||||
}
|
||||
|
||||
// The IA-32 assembler does not currently use constant pools.
|
||||
int Disassembler::ConstantPoolSizeAt(byte* instruction) { return -1; }
|
||||
|
@ -42,7 +42,26 @@ namespace internal {
|
||||
|
||||
#define __ assm.
|
||||
|
||||
void Disassemble(FILE* f, byte* begin, byte* end) {
|
||||
disasm::NameConverter converter;
|
||||
disasm::Disassembler d(converter);
|
||||
for (byte* pc = begin; pc < end;) {
|
||||
v8::internal::EmbeddedVector<char, 128> buffer;
|
||||
buffer[0] = '\0';
|
||||
byte* prev_pc = pc;
|
||||
pc += d.InstructionDecodeForTesting(buffer, pc);
|
||||
fprintf(f, "%p", static_cast<void*>(prev_pc));
|
||||
fprintf(f, " ");
|
||||
|
||||
for (byte* bp = prev_pc; bp < pc; bp++) {
|
||||
fprintf(f, "%02x", *bp);
|
||||
}
|
||||
for (int i = 6 - (pc - prev_pc); i >= 0; i--) {
|
||||
fprintf(f, " ");
|
||||
}
|
||||
fprintf(f, " %s\n", buffer.start());
|
||||
}
|
||||
}
|
||||
static void DummyStaticFunction(Object* result) {
|
||||
}
|
||||
|
||||
@ -865,7 +884,7 @@ TEST(DisasmIa320) {
|
||||
code->Print(os);
|
||||
byte* begin = code->instruction_start();
|
||||
byte* end = begin + code->instruction_size();
|
||||
disasm::Disassembler::Disassemble(stdout, begin, end);
|
||||
Disassemble(stdout, begin, end);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user