From 47aa3c65dcf06665c2165237fa24c9c9f57aa4e0 Mon Sep 17 00:00:00 2001 From: "svenpanne@chromium.org" Date: Mon, 17 Mar 2014 13:32:39 +0000 Subject: [PATCH] Better handling of constant-pool-like parts of the instruction stream. This avoids e.g. trying to disassemble those parts, which could result in failed assertions. R=ulan@chromium.org Review URL: https://codereview.chromium.org/201613005 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@19992 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/a64/assembler-a64.cc | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/a64/assembler-a64.cc b/src/a64/assembler-a64.cc index 51542b2..2323214 100644 --- a/src/a64/assembler-a64.cc +++ b/src/a64/assembler-a64.cc @@ -616,6 +616,24 @@ bool Assembler::IsConstantPoolAt(Instruction* instr) { int Assembler::ConstantPoolSizeAt(Instruction* instr) { +#ifdef USE_SIMULATOR + // Assembler::debug() embeds constants directly into the instruction stream. + // Although this is not a genuine constant pool, treat it like one to avoid + // disassembling the constants. + if ((instr->Mask(ExceptionMask) == HLT) && + (instr->ImmException() == kImmExceptionIsDebug)) { + const char* message = + reinterpret_cast( + instr->InstructionAtOffset(kDebugMessageOffset)); + int size = kDebugMessageOffset + strlen(message) + 1; + return RoundUp(size, kInstructionSize) / kInstructionSize; + } + // Same for printf support, see MacroAssembler::CallPrintf(). + if ((instr->Mask(ExceptionMask) == HLT) && + (instr->ImmException() == kImmExceptionIsPrintf)) { + return kPrintfLength / kInstructionSize; + } +#endif if (IsConstantPoolAt(instr)) { return instr->ImmLLiteral(); } else { -- 2.7.4