X-Git-Url: https://git.saurik.com/apple/javascriptcore.git/blobdiff_plain/9bcd318d5fa2a38139c9651d263a06c797529333..ba379fdc102753d6be2c4d937058fe40257329fe:/runtime/ScopeChain.h diff --git a/runtime/ScopeChain.h b/runtime/ScopeChain.h index 32b5e92..17aff24 100644 --- a/runtime/ScopeChain.h +++ b/runtime/ScopeChain.h @@ -21,7 +21,7 @@ #ifndef ScopeChain_h #define ScopeChain_h -#include +#include "FastAllocBase.h" namespace JSC { @@ -30,7 +30,7 @@ namespace JSC { class JSObject; class ScopeChainIterator; - class ScopeChainNode { + class ScopeChainNode : public FastAllocBase { public: ScopeChainNode(ScopeChainNode* next, JSObject* object, JSGlobalData* globalData, JSObject* globalThis) : next(next) @@ -41,6 +41,18 @@ namespace JSC { { ASSERT(globalData); } +#ifndef NDEBUG + // Due to the number of subtle and timing dependent bugs that have occurred due + // to deleted but still "valid" ScopeChainNodes we now deliberately clobber the + // contents in debug builds. + ~ScopeChainNode() + { + next = 0; + object = 0; + globalData = 0; + globalThis = 0; + } +#endif ScopeChainNode* next; JSObject* object; @@ -171,6 +183,9 @@ namespace JSC { { if (m_node) m_node->deref(); +#ifndef NDEBUG + m_node = 0; +#endif } void swap(ScopeChain&);