summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/runtime/StructureTransitionTable.h
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-05-07 11:21:11 +0200
committerSimon Hausmann <simon.hausmann@nokia.com>2012-05-07 11:21:11 +0200
commit2cf6c8816a73e0132bd8fa3b509d62d7c51b6e47 (patch)
tree988e8c5b116dd0466244ae2fe5af8ee9be926d76 /Source/JavaScriptCore/runtime/StructureTransitionTable.h
parentdd91e772430dc294e3bf478c119ef8d43c0a3358 (diff)
downloadqtwebkit-2cf6c8816a73e0132bd8fa3b509d62d7c51b6e47.tar.gz
Imported WebKit commit 7e538425aa020340619e927792f3d895061fb54b (http://svn.webkit.org/repository/webkit/trunk@116286)
Diffstat (limited to 'Source/JavaScriptCore/runtime/StructureTransitionTable.h')
-rw-r--r--Source/JavaScriptCore/runtime/StructureTransitionTable.h35
1 files changed, 16 insertions, 19 deletions
diff --git a/Source/JavaScriptCore/runtime/StructureTransitionTable.h b/Source/JavaScriptCore/runtime/StructureTransitionTable.h
index 517992470..2067a8995 100644
--- a/Source/JavaScriptCore/runtime/StructureTransitionTable.h
+++ b/Source/JavaScriptCore/runtime/StructureTransitionTable.h
@@ -34,6 +34,7 @@
namespace JSC {
+class JSCell;
class Structure;
class StructureTransitionTable {
@@ -83,10 +84,10 @@ public:
return;
}
- HandleSlot slot = this->slot();
- if (!slot)
+ WeakImpl* impl = this->weakImpl();
+ if (!impl)
return;
- HandleHeap::heapFor(slot)->deallocate(slot);
+ WeakSet::deallocate(impl);
}
inline void add(JSGlobalData&, Structure*);
@@ -105,18 +106,18 @@ private:
return reinterpret_cast<TransitionMap*>(m_data);
}
- HandleSlot slot() const
+ WeakImpl* weakImpl() const
{
ASSERT(isUsingSingleSlot());
- return reinterpret_cast<HandleSlot>(m_data & ~UsingSingleSlotFlag);
+ return reinterpret_cast<WeakImpl*>(m_data & ~UsingSingleSlotFlag);
}
void setMap(TransitionMap* map)
{
ASSERT(isUsingSingleSlot());
- if (HandleSlot slot = this->slot())
- HandleHeap::heapFor(slot)->deallocate(slot);
+ if (WeakImpl* impl = this->weakImpl())
+ WeakSet::deallocate(impl);
// This implicitly clears the flag that indicates we're using a single transition
m_data = reinterpret_cast<intptr_t>(map);
@@ -127,24 +128,20 @@ private:
Structure* singleTransition() const
{
ASSERT(isUsingSingleSlot());
- if (HandleSlot slot = this->slot()) {
- if (*slot)
- return reinterpret_cast<Structure*>(slot->asCell());
+ if (WeakImpl* impl = this->weakImpl()) {
+ if (impl->state() == WeakImpl::Live)
+ return reinterpret_cast<Structure*>(impl->jsValue().asCell());
}
return 0;
}
- void setSingleTransition(JSGlobalData& globalData, Structure* structure)
+ void setSingleTransition(JSGlobalData&, Structure* structure)
{
ASSERT(isUsingSingleSlot());
- HandleSlot slot = this->slot();
- if (!slot) {
- slot = globalData.heap.handleHeap()->allocate();
- HandleHeap::heapFor(slot)->makeWeak(slot, 0, 0);
- m_data = reinterpret_cast<intptr_t>(slot) | UsingSingleSlotFlag;
- }
- HandleHeap::heapFor(slot)->writeBarrier(slot, reinterpret_cast<JSCell*>(structure));
- *slot = reinterpret_cast<JSCell*>(structure);
+ if (WeakImpl* impl = this->weakImpl())
+ WeakSet::deallocate(impl);
+ WeakImpl* impl = WeakSet::allocate(reinterpret_cast<JSCell*>(structure));
+ m_data = reinterpret_cast<intptr_t>(impl) | UsingSingleSlotFlag;
}
intptr_t m_data;