Better handling of constant-pool-like parts of the instruction stream.
authorsvenpanne@chromium.org <svenpanne@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Mon, 17 Mar 2014 13:32:39 +0000 (13:32 +0000)
committersvenpanne@chromium.org <svenpanne@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Mon, 17 Mar 2014 13:32:39 +0000 (13:32 +0000)
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

index 51542b2..2323214 100644 (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 {