Diagnostic patch to find out-of-range IC patches (bug 602333, r=sstangl, a=blocking).
authorDavid Anderson <danderson@mozilla.com>
Wed, 10 Nov 2010 20:50:20 -0800
changeset 57783 6f9c075ee45e66725194695e372cca53947b7272
parent 57782 9156ba8a843d89b4cf98a68bd0f6e1207767c10d
child 57784 3d63107fc7881db6a31745d283b4e74643ceb719
push id1
push usershaver@mozilla.com
push dateTue, 04 Jan 2011 17:58:04 +0000
reviewerssstangl, blocking
bugs602333
milestone2.0b8pre
Diagnostic patch to find out-of-range IC patches (bug 602333, r=sstangl, a=blocking).
js/src/assembler/assembler/X86Assembler.h
--- a/js/src/assembler/assembler/X86Assembler.h
+++ b/js/src/assembler/assembler/X86Assembler.h
@@ -2248,16 +2248,20 @@ private:
     {
         reinterpret_cast<int32_t*>(where)[-1] = value;
     }
 
     static void setRel32(void* from, void* to)
     {
         intptr_t offset = reinterpret_cast<intptr_t>(to) - reinterpret_cast<intptr_t>(from);
         ASSERT(offset == static_cast<int32_t>(offset));
+#define JS_CRASH(x) *(int *)x = 0
+        if (offset != static_cast<int32_t>(offset))
+            JS_CRASH(0xC0DE);
+#undef JS_CRASH
 
         js::JaegerSpew(js::JSpew_Insns,
                        ISPFX "##setRel32 ((from=%p)) ((to=%p))\n", from, to);
         setInt32(from, offset);
     }
 
     class X86InstructionFormatter {