summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/runtime/StructureInlines.h
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2015-05-20 09:56:07 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2015-05-20 09:56:07 +0000
commit41386e9cb918eed93b3f13648cbef387e371e451 (patch)
treea97f9d7bd1d9d091833286085f72da9d83fd0606 /Source/JavaScriptCore/runtime/StructureInlines.h
parente15dd966d523731101f70ccf768bba12435a0208 (diff)
downloadWebKitGtk-tarball-41386e9cb918eed93b3f13648cbef387e371e451.tar.gz
webkitgtk-2.4.9webkitgtk-2.4.9
Diffstat (limited to 'Source/JavaScriptCore/runtime/StructureInlines.h')
-rw-r--r--Source/JavaScriptCore/runtime/StructureInlines.h134
1 files changed, 39 insertions, 95 deletions
diff --git a/Source/JavaScriptCore/runtime/StructureInlines.h b/Source/JavaScriptCore/runtime/StructureInlines.h
index f1955f656..5895ecb20 100644
--- a/Source/JavaScriptCore/runtime/StructureInlines.h
+++ b/Source/JavaScriptCore/runtime/StructureInlines.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
@@ -49,10 +49,10 @@ inline Structure* Structure::createStructure(VM& vm)
return structure;
}
-inline Structure* Structure::create(VM& vm, Structure* structure, DeferredStructureTransitionWatchpointFire* deferred)
+inline Structure* Structure::create(VM& vm, const Structure* structure)
{
ASSERT(vm.structureStructure);
- Structure* newStructure = new (NotNull, allocateCell<Structure>(vm.heap)) Structure(vm, structure, deferred);
+ Structure* newStructure = new (NotNull, allocateCell<Structure>(vm.heap)) Structure(vm, structure);
newStructure->finishCreation(vm);
return newStructure;
}
@@ -61,7 +61,7 @@ inline JSObject* Structure::storedPrototypeObject() const
{
JSValue value = m_prototype.get();
if (value.isNull())
- return nullptr;
+ return 0;
return asObject(value);
}
@@ -69,74 +69,42 @@ inline Structure* Structure::storedPrototypeStructure() const
{
JSObject* object = storedPrototypeObject();
if (!object)
- return nullptr;
+ return 0;
return object->structure();
}
-ALWAYS_INLINE PropertyOffset Structure::get(VM& vm, PropertyName propertyName)
+inline PropertyOffset Structure::get(VM& vm, PropertyName propertyName)
{
ASSERT(!isCompilationThread());
ASSERT(structure()->classInfo() == info());
- PropertyTable* propertyTable;
- materializePropertyMapIfNecessary(vm, propertyTable);
- if (!propertyTable)
+ DeferGC deferGC(vm.heap);
+ materializePropertyMapIfNecessary(vm, deferGC);
+ if (!propertyTable())
return invalidOffset;
- PropertyMapEntry* entry = propertyTable->get(propertyName.uid());
+ PropertyMapEntry* entry = propertyTable()->find(propertyName.uid()).first;
return entry ? entry->offset : invalidOffset;
}
-
-ALWAYS_INLINE PropertyOffset Structure::get(VM& vm, PropertyName propertyName, unsigned& attributes)
+
+inline PropertyOffset Structure::get(VM& vm, const WTF::String& name)
{
ASSERT(!isCompilationThread());
ASSERT(structure()->classInfo() == info());
-
- PropertyTable* propertyTable;
- materializePropertyMapIfNecessary(vm, propertyTable);
- if (!propertyTable)
- return invalidOffset;
-
- PropertyMapEntry* entry = propertyTable->get(propertyName.uid());
- if (!entry)
+ DeferGC deferGC(vm.heap);
+ materializePropertyMapIfNecessary(vm, deferGC);
+ if (!propertyTable())
return invalidOffset;
- attributes = entry->attributes;
- return entry->offset;
+ PropertyMapEntry* entry = propertyTable()->findWithString(name.impl()).first;
+ return entry ? entry->offset : invalidOffset;
}
-
-template<typename Functor>
-void Structure::forEachPropertyConcurrently(const Functor& functor)
-{
- Vector<Structure*, 8> structures;
- Structure* structure;
- PropertyTable* table;
- findStructuresAndMapForMaterialization(structures, structure, table);
-
- if (table) {
- for (auto& entry : *table) {
- if (!functor(entry)) {
- structure->m_lock.unlock();
- return;
- }
- }
- structure->m_lock.unlock();
- }
-
- for (unsigned i = structures.size(); i--;) {
- structure = structures[i];
- if (!structure->m_nameInPrevious)
- continue;
-
- if (!functor(PropertyMapEntry(structure->m_nameInPrevious.get(), structure->m_offset, structure->attributesInPrevious())))
- return;
- }
-}
-
-inline PropertyOffset Structure::getConcurrently(UniquedStringImpl* uid)
+inline PropertyOffset Structure::getConcurrently(VM& vm, StringImpl* uid)
{
unsigned attributesIgnored;
- return getConcurrently(uid, attributesIgnored);
+ JSCell* specificValueIgnored;
+ return getConcurrently(
+ vm, uid, attributesIgnored, specificValueIgnored);
}
inline bool Structure::hasIndexingHeader(const JSCell* cell) const
@@ -164,12 +132,25 @@ inline bool Structure::transitivelyTransitionedFrom(Structure* structureToFind)
return false;
}
+inline void Structure::setEnumerationCache(VM& vm, JSPropertyNameIterator* enumerationCache)
+{
+ ASSERT(!isDictionary());
+ if (!typeInfo().structureHasRareData())
+ allocateRareData(vm);
+ rareData()->setEnumerationCache(vm, this, enumerationCache);
+}
+
+inline JSPropertyNameIterator* Structure::enumerationCache()
+{
+ if (!typeInfo().structureHasRareData())
+ return 0;
+ return rareData()->enumerationCache();
+}
+
inline JSValue Structure::prototypeForLookup(JSGlobalObject* globalObject) const
{
if (isObject())
return m_prototype.get();
- if (typeInfo().type() == SymbolType)
- return globalObject->symbolPrototype();
ASSERT(typeInfo().type() == StringType);
return globalObject->stringPrototype();
@@ -242,37 +223,12 @@ ALWAYS_INLINE WriteBarrier<PropertyTable>& Structure::propertyTable()
return m_propertyTableUnsafe;
}
-inline void Structure::didReplaceProperty(PropertyOffset offset)
-{
- if (LIKELY(!hasRareData()))
- return;
- StructureRareData::PropertyWatchpointMap* map = rareData()->m_replacementWatchpointSets.get();
- if (LIKELY(!map))
- return;
- WatchpointSet* set = map->get(offset);
- if (LIKELY(!set))
- return;
- set->fireAll("Property did get replaced");
-}
-
-inline WatchpointSet* Structure::propertyReplacementWatchpointSet(PropertyOffset offset)
-{
- ConcurrentJITLocker locker(m_lock);
- if (!hasRareData())
- return nullptr;
- WTF::loadLoadFence();
- StructureRareData::PropertyWatchpointMap* map = rareData()->m_replacementWatchpointSets.get();
- if (!map)
- return nullptr;
- return map->get(offset);
-}
-
ALWAYS_INLINE bool Structure::checkOffsetConsistency() const
{
PropertyTable* propertyTable = m_propertyTableUnsafe.get();
if (!propertyTable) {
- ASSERT(!isPinnedPropertyTable());
+ ASSERT(!m_isPinnedPropertyTable);
return true;
}
@@ -290,18 +246,6 @@ ALWAYS_INLINE bool Structure::checkOffsetConsistency() const
return true;
}
-inline size_t nextOutOfLineStorageCapacity(size_t currentCapacity)
-{
- if (!currentCapacity)
- return initialOutOfLineCapacity;
- return currentCapacity * outOfLineGrowthFactor;
-}
-
-inline size_t Structure::suggestedNewOutOfLineStorageCapacity()
-{
- return nextOutOfLineStorageCapacity(outOfLineCapacity());
-}
-
} // namespace JSC
#endif // StructureInlines_h