Ignore:
Timestamp:
Dec 20, 2012, 3:20:30 PM (12 years ago)
Author:
[email protected]
Message:

JIT: Change uninitialized pointer value -1 to constant
https://bugs.webkit.org/show_bug.cgi?id=105576

Rubber stamped by Gavin Barraclough.

Changed the use of -1 as a pointer value in the JITs to be the constant unusedPointer defined in the
new file jit/UnusedPointer.h. Made it's value 0xd1e7beef, which is a bad pointer on most architectures
because it is odd, and to distinguish it from other common values.

  • GNUmakefile.list.am:
  • JavaScriptCore.xcodeproj/project.pbxproj:
  • dfg/DFGRepatch.cpp:

(JSC::DFG::dfgResetGetByID):
(JSC::DFG::dfgResetPutByID):

  • dfg/DFGSpeculativeJIT32_64.cpp:

(JSC::DFG::SpeculativeJIT::cachedGetById):
(JSC::DFG::SpeculativeJIT::cachedPutById):

  • dfg/DFGSpeculativeJIT64.cpp:

(JSC::DFG::SpeculativeJIT::cachedGetById):
(JSC::DFG::SpeculativeJIT::cachedPutById):

  • jit/JIT.h:
  • jit/JITPropertyAccess.cpp:

(JSC::JIT::resetPatchGetById):
(JSC::JIT::resetPatchPutById):

  • jit/JITPropertyAccess32_64.cpp:

(JSC::JIT::resetPatchGetById):
(JSC::JIT::resetPatchPutById):

  • jit/JITWriteBarrier.h:

(JSC::JITWriteBarrierBase::clearToUnusedPointer):
(JSC::JITWriteBarrierBase::get):

  • jit/UnusedPointer.h: Added.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/jit/JITWriteBarrier.h

    r128084 r138308  
    3232#include "SlotVisitor.h"
    3333#include "WriteBarrier.h"
     34#include "jit/UnusedPointer.h"
    3435
    3536namespace JSC {
     
    7071   
    7172    void clear() { clear(0); }
    72     void clearToMaxUnsigned() { clear(reinterpret_cast<void*>(-1)); }
     73    void clearToUnusedPointer() { clear(reinterpret_cast<void*>(unusedPointer)); }
    7374
    7475protected:
     
    9192            return 0;
    9293        void* result = static_cast<JSCell*>(MacroAssembler::readPointer(m_location));
    93         // We use -1 to indicate a "safe" empty value in the instruction stream
    94         if (result == (void*)-1)
     94        if (result == reinterpret_cast<void*>(unusedPointer))
    9595            return 0;
    9696        return static_cast<JSCell*>(result);
Note: See TracChangeset for help on using the changeset viewer.