Reviewers: Jakob,

Message:
Roughly once every three months I catch myself wondering why the displacement
offset of a memory operand is off, only to realize that it is just printed
incorrectly. This makes me feel stupid every single time. I don't want to feel
stupid any longer. :)

Description:
Print properly signed displacement in IA32 disassembler.

[email protected]
BUG=

Please review this at https://codereview.chromium.org/176993004/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+6, -2 lines):
  M src/ia32/disasm-ia32.cc


Index: src/ia32/disasm-ia32.cc
diff --git a/src/ia32/disasm-ia32.cc b/src/ia32/disasm-ia32.cc
index 177041de7ac114225bd65097f90feacd4fd8815f..d91dceb0f75ce30d304d0bd5584143c4a0c6481f 100644
--- a/src/ia32/disasm-ia32.cc
+++ b/src/ia32/disasm-ia32.cc
@@ -449,8 +449,12 @@ int DisassemblerIA32::PrintRightOperandHelper(
       } else {
         // No sib.
         int disp =
- mod == 2 ? *reinterpret_cast<int32_t*>(modrmp + 1) : *(modrmp + 1);
-        AppendToBuffer("[%s+0x%x]", (this->*register_name)(rm), disp);
+            mod == 2 ? *reinterpret_cast<int32_t*>(modrmp + 1) :
+                       *reinterpret_cast<int8_t*>(modrmp + 1);
+        AppendToBuffer("[%s%s0x%x]",
+                       (this->*register_name)(rm),
+                       disp < 0 ? "-" : "+",
+                       disp < 0 ? -disp : disp);
         return mod == 2 ? 5 : 2;
       }
       break;


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to