summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/runtime/Structure.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-05-25 15:09:11 +0200
committerSimon Hausmann <simon.hausmann@nokia.com>2012-05-25 15:09:11 +0200
commita89b2ebb8e192c5e8cea21079bda2ee2c0c7dddd (patch)
treeb7abd9f49ae1d4d2e426a5883bfccd42b8e2ee12 /Source/JavaScriptCore/runtime/Structure.cpp
parent8d473cf9743f1d30a16a27114e93bd5af5648d23 (diff)
downloadqtwebkit-a89b2ebb8e192c5e8cea21079bda2ee2c0c7dddd.tar.gz
Imported WebKit commit eb5c1b8fe4d4b1b90b5137433fc58a91da0e6878 (http://svn.webkit.org/repository/webkit/trunk@118516)
Diffstat (limited to 'Source/JavaScriptCore/runtime/Structure.cpp')
-rw-r--r--Source/JavaScriptCore/runtime/Structure.cpp30
1 files changed, 12 insertions, 18 deletions
diff --git a/Source/JavaScriptCore/runtime/Structure.cpp b/Source/JavaScriptCore/runtime/Structure.cpp
index 693f3f317..b22deb0fa 100644
--- a/Source/JavaScriptCore/runtime/Structure.cpp
+++ b/Source/JavaScriptCore/runtime/Structure.cpp
@@ -67,7 +67,7 @@ bool StructureTransitionTable::contains(StringImpl* rep, unsigned attributes) co
Structure* transition = singleTransition();
return transition && transition->m_nameInPrevious == rep && transition->m_attributesInPrevious == attributes;
}
- return map()->contains(make_pair(rep, attributes));
+ return map()->get(make_pair(rep, attributes));
}
inline Structure* StructureTransitionTable::get(StringImpl* rep, unsigned attributes) const
@@ -101,13 +101,7 @@ inline void StructureTransitionTable::add(JSGlobalData& globalData, Structure* s
// Newer versions of the STL have an std::make_pair function that takes rvalue references.
// When either of the parameters are bitfields, the C++ compiler will try to bind them as lvalues, which is invalid. To work around this, use unary "+" to make the parameter an rvalue.
// See https://bugs.webkit.org/show_bug.cgi?id=59261 for more details
- TransitionMap::AddResult result = map()->add(globalData, make_pair(structure->m_nameInPrevious, +structure->m_attributesInPrevious), structure);
- if (!result.isNewEntry) {
- // There already is an entry! - we should only hit this when despecifying.
- ASSERT(result.iterator.get().second->m_specificValueInPrevious);
- ASSERT(!structure->m_specificValueInPrevious);
- map()->set(globalData, result.iterator.get().first, structure);
- }
+ map()->set(globalData, make_pair(structure->m_nameInPrevious, +structure->m_attributesInPrevious), structure);
}
void Structure::dumpStatistics()
@@ -275,7 +269,7 @@ size_t Structure::suggestedNewPropertyStorageSize()
void Structure::despecifyDictionaryFunction(JSGlobalData& globalData, PropertyName propertyName)
{
- StringImpl* rep = propertyName.impl();
+ StringImpl* rep = propertyName.uid();
materializePropertyMapIfNecessary(globalData);
@@ -292,7 +286,7 @@ Structure* Structure::addPropertyTransitionToExistingStructure(Structure* struct
ASSERT(!structure->isDictionary());
ASSERT(structure->isObject());
- if (Structure* existingTransition = structure->m_transitionTable.get(propertyName.impl(), attributes)) {
+ if (Structure* existingTransition = structure->m_transitionTable.get(propertyName.uid(), attributes)) {
JSCell* specificValueInPrevious = existingTransition->m_specificValueInPrevious.get();
if (specificValueInPrevious && specificValueInPrevious != specificValue)
return 0;
@@ -313,7 +307,7 @@ Structure* Structure::addPropertyTransition(JSGlobalData& globalData, Structure*
// In this case we clear the value of specificFunction which will result
// in us adding a non-specific transition, and any subsequent lookup in
// Structure::addPropertyTransitionToExistingStructure will just use that.
- if (specificValue && structure->m_transitionTable.contains(propertyName.impl(), attributes))
+ if (specificValue && structure->m_transitionTable.contains(propertyName.uid(), attributes))
specificValue = 0;
ASSERT(!structure->isDictionary());
@@ -336,7 +330,7 @@ Structure* Structure::addPropertyTransition(JSGlobalData& globalData, Structure*
transition->m_cachedPrototypeChain.setMayBeNull(globalData, transition, structure->m_cachedPrototypeChain.get());
transition->m_previous.set(globalData, transition, structure);
- transition->m_nameInPrevious = propertyName.impl();
+ transition->m_nameInPrevious = propertyName.uid();
transition->m_attributesInPrevious = attributes;
transition->m_specificValueInPrevious.setMayBeNull(globalData, transition, specificValue);
@@ -425,7 +419,7 @@ Structure* Structure::attributeChangeTransition(JSGlobalData& globalData, Struct
}
ASSERT(structure->m_propertyTable);
- PropertyMapEntry* entry = structure->m_propertyTable->find(propertyName.impl()).first;
+ PropertyMapEntry* entry = structure->m_propertyTable->find(propertyName.uid()).first;
ASSERT(entry);
entry->attributes = attributes;
@@ -650,7 +644,7 @@ size_t Structure::get(JSGlobalData& globalData, PropertyName propertyName, unsig
if (!m_propertyTable)
return WTF::notFound;
- PropertyMapEntry* entry = m_propertyTable->find(propertyName.impl()).first;
+ PropertyMapEntry* entry = m_propertyTable->find(propertyName.uid()).first;
if (!entry)
return WTF::notFound;
@@ -665,7 +659,7 @@ bool Structure::despecifyFunction(JSGlobalData& globalData, PropertyName propert
if (!m_propertyTable)
return false;
- PropertyMapEntry* entry = m_propertyTable->find(propertyName.impl()).first;
+ PropertyMapEntry* entry = m_propertyTable->find(propertyName.uid()).first;
if (!entry)
return false;
@@ -693,7 +687,7 @@ size_t Structure::putSpecificValue(JSGlobalData& globalData, PropertyName proper
if (attributes & DontEnum)
m_hasNonEnumerableProperties = true;
- StringImpl* rep = propertyName.impl();
+ StringImpl* rep = propertyName.uid();
if (!m_propertyTable)
createPropertyMap();
@@ -715,7 +709,7 @@ size_t Structure::remove(PropertyName propertyName)
{
checkConsistency();
- StringImpl* rep = propertyName.impl();
+ StringImpl* rep = propertyName.uid();
if (!m_propertyTable)
return notFound;
@@ -753,7 +747,7 @@ void Structure::getPropertyNamesFromStructure(JSGlobalData& globalData, Property
PropertyTable::iterator end = m_propertyTable->end();
for (PropertyTable::iterator iter = m_propertyTable->begin(); iter != end; ++iter) {
ASSERT(m_hasNonEnumerableProperties || !(iter->attributes & DontEnum));
- if (!(iter->attributes & DontEnum) || (mode == IncludeDontEnumProperties)) {
+ if (iter->key->isIdentifier() && (!(iter->attributes & DontEnum) || mode == IncludeDontEnumProperties)) {
if (knownUnique)
propertyNames.addKnownUnique(iter->key);
else