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
This commit is contained in:
svenpanne@chromium.org 2014-03-17 13:32:39 +00:00
parent 3550e9364a
commit 47aa3c65dc

View File

@ -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<const char*>(
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 {