No subject
Mon Jan 28 08:41:14 PST 2013
nd
capacity. This is accomplished by having PropertyTable::add() take a
PropertyOffset reference, which must be Structure::m_offset. It will upd=
ate this
offset. As well, all transitions now copy m_offset. And we frequently a=
ssert
(using RELEASE_ASSERT) that the m_offset matches what m_propertyTable wou=
ld tell
you. Hence if you ever modify the m_propertyTable, you'll also update th=
e offset.
If you ever copy the property table, you'll also copy the offset. Life s=
hould be
good, I think.
* runtime/PropertyMapHashTable.h:
(JSC::PropertyTable::add):
* runtime/Structure.cpp:
(JSC::Structure::materializePropertyMap):
(JSC::Structure::addPropertyTransition):
(JSC::Structure::removePropertyTransition):
(JSC::Structure::changePrototypeTransition):
(JSC::Structure::despecifyFunctionTransition):
(JSC::Structure::attributeChangeTransition):
(JSC::Structure::toDictionaryTransition):
(JSC::Structure::sealTransition):
(JSC::Structure::freezeTransition):
(JSC::Structure::preventExtensionsTransition):
(JSC::Structure::nonPropertyTransition):
(JSC::Structure::flattenDictionaryStructure):
(JSC::Structure::checkConsistency):
(JSC::Structure::putSpecificValue):
(JSC::Structure::createPropertyMap):
(JSC::PropertyTable::checkConsistency):
* runtime/Structure.h:
(JSC):
(JSC::Structure::putWillGrowOutOfLineStorage):
(JSC::Structure::outOfLineCapacity):
(JSC::Structure::outOfLineSize):
(JSC::Structure::isEmpty):
(JSC::Structure::materializePropertyMapIfNecessary):
(JSC::Structure::materializePropertyMapIfNecessaryForPinning):
(Structure):
(JSC::Structure::checkOffsetConsistency):</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href=3D"#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScri=
ptCore/ChangeLog</a></li>
<li><a href=3D"#trunkSourceJavaScriptCoreruntimePropertyMapHashTableh">tr=
unk/Source/JavaScriptCore/runtime/PropertyMapHashTable.h</a></li>
<li><a href=3D"#trunkSourceJavaScriptCoreruntimeStructurecpp">trunk/Sourc=
e/JavaScriptCore/runtime/Structure.cpp</a></li>
<li><a href=3D"#trunkSourceJavaScriptCoreruntimeStructureh">trunk/Source/=
JavaScriptCore/runtime/Structure.h</a></li>
</ul>
</div>
<div id=3D"patch">
<h3>Diff</h3>
<a id=3D"trunkSourceJavaScriptCoreChangeLog"></a>
<div class=3D"modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLo=
g (143096 =3D> 143097)</h4>
<pre class=3D"diff"><span>
<span class=3D"info">--- trunk/Source/JavaScriptCore/ChangeLog 2013-02-16=
05:19:33 UTC (rev 143096)
+++ trunk/Source/JavaScriptCore/ChangeLog 2013-02-16 05:31:00 UTC (rev 14=
3097)
</span><span class=3D"lines">@@ -1,3 +1,65 @@
</span><ins>+2013-02-15 Filip Pizlo <fpizlo at apple.com>
+
+ Structure should be more methodical about the relationship betwe=
en m_offset and m_propertyTable
+ https://bugs.webkit.org/show_bug.cgi?id=3D109978
+
+ Reviewed by Mark Hahnenberg.
+ =20
+ Allegedly, the previous relationship was that either m_propertyT=
able or m_offset
+ would be set, and if m_propertyTable was not set you could rebui=
ld it. In reality,
+ we would sometimes "reset" both: some transitions woul=
dn't set m_offset, and other
+ transitions would clear the previous structure's m_propertyTable=
. So, in a
+ structure transition chain of A->B->C you could have:
+
+ A transitions to B: B doesn't copy m_offset but does copy m_prop=
ertyTable, because
+ that seemed like a good idea at the time (this was a common =
idiom in the code).
+ B transitions to C: C steals B's m_propertyTable, leaving B with=
neither a
+ m_propertyTable nor a m_offset.
+
+ Then we would ask for the size of the property storage of B and =
get the answer
+ "none". That's not good.
+
+ Now, there is a new relationship, which, hopefully, should fix t=
hings: m_offset is
+ always set and always refers to the maximum offset ever used by =
the property table.
+ From this, you can infer both the inline and out-of-line propert=
y size, and
+ capacity. This is accomplished by having PropertyTable::add() t=
ake a
+ PropertyOffset reference, which must be Structure::m_offset. It=
will update this
+ offset. As well, all transitions now copy m_offset. And we fre=
quently assert
+ (using RELEASE_ASSERT) that the m_offset matches what m_property=
Table would tell
+ you. Hence if you ever modify the m_propertyTable, you'll also =
update the offset.
+ If you ever copy the property table, you'll also copy the offset=
. Life should be
+ good, I think.
+
+ * runtime/PropertyMapHashTable.h:
+ (JSC::PropertyTable::add):
+ * runtime/Structure.cpp:
+ (JSC::Structure::materializePropertyMap):
+ (JSC::Structure::addPropertyTransition):
+ (JSC::Structure::removePropertyTransition):
+ (JSC::Structure::changePrototypeTransition):
+ (JSC::Structure::despecifyFunctionTransition):
+ (JSC::Structure::attributeChangeTransition):
+ (JSC::Structure::toDictionaryTransition):
+ (JSC::Structure::sealTransition):
+ (JSC::Structure::freezeTransition):
+ (JSC::Structure::preventExtensionsTransition):
+ (JSC::Structure::nonPropertyTransition):
+ (JSC::Structure::flattenDictionaryStructure):
+ (JSC::Structure::checkConsistency):
+ (JSC::Structure::putSpecificValue):
+ (JSC::Structure::createPropertyMap):
+ (JSC::PropertyTable::checkConsistency):
+ * runtime/Structure.h:
+ (JSC):
+ (JSC::Structure::putWillGrowOutOfLineStorage):
+ (JSC::Structure::outOfLineCapacity):
+ (JSC::Structure::outOfLineSize):
+ (JSC::Structure::isEmpty):
+ (JSC::Structure::materializePropertyMapIfNecessary):
+ (JSC::Structure::materializePropertyMapIfNecessaryForPinning):
+ (Structure):
+ (JSC::Structure::checkOffsetConsistency):
+
</ins><span class=3D"cx"> 2013-02-15 Martin Robinson <mrobinson at igal=
ia.com>
</span><span class=3D"cx">=20
</span><span class=3D"cx"> [GTK] Spread the gyp build files throu=
ghout the tree
</span></span></pre></div>
<a id=3D"trunkSourceJavaScriptCoreruntimePropertyMapHashTableh"></a>
<div class=3D"modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/=
PropertyMapHashTable.h (143096 =3D> 143097)</h4>
<pre class=3D"diff"><span>
<span class=3D"info">--- trunk/Source/JavaScriptCore/runtime/PropertyMapH=
ashTable.h 2013-02-16 05:19:33 UTC (rev 143096)
+++ trunk/Source/JavaScriptCore/runtime/PropertyMapHashTable.h 2013-02-16=
05:31:00 UTC (rev 143097)
</span><span class=3D"lines">@@ -157,7 +157,8 @@
</span><span class=3D"cx"> find_iterator find(const KeyType&);
</span><span class=3D"cx"> find_iterator findWithString(const KeyType=
&);
</span><span class=3D"cx"> // Add a value to the table
</span><del>- std::pair<find_iterator, bool> add(const ValueType=
& entry);
</del><ins>+ enum EffectOnPropertyOffset { PropertyOffsetMayChange, Pr=
opertyOffsetMustNotChange };
+ std::pair<find_iterator, bool> add(const ValueType& entry,=
PropertyOffset&, EffectOnPropertyOffset);
</ins><span class=3D"cx"> // Remove a value from the table.
</span><span class=3D"cx"> void remove(const find_iterator& iter)=
;
</span><span class=3D"cx"> void remove(const KeyType& key);
</span><span class=3D"lines">@@ -389,12 +390,14 @@
</span><span class=3D"cx"> }
</span><span class=3D"cx"> }
</span><span class=3D"cx">=20
</span><del>-inline std::pair<PropertyTable::find_iterator, bool> P=
ropertyTable::add(const ValueType& entry)
</del><ins>+inline std::pair<PropertyTable::find_iterator, bool> Pr=
opertyTable::add(const ValueType& entry, PropertyOffset& offset, =
EffectOnPropertyOffset offsetEffect)
</ins><span class=3D"cx"> {
</span><span class=3D"cx"> // Look for a value with a matching key al=
ready in the array.
</span><span class=3D"cx"> find_iterator iter =3D find(entry.key);
</span><del>- if (iter.first)
</del><ins>+ if (iter.first) {
+ RELEASE_ASSERT(iter.first->offset <=3D offset);
</ins><span class=3D"cx"> return std::make_pair(iter, false);
</span><ins>+ }
</ins><span class=3D"cx">=20
</span><span class=3D"cx"> // Ref the key
</span><span class=3D"cx"> entry.key->ref();
</span><span class=3D"lines">@@ -413,6 +416,12 @@
</span><span class=3D"cx"> *iter.first =3D entry;
</span><span class=3D"cx">=20
</span><span class=3D"cx"> ++m_keyCount;
</span><ins>+ =20
+ if (offsetEffect =3D=3D PropertyOffsetMayChange)
+ offset =3D std::max(offset, entry.offset);
+ else
+ RELEASE_ASSERT(offset >=3D entry.offset);
+ =20
</ins><span class=3D"cx"> return std::make_pair(iter, true);
</span><span class=3D"cx"> }
</span><span class=3D"cx">=20
</span></span></pre></div>
<a id=3D"trunkSourceJavaScriptCoreruntimeStructurecpp"></a>
<div class=3D"modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/=
Structure.cpp (143096 =3D> 143097)</h4>
<pre class=3D"diff"><span>
<span class=3D"info">--- trunk/Source/JavaScriptCore/runtime/Structure.cp=
p 2013-02-16 05:19:33 UTC (rev 143096)
+++ trunk/Source/JavaScriptCore/runtime/Structure.cpp 2013-02-16 05:31:00=
UTC (rev 143097)
</span><span class=3D"lines">@@ -1,5 +1,5 @@
</span><span class=3D"cx"> /*
</span><del>- * Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2008, 2009, 2013 Apple Inc. All rights reser=
ved.
</ins><span class=3D"cx"> *
</span><span class=3D"cx"> * Redistribution and use in source and binary=
forms, with or without
</span><span class=3D"cx"> * modification, are permitted provided that t=
he following conditions
</span><span class=3D"lines">@@ -256,13 +256,15 @@
</span><span class=3D"cx"> if (!m_propertyTable)
</span><span class=3D"cx"> createPropertyMap(numberOfSlotsForLast=
Offset(m_offset, m_inlineCapacity));
</span><span class=3D"cx">=20
</span><del>- for (ptrdiff_t i =3D structures.size() - 2; i >=3D 0;=
--i) {
</del><ins>+ for (ptrdiff_t i =3D structures.size() - 1; i >=3D 0; =
--i) {
</ins><span class=3D"cx"> structure =3D structures[i];
</span><span class=3D"cx"> if (!structure->m_nameInPrevious)
</span><span class=3D"cx"> continue;
</span><span class=3D"cx"> PropertyMapEntry entry(globalData, thi=
s, structure->m_nameInPrevious.get(), structure->m_offset, structur=
e->m_attributesInPrevious, structure->m_specificValueInPrevious.get=
());
</span><del>- m_propertyTable->add(entry);
</del><ins>+ m_propertyTable->add(entry, m_offset, PropertyTabl=
e::PropertyOffsetMustNotChange);
</ins><span class=3D"cx"> }
</span><ins>+ =20
+ checkOffsetConsistency();
</ins><span class=3D"cx"> }
</span><span class=3D"cx">=20
</span><span class=3D"cx"> inline size_t nextOutOfLineStorageCapacity(siz=
e_t currentCapacity)
</span><span class=3D"lines">@@ -371,6 +373,7 @@
</span><span class=3D"cx"> transition->m_specificValueInPrevious.s=
etMayBeNull(globalData, transition, specificValue);
</span><span class=3D"cx">=20
</span><span class=3D"cx"> if (structure->m_propertyTable) {
</span><ins>+ structure->checkOffsetConsistency();
</ins><span class=3D"cx"> if (structure->m_isPinnedPropertyTab=
le)
</span><span class=3D"cx"> transition->m_propertyTable =3D=
structure->m_propertyTable->copy(globalData, transition, structure=
->m_propertyTable->size() + 1);
</span><span class=3D"cx"> else
</span><span class=3D"lines">@@ -381,12 +384,14 @@
</span><span class=3D"cx"> else
</span><span class=3D"cx"> transition->createPropertyMap()=
;
</span><span class=3D"cx"> }
</span><ins>+ transition->m_offset =3D structure->m_offset;
</ins><span class=3D"cx">=20
</span><span class=3D"cx"> offset =3D transition->putSpecificValue=
(globalData, propertyName, attributes, specificValue);
</span><span class=3D"cx">=20
</span><del>- transition->m_offset =3D offset;
</del><span class=3D"cx"> checkOffset(transition->m_offset, transi=
tion->inlineCapacity());
</span><span class=3D"cx"> structure->m_transitionTable.add(global=
Data, transition);
</span><ins>+ transition->checkOffsetConsistency();
+ structure->checkOffsetConsistency();
</ins><span class=3D"cx"> return transition;
</span><span class=3D"cx"> }
</span><span class=3D"cx">=20
</span><span class=3D"lines">@@ -398,6 +403,7 @@
</span><span class=3D"cx">=20
</span><span class=3D"cx"> offset =3D transition->remove(propertyN=
ame);
</span><span class=3D"cx">=20
</span><ins>+ transition->checkOffsetConsistency();
</ins><span class=3D"cx"> return transition;
</span><span class=3D"cx"> }
</span><span class=3D"cx">=20
</span><span class=3D"lines">@@ -407,12 +413,12 @@
</span><span class=3D"cx">=20
</span><span class=3D"cx"> transition->m_prototype.set(globalData,=
transition, prototype);
</span><span class=3D"cx">=20
</span><del>- // Don't set m_offset, as one can not transition to this=
.
-
</del><span class=3D"cx"> structure->materializePropertyMapIfNeces=
sary(globalData);
</span><span class=3D"cx"> transition->m_propertyTable =3D structu=
re->copyPropertyTableForPinning(globalData, transition);
</span><ins>+ transition->m_offset =3D structure->m_offset;
</ins><span class=3D"cx"> transition->pin();
</span><span class=3D"cx">=20
</span><ins>+ transition->checkOffsetConsistency();
</ins><span class=3D"cx"> return transition;
</span><span class=3D"cx"> }
</span><span class=3D"cx">=20
</span><span class=3D"lines">@@ -423,10 +429,9 @@
</span><span class=3D"cx">=20
</span><span class=3D"cx"> ++transition->m_specificFunctionThrashC=
ount;
</span><span class=3D"cx">=20
</span><del>- // Don't set m_offset, as one can not transition to this=
.
-
</del><span class=3D"cx"> structure->materializePropertyMapIfNeces=
sary(globalData);
</span><span class=3D"cx"> transition->m_propertyTable =3D structu=
re->copyPropertyTableForPinning(globalData, transition);
</span><ins>+ transition->m_offset =3D structure->m_offset;
</ins><span class=3D"cx"> transition->pin();
</span><span class=3D"cx">=20
</span><span class=3D"cx"> if (transition->m_specificFunctionThras=
hCount =3D=3D maxSpecificFunctionThrashCount)
</span><span class=3D"lines">@@ -436,6 +441,7 @@
</span><span class=3D"cx"> ASSERT_UNUSED(removed, removed);
</span><span class=3D"cx"> }
</span><span class=3D"cx">=20
</span><ins>+ transition->checkOffsetConsistency();
</ins><span class=3D"cx"> return transition;
</span><span class=3D"cx"> }
</span><span class=3D"cx">=20
</span><span class=3D"lines">@@ -444,10 +450,9 @@
</span><span class=3D"cx"> if (!structure->isUncacheableDictionary=
()) {
</span><span class=3D"cx"> Structure* transition =3D create(globa=
lData, structure);
</span><span class=3D"cx">=20
</span><del>- // Don't set m_offset, as one can not transition to =
this.
-
</del><span class=3D"cx"> structure->materializePropertyMapIfN=
ecessary(globalData);
</span><span class=3D"cx"> transition->m_propertyTable =3D str=
ucture->copyPropertyTableForPinning(globalData, transition);
</span><ins>+ transition->m_offset =3D structure->m_offset;
</ins><span class=3D"cx"> transition->pin();
</span><span class=3D"cx"> =20
</span><span class=3D"cx"> structure =3D transition;
</span><span class=3D"lines">@@ -458,6 +463,7 @@
</span><span class=3D"cx"> ASSERT(entry);
</span><span class=3D"cx"> entry->attributes =3D attributes;
</span><span class=3D"cx">=20
</span><ins>+ structure->checkOffsetConsistency();
</ins><span class=3D"cx"> return structure;
</span><span class=3D"cx"> }
</span><span class=3D"cx">=20
</span><span class=3D"lines">@@ -469,9 +475,11 @@
</span><span class=3D"cx">=20
</span><span class=3D"cx"> structure->materializePropertyMapIfNece=
ssary(globalData);
</span><span class=3D"cx"> transition->m_propertyTable =3D structu=
re->copyPropertyTableForPinning(globalData, transition);
</span><ins>+ transition->m_offset =3D structure->m_offset;
</ins><span class=3D"cx"> transition->m_dictionaryKind =3D kind;
</span><span class=3D"cx"> transition->pin();
</span><span class=3D"cx">=20
</span><ins>+ transition->checkOffsetConsistency();
</ins><span class=3D"cx"> return transition;
</span><span class=3D"cx"> }
</span><span class=3D"cx">=20
</span><span class=3D"lines">@@ -496,6 +504,7 @@
</span><span class=3D"cx"> iter->attributes |=3D DontDelet=
e;
</span><span class=3D"cx"> }
</span><span class=3D"cx">=20
</span><ins>+ transition->checkOffsetConsistency();
</ins><span class=3D"cx"> return transition;
</span><span class=3D"cx"> }
</span><span class=3D"cx">=20
</span><span class=3D"lines">@@ -513,6 +522,7 @@
</span><span class=3D"cx"> iter->attributes |=3D iter->=
attributes & Accessor ? DontDelete : (DontDelete | ReadOnly);
</span><span class=3D"cx"> }
</span><span class=3D"cx">=20
</span><ins>+ transition->checkOffsetConsistency();
</ins><span class=3D"cx"> return transition;
</span><span class=3D"cx"> }
</span><span class=3D"cx">=20
</span><span class=3D"lines">@@ -525,9 +535,11 @@
</span><span class=3D"cx">=20
</span><span class=3D"cx"> structure->materializePropertyMapIfNece=
ssary(globalData);
</span><span class=3D"cx"> transition->m_propertyTable =3D structu=
re->copyPropertyTableForPinning(globalData, transition);
</span><ins>+ transition->m_offset =3D structure->m_offset;
</ins><span class=3D"cx"> transition->m_preventExtensions =3D true=
;
</span><span class=3D"cx"> transition->pin();
</span><span class=3D"cx">=20
</span><ins>+ transition->checkOffsetConsistency();
</ins><span class=3D"cx"> return transition;
</span><span class=3D"cx"> }
</span><span class=3D"cx">=20
</span><span class=3D"lines">@@ -560,6 +572,7 @@
</span><span class=3D"cx"> checkOffset(transition->m_offset, trans=
ition->inlineCapacity());
</span><span class=3D"cx"> =20
</span><span class=3D"cx"> if (structure->m_propertyTable) {
</span><ins>+ structure->checkOffsetConsistency();
</ins><span class=3D"cx"> if (structure->m_isPinnedPropertyTab=
le)
</span><span class=3D"cx"> transition->m_propertyTable =3D=
structure->m_propertyTable->copy(globalData, transition, structure=
->m_propertyTable->size() + 1);
</span><span class=3D"cx"> else
</span><span class=3D"lines">@@ -572,6 +585,7 @@
</span><span class=3D"cx"> }
</span><span class=3D"cx"> =20
</span><span class=3D"cx"> structure->m_transitionTable.add(global=
Data, transition);
</span><ins>+ transition->checkOffsetConsistency();
</ins><span class=3D"cx"> return transition;
</span><span class=3D"cx"> }
</span><span class=3D"cx">=20
</span><span class=3D"lines">@@ -615,6 +629,7 @@
</span><span class=3D"cx">=20
</span><span class=3D"cx"> Structure* Structure::flattenDictionaryStructu=
re(JSGlobalData& globalData, JSObject* object)
</span><span class=3D"cx"> {
</span><ins>+ checkOffsetConsistency();
</ins><span class=3D"cx"> ASSERT(isDictionary());
</span><span class=3D"cx"> if (isUncacheableDictionary()) {
</span><span class=3D"cx"> ASSERT(m_propertyTable);
</span><span class=3D"lines">@@ -629,7 +644,7 @@
</span><span class=3D"cx"> PropertyTable::iterator end =3D m_prop=
ertyTable->end();
</span><span class=3D"cx"> for (PropertyTable::iterator iter =3D =
m_propertyTable->begin(); iter !=3D end; ++iter, ++i) {
</span><span class=3D"cx"> values[i] =3D object->getDirect=
(iter->offset);
</span><del>- iter->offset =3D offsetForPropertyNumber(i, m=
_inlineCapacity);
</del><ins>+ m_offset =3D iter->offset =3D offsetForPropert=
yNumber(i, m_inlineCapacity);
</ins><span class=3D"cx"> }
</span><span class=3D"cx"> =20
</span><span class=3D"cx"> // Copies in our values to their compa=
cted locations.
</span><span class=3D"lines">@@ -637,6 +652,7 @@
</span><span class=3D"cx"> object->putDirect(globalData, o=
ffsetForPropertyNumber(i, m_inlineCapacity), values[i]);
</span><span class=3D"cx">=20
</span><span class=3D"cx"> m_propertyTable->clearDeletedOffset=
s();
</span><ins>+ checkOffsetConsistency();
</ins><span class=3D"cx"> }
</span><span class=3D"cx">=20
</span><span class=3D"cx"> m_dictionaryKind =3D NoneDictionaryKind;
</span><span class=3D"lines">@@ -714,6 +730,7 @@
</span><span class=3D"cx">=20
</span><span class=3D"cx"> inline void Structure::checkConsistency()
</span><span class=3D"cx"> {
</span><ins>+ checkOffsetConsistency();
</ins><span class=3D"cx"> }
</span><span class=3D"cx">=20
</span><span class=3D"cx"> #endif
</span><span class=3D"lines">@@ -786,8 +803,8 @@
</span><span class=3D"cx">=20
</span><span class=3D"cx"> PropertyOffset newOffset =3D m_propertyTab=
le->nextOffset(m_inlineCapacity);
</span><span class=3D"cx">=20
</span><del>- m_propertyTable->add(PropertyMapEntry(globalData, thi=
s, rep, newOffset, attributes, specificValue));
-
</del><ins>+ m_propertyTable->add(PropertyMapEntry(globalData, this=
, rep, newOffset, attributes, specificValue), m_offset, PropertyTable::Pr=
opertyOffsetMayChange);
+ =20
</ins><span class=3D"cx"> checkConsistency();
</span><span class=3D"cx"> return newOffset;
</span><span class=3D"cx"> }
</span><span class=3D"lines">@@ -820,7 +837,6 @@
</span><span class=3D"cx">=20
</span><span class=3D"cx"> checkConsistency();
</span><span class=3D"cx"> m_propertyTable =3D adoptPtr(new PropertyT=
able(capacity));
</span><del>- checkConsistency();
</del><span class=3D"cx"> }
</span><span class=3D"cx">=20
</span><span class=3D"cx"> void Structure::getPropertyNamesFromStructure(=
JSGlobalData& globalData, PropertyNameArray& propertyNames, Enume=
rationMode mode)
</span><span class=3D"lines">@@ -896,6 +912,7 @@
</span><span class=3D"cx">=20
</span><span class=3D"cx"> void PropertyTable::checkConsistency()
</span><span class=3D"cx"> {
</span><ins>+ checkOffsetConsistency();
</ins><span class=3D"cx"> ASSERT(m_indexSize >=3D PropertyTable::M=
inimumTableSize);
</span><span class=3D"cx"> ASSERT(m_indexMask);
</span><span class=3D"cx"> ASSERT(m_indexSize =3D=3D m_indexMask + 1)=
;
</span></span></pre></div>
<a id=3D"trunkSourceJavaScriptCoreruntimeStructureh"></a>
<div class=3D"modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/=
Structure.h (143096 =3D> 143097)</h4>
<pre class=3D"diff"><span>
<span class=3D"info">--- trunk/Source/JavaScriptCore/runtime/Structure.h =
2013-02-16 05:19:33 UTC (rev 143096)
+++ trunk/Source/JavaScriptCore/runtime/Structure.h 2013-02-16 05:31:00 U=
TC (rev 143097)
</span><span class=3D"lines">@@ -1,5 +1,5 @@
</span><span class=3D"cx"> /*
</span><del>- * Copyright (C) 2008, 2009, 2012 Apple Inc. All rights rese=
rved.
</del><ins>+ * Copyright (C) 2008, 2009, 2012, 2013 Apple Inc. All rights=
reserved.
</ins><span class=3D"cx"> *
</span><span class=3D"cx"> * Redistribution and use in source and binary=
forms, with or without
</span><span class=3D"cx"> * modification, are permitted provided that t=
he following conditions
</span><span class=3D"lines">@@ -110,6 +110,8 @@
</span><span class=3D"cx"> bool didTransition() const { return m_=
didTransition; }
</span><span class=3D"cx"> bool putWillGrowOutOfLineStorage()
</span><span class=3D"cx"> {
</span><ins>+ checkOffsetConsistency();
+ =20
</ins><span class=3D"cx"> ASSERT(outOfLineCapacity() >=3D =
outOfLineSize());
</span><span class=3D"cx"> =20
</span><span class=3D"cx"> if (!m_propertyTable) {
</span><span class=3D"lines">@@ -187,6 +189,8 @@
</span><span class=3D"cx">=20
</span><span class=3D"cx"> unsigned outOfLineCapacity() const
</span><span class=3D"cx"> {
</span><ins>+ ASSERT(checkOffsetConsistency());
+ =20
</ins><span class=3D"cx"> unsigned outOfLineSize =3D this->=
;outOfLineSize();
</span><span class=3D"cx">=20
</span><span class=3D"cx"> if (!outOfLineSize)
</span><span class=3D"lines">@@ -201,14 +205,9 @@
</span><span class=3D"cx"> }
</span><span class=3D"cx"> unsigned outOfLineSize() const
</span><span class=3D"cx"> {
</span><ins>+ ASSERT(checkOffsetConsistency());
</ins><span class=3D"cx"> ASSERT(structure()->classInfo() =
=3D=3D &s_info);
</span><del>- if (m_propertyTable) {
- unsigned totalSize =3D m_propertyTable->propertyStora=
geSize();
- unsigned inlineCapacity =3D this->inlineCapacity();
- if (totalSize < inlineCapacity)
- return 0;
- return totalSize - inlineCapacity;
- }
</del><ins>+ =20
</ins><span class=3D"cx"> return numberOfOutOfLineSlotsForLas=
tOffset(m_offset);
</span><span class=3D"cx"> }
</span><span class=3D"cx"> bool hasInlineStorage() const
</span><span class=3D"lines">@@ -221,17 +220,10 @@
</span><span class=3D"cx"> }
</span><span class=3D"cx"> unsigned inlineSize() const
</span><span class=3D"cx"> {
</span><del>- unsigned result;
- if (m_propertyTable)
- result =3D m_propertyTable->propertyStorageSize();
- else
- result =3D m_offset + 1;
- return std::min<unsigned>(result, m_inlineCapacity);
</del><ins>+ return std::min<unsigned>(m_offset + 1, m_i=
nlineCapacity);
</ins><span class=3D"cx"> }
</span><span class=3D"cx"> unsigned totalStorageSize() const
</span><span class=3D"cx"> {
</span><del>- if (m_propertyTable)
- return m_propertyTable->propertyStorageSize();
</del><span class=3D"cx"> return numberOfSlotsForLastOffset(m=
_offset, m_inlineCapacity);
</span><span class=3D"cx"> }
</span><span class=3D"cx"> unsigned totalStorageCapacity() const
</span><span class=3D"lines">@@ -248,8 +240,6 @@
</span><span class=3D"cx"> }
</span><span class=3D"cx"> PropertyOffset lastValidOffset() const
</span><span class=3D"cx"> {
</span><del>- if (m_propertyTable)
- return offsetForPropertyNumber(m_propertyTable->prope=
rtyStorageSize() - 1, m_inlineCapacity);
</del><span class=3D"cx"> return m_offset;
</span><span class=3D"cx"> }
</span><span class=3D"cx"> bool isValidOffset(PropertyOffset offs=
et) const
</span><span class=3D"lines">@@ -281,8 +271,7 @@
</span><span class=3D"cx"> =20
</span><span class=3D"cx"> bool isEmpty() const
</span><span class=3D"cx"> {
</span><del>- if (m_propertyTable)
- return m_propertyTable->isEmpty();
</del><ins>+ ASSERT(checkOffsetConsistency());
</ins><span class=3D"cx"> return !JSC::isValidOffset(m_offset=
);
</span><span class=3D"cx"> }
</span><span class=3D"cx">=20
</span><span class=3D"lines">@@ -405,12 +394,14 @@
</span><span class=3D"cx"> void materializePropertyMapIfNecessary=
(JSGlobalData& globalData)
</span><span class=3D"cx"> {
</span><span class=3D"cx"> ASSERT(structure()->classInfo()=
=3D=3D &s_info);
</span><ins>+ ASSERT(checkOffsetConsistency());
</ins><span class=3D"cx"> if (!m_propertyTable && pre=
viousID())
</span><span class=3D"cx"> materializePropertyMap(globalD=
ata);
</span><span class=3D"cx"> }
</span><span class=3D"cx"> void materializePropertyMapIfNecessary=
ForPinning(JSGlobalData& globalData)
</span><span class=3D"cx"> {
</span><span class=3D"cx"> ASSERT(structure()->classInfo()=
=3D=3D &s_info);
</span><ins>+ checkOffsetConsistency();
</ins><span class=3D"cx"> if (!m_propertyTable)
</span><span class=3D"cx"> materializePropertyMap(globalD=
ata);
</span><span class=3D"cx"> }
</span><span class=3D"lines">@@ -453,6 +444,20 @@
</span><span class=3D"cx"> ASSERT(typeInfo().structureHasRare=
Data());
</span><span class=3D"cx"> return static_cast<StructureRar=
eData*>(m_previousOrRareData.get());
</span><span class=3D"cx"> }
</span><ins>+ =20
+ ALWAYS_INLINE bool checkOffsetConsistency() const
+ {
+ if (!m_propertyTable) {
+ ASSERT(!m_isPinnedPropertyTable);
+ return true;
+ }
+ =20
+ RELEASE_ASSERT(numberOfSlotsForLastOffset(m_offset, m_inline=
Capacity) =3D=3D m_propertyTable->propertyStorageSize());
+ unsigned totalSize =3D m_propertyTable->propertyStorageSi=
ze();
+ RELEASE_ASSERT((totalSize < inlineCapacity() ? 0 : totalS=
ize - inlineCapacity()) =3D=3D numberOfOutOfLineSlotsForLastOffset(m_offs=
et));
+ =20
+ return true;
+ }
</ins><span class=3D"cx">=20
</span><span class=3D"cx"> void allocateRareData(JSGlobalData&=
;);
</span><span class=3D"cx"> void cloneRareDataFrom(JSGlobalData&am=
p;, const Structure*);
</span></span></pre>
</div>
</div>
</body>
</html>
More information about the webkit-changes
mailing list