JavaScriptCore:
2008-11-15 Darin Adler <darin@apple.com>
Rubber stamped by Geoff Garen.
- do the long-planned StructureID -> Structure rename
* API/JSCallbackConstructor.cpp:
(JSC::JSCallbackConstructor::JSCallbackConstructor):
* API/JSCallbackConstructor.h:
(JSC::JSCallbackConstructor::createStructure):
* API/JSCallbackFunction.h:
(JSC::JSCallbackFunction::createStructure):
* API/JSCallbackObject.h:
(JSC::JSCallbackObject::createStructure):
* API/JSCallbackObjectFunctions.h:
(JSC::::JSCallbackObject):
* API/JSValueRef.cpp:
(JSValueIsInstanceOfConstructor):
* GNUmakefile.am:
* JavaScriptCore.exp:
* JavaScriptCore.pri:
* JavaScriptCore.scons:
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
* JavaScriptCoreSources.bkl:
* VM/CTI.cpp:
(JSC::CTI::compileBinaryArithOp):
(JSC::CTI::privateCompileMainPass):
(JSC::CTI::privateCompileGetByIdSelf):
(JSC::CTI::privateCompileGetByIdProto):
(JSC::CTI::privateCompileGetByIdChain):
(JSC::CTI::privateCompilePutByIdReplace):
(JSC::transitionWillNeedStorageRealloc):
(JSC::CTI::privateCompilePutByIdTransition):
(JSC::CTI::patchGetByIdSelf):
(JSC::CTI::patchPutByIdReplace):
* VM/CTI.h:
(JSC::CTI::compileGetByIdSelf):
(JSC::CTI::compileGetByIdProto):
(JSC::CTI::compileGetByIdChain):
(JSC::CTI::compilePutByIdReplace):
(JSC::CTI::compilePutByIdTransition):
* VM/CodeBlock.cpp:
(JSC::CodeBlock::printStructure):
(JSC::CodeBlock::printStructures):
(JSC::CodeBlock::dump):
(JSC::CodeBlock::~CodeBlock):
(JSC::CodeBlock::derefStructures):
(JSC::CodeBlock::refStructures):
* VM/CodeBlock.h:
* VM/Instruction.h:
(JSC::Instruction::Instruction):
(JSC::Instruction::):
* VM/Machine.cpp:
(JSC::jsTypeStringForValue):
(JSC::jsIsObjectType):
(JSC::BytecodeInterpreter::resolveGlobal):
(JSC::BytecodeInterpreter::BytecodeInterpreter):
(JSC::cachePrototypeChain):
(JSC::BytecodeInterpreter::tryCachePutByID):
(JSC::BytecodeInterpreter::uncachePutByID):
(JSC::BytecodeInterpreter::tryCacheGetByID):
(JSC::BytecodeInterpreter::uncacheGetByID):
(JSC::BytecodeInterpreter::privateExecute):
(JSC::BytecodeInterpreter::tryCTICachePutByID):
(JSC::BytecodeInterpreter::tryCTICacheGetByID):
(JSC::BytecodeInterpreter::cti_op_instanceof):
(JSC::BytecodeInterpreter::cti_op_construct_JSConstruct):
(JSC::BytecodeInterpreter::cti_op_resolve_global):
(JSC::BytecodeInterpreter::cti_op_is_undefined):
* runtime/Arguments.h:
(JSC::Arguments::createStructure):
* runtime/ArrayConstructor.cpp:
(JSC::ArrayConstructor::ArrayConstructor):
* runtime/ArrayConstructor.h:
* runtime/ArrayPrototype.cpp:
(JSC::ArrayPrototype::ArrayPrototype):
* runtime/ArrayPrototype.h:
* runtime/BatchedTransitionOptimizer.h:
(JSC::BatchedTransitionOptimizer::BatchedTransitionOptimizer):
(JSC::BatchedTransitionOptimizer::~BatchedTransitionOptimizer):
* runtime/BooleanConstructor.cpp:
(JSC::BooleanConstructor::BooleanConstructor):
* runtime/BooleanConstructor.h:
* runtime/BooleanObject.cpp:
(JSC::BooleanObject::BooleanObject):
* runtime/BooleanObject.h:
* runtime/BooleanPrototype.cpp:
(JSC::BooleanPrototype::BooleanPrototype):
* runtime/BooleanPrototype.h:
* runtime/DateConstructor.cpp:
(JSC::DateConstructor::DateConstructor):
* runtime/DateConstructor.h:
* runtime/DateInstance.cpp:
(JSC::DateInstance::DateInstance):
* runtime/DateInstance.h:
* runtime/DatePrototype.cpp:
(JSC::DatePrototype::DatePrototype):
* runtime/DatePrototype.h:
(JSC::DatePrototype::createStructure):
* runtime/ErrorConstructor.cpp:
(JSC::ErrorConstructor::ErrorConstructor):
* runtime/ErrorConstructor.h:
* runtime/ErrorInstance.cpp:
(JSC::ErrorInstance::ErrorInstance):
* runtime/ErrorInstance.h:
* runtime/ErrorPrototype.cpp:
(JSC::ErrorPrototype::ErrorPrototype):
* runtime/ErrorPrototype.h:
* runtime/FunctionConstructor.cpp:
(JSC::FunctionConstructor::FunctionConstructor):
* runtime/FunctionConstructor.h:
* runtime/FunctionPrototype.cpp:
(JSC::FunctionPrototype::FunctionPrototype):
(JSC::FunctionPrototype::addFunctionProperties):
* runtime/FunctionPrototype.h:
(JSC::FunctionPrototype::createStructure):
* runtime/GlobalEvalFunction.cpp:
(JSC::GlobalEvalFunction::GlobalEvalFunction):
* runtime/GlobalEvalFunction.h:
* runtime/Identifier.h:
* runtime/InternalFunction.cpp:
(JSC::InternalFunction::InternalFunction):
* runtime/InternalFunction.h:
(JSC::InternalFunction::createStructure):
(JSC::InternalFunction::InternalFunction):
* runtime/JSActivation.cpp:
(JSC::JSActivation::JSActivation):
* runtime/JSActivation.h:
(JSC::JSActivation::createStructure):
* runtime/JSArray.cpp:
(JSC::JSArray::JSArray):
* runtime/JSArray.h:
(JSC::JSArray::createStructure):
* runtime/JSCell.h:
(JSC::JSCell::JSCell):
(JSC::JSCell::isObject):
(JSC::JSCell::isString):
(JSC::JSCell::structure):
(JSC::JSValue::needsThisConversion):
* runtime/JSFunction.cpp:
(JSC::JSFunction::construct):
* runtime/JSFunction.h:
(JSC::JSFunction::JSFunction):
(JSC::JSFunction::createStructure):
* runtime/JSGlobalData.cpp:
(JSC::JSGlobalData::JSGlobalData):
(JSC::JSGlobalData::createLeaked):
* runtime/JSGlobalData.h:
* runtime/JSGlobalObject.cpp:
(JSC::markIfNeeded):
(JSC::JSGlobalObject::reset):
* runtime/JSGlobalObject.h:
(JSC::JSGlobalObject::JSGlobalObject):
(JSC::JSGlobalObject::argumentsStructure):
(JSC::JSGlobalObject::arrayStructure):
(JSC::JSGlobalObject::booleanObjectStructure):
(JSC::JSGlobalObject::callbackConstructorStructure):
(JSC::JSGlobalObject::callbackFunctionStructure):
(JSC::JSGlobalObject::callbackObjectStructure):
(JSC::JSGlobalObject::dateStructure):
(JSC::JSGlobalObject::emptyObjectStructure):
(JSC::JSGlobalObject::errorStructure):
(JSC::JSGlobalObject::functionStructure):
(JSC::JSGlobalObject::numberObjectStructure):
(JSC::JSGlobalObject::prototypeFunctionStructure):
(JSC::JSGlobalObject::regExpMatchesArrayStructure):
(JSC::JSGlobalObject::regExpStructure):
(JSC::JSGlobalObject::stringObjectStructure):
(JSC::JSGlobalObject::createStructure):
(JSC::Structure::prototypeForLookup):
* runtime/JSNotAnObject.h:
(JSC::JSNotAnObject::createStructure):
* runtime/JSNumberCell.h:
(JSC::JSNumberCell::createStructure):
(JSC::JSNumberCell::JSNumberCell):
* runtime/JSObject.cpp:
(JSC::JSObject::mark):
(JSC::JSObject::put):
(JSC::JSObject::deleteProperty):
(JSC::JSObject::defineGetter):
(JSC::JSObject::defineSetter):
(JSC::JSObject::getPropertyAttributes):
(JSC::JSObject::getPropertyNames):
(JSC::JSObject::removeDirect):
(JSC::JSObject::createInheritorID):
* runtime/JSObject.h:
(JSC::JSObject::getDirect):
(JSC::JSObject::getDirectLocation):
(JSC::JSObject::hasCustomProperties):
(JSC::JSObject::hasGetterSetterProperties):
(JSC::JSObject::createStructure):
(JSC::JSObject::JSObject):
(JSC::JSObject::~JSObject):
(JSC::JSObject::prototype):
(JSC::JSObject::setPrototype):
(JSC::JSObject::setStructure):
(JSC::JSObject::inheritorID):
(JSC::JSObject::inlineGetOwnPropertySlot):
(JSC::JSObject::getOwnPropertySlotForWrite):
(JSC::JSCell::fastGetOwnPropertySlot):
(JSC::JSObject::putDirect):
(JSC::JSObject::putDirectWithoutTransition):
(JSC::JSObject::transitionTo):
* runtime/JSPropertyNameIterator.h:
(JSC::JSPropertyNameIterator::next):
* runtime/JSStaticScopeObject.h:
(JSC::JSStaticScopeObject::JSStaticScopeObject):
(JSC::JSStaticScopeObject::createStructure):
* runtime/JSString.h:
(JSC::JSString::JSString):
(JSC::JSString::createStructure):
* runtime/JSVariableObject.h:
(JSC::JSVariableObject::JSVariableObject):
* runtime/JSWrapperObject.h:
(JSC::JSWrapperObject::JSWrapperObject):
* runtime/MathObject.cpp:
(JSC::MathObject::MathObject):
* runtime/MathObject.h:
(JSC::MathObject::createStructure):
* runtime/NativeErrorConstructor.cpp:
(JSC::NativeErrorConstructor::NativeErrorConstructor):
* runtime/NativeErrorConstructor.h:
* runtime/NativeErrorPrototype.cpp:
(JSC::NativeErrorPrototype::NativeErrorPrototype):
* runtime/NativeErrorPrototype.h:
* runtime/NumberConstructor.cpp:
(JSC::NumberConstructor::NumberConstructor):
* runtime/NumberConstructor.h:
(JSC::NumberConstructor::createStructure):
* runtime/NumberObject.cpp:
(JSC::NumberObject::NumberObject):
* runtime/NumberObject.h:
* runtime/NumberPrototype.cpp:
(JSC::NumberPrototype::NumberPrototype):
* runtime/NumberPrototype.h:
* runtime/ObjectConstructor.cpp:
(JSC::ObjectConstructor::ObjectConstructor):
* runtime/ObjectConstructor.h:
* runtime/ObjectPrototype.cpp:
(JSC::ObjectPrototype::ObjectPrototype):
* runtime/ObjectPrototype.h:
* runtime/Operations.h:
(JSC::equalSlowCaseInline):
* runtime/PropertyNameArray.h:
(JSC::PropertyNameArrayData::setCachedStructure):
(JSC::PropertyNameArrayData::cachedStructure):
(JSC::PropertyNameArrayData::setCachedPrototypeChain):
(JSC::PropertyNameArrayData::cachedPrototypeChain):
(JSC::PropertyNameArrayData::PropertyNameArrayData):
* runtime/PrototypeFunction.cpp:
(JSC::PrototypeFunction::PrototypeFunction):
* runtime/PrototypeFunction.h:
* runtime/RegExpConstructor.cpp:
(JSC::RegExpConstructor::RegExpConstructor):
* runtime/RegExpConstructor.h:
(JSC::RegExpConstructor::createStructure):
* runtime/RegExpObject.cpp:
(JSC::RegExpObject::RegExpObject):
* runtime/RegExpObject.h:
(JSC::RegExpObject::createStructure):
* runtime/RegExpPrototype.cpp:
(JSC::RegExpPrototype::RegExpPrototype):
* runtime/RegExpPrototype.h:
* runtime/StringConstructor.cpp:
(JSC::StringConstructor::StringConstructor):
* runtime/StringConstructor.h:
* runtime/StringObject.cpp:
(JSC::StringObject::StringObject):
* runtime/StringObject.h:
(JSC::StringObject::createStructure):
* runtime/StringObjectThatMasqueradesAsUndefined.h:
(JSC::StringObjectThatMasqueradesAsUndefined::create):
(JSC::StringObjectThatMasqueradesAsUndefined::StringObjectThatMasqueradesAsUndefined):
(JSC::StringObjectThatMasqueradesAsUndefined::createStructure):
* runtime/StringPrototype.cpp:
(JSC::StringPrototype::StringPrototype):
* runtime/StringPrototype.h:
* runtime/Structure.cpp: Copied from JavaScriptCore/runtime/StructureID.cpp.
(JSC::Structure::dumpStatistics):
(JSC::Structure::Structure):
(JSC::Structure::~Structure):
(JSC::Structure::startIgnoringLeaks):
(JSC::Structure::stopIgnoringLeaks):
(JSC::Structure::materializePropertyMap):
(JSC::Structure::getEnumerablePropertyNames):
(JSC::Structure::clearEnumerationCache):
(JSC::Structure::growPropertyStorageCapacity):
(JSC::Structure::addPropertyTransitionToExistingStructure):
(JSC::Structure::addPropertyTransition):
(JSC::Structure::removePropertyTransition):
(JSC::Structure::changePrototypeTransition):
(JSC::Structure::getterSetterTransition):
(JSC::Structure::toDictionaryTransition):
(JSC::Structure::fromDictionaryTransition):
(JSC::Structure::addPropertyWithoutTransition):
(JSC::Structure::removePropertyWithoutTransition):
(JSC::Structure::createCachedPrototypeChain):
(JSC::Structure::checkConsistency):
(JSC::Structure::copyPropertyTable):
(JSC::Structure::get):
(JSC::Structure::put):
(JSC::Structure::remove):
(JSC::Structure::insertIntoPropertyMapHashTable):
(JSC::Structure::createPropertyMapHashTable):
(JSC::Structure::expandPropertyMapHashTable):
(JSC::Structure::rehashPropertyMapHashTable):
(JSC::Structure::getEnumerablePropertyNamesInternal):
* runtime/Structure.h: Copied from JavaScriptCore/runtime/StructureID.h.
(JSC::Structure::create):
(JSC::Structure::previousID):
(JSC::Structure::setCachedPrototypeChain):
(JSC::Structure::cachedPrototypeChain):
(JSC::Structure::):
(JSC::Structure::get):
* runtime/StructureChain.cpp: Copied from JavaScriptCore/runtime/StructureIDChain.cpp.
(JSC::StructureChain::StructureChain):
(JSC::structureChainsAreEqual):
* runtime/StructureChain.h: Copied from JavaScriptCore/runtime/StructureIDChain.h.
(JSC::StructureChain::create):
(JSC::StructureChain::head):
* runtime/StructureID.cpp: Removed.
* runtime/StructureID.h: Removed.
* runtime/StructureIDChain.cpp: Removed.
* runtime/StructureIDChain.h: Removed.
* runtime/StructureIDTransitionTable.h: Removed.
* runtime/StructureTransitionTable.h: Copied from JavaScriptCore/runtime/StructureIDTransitionTable.h.
JavaScriptGlue:
2008-11-15 Darin Adler <darin@apple.com>
Rubber stamped by Geoff Garen.
- do the long-planned StructureID -> Structure rename
* JSRun.cpp:
(JSGlueGlobalObject::JSGlueGlobalObject):
(JSRun::JSRun):
* JSRun.h:
(JSGlueGlobalObject::userObjectStructure):
* JSUtils.cpp:
(getThreadGlobalObject):
* UserObjectImp.cpp:
(UserObjectImp::UserObjectImp):
* UserObjectImp.h:
(UserObjectImp::createStructure):
WebCore:
2008-11-15 Darin Adler <darin@apple.com>
Rubber stamped by Geoff Garen.
- do the long-planned StructureID -> Structure rename
* ForwardingHeaders/runtime/Structure.h: Copied from WebCore/ForwardingHeaders/runtime/StructureID.h.
* ForwardingHeaders/runtime/StructureID.h: Removed.
* bindings/js/JSAudioConstructor.cpp:
(WebCore::JSAudioConstructor::JSAudioConstructor):
* bindings/js/JSDOMBinding.cpp:
(WebCore::getCachedDOMStructure):
(WebCore::cacheDOMStructure):
* bindings/js/JSDOMBinding.h:
(WebCore::DOMObject::DOMObject):
(WebCore::getDOMStructure):
* bindings/js/JSDOMGlobalObject.cpp:
(WebCore::JSDOMGlobalObject::JSDOMGlobalObject):
* bindings/js/JSDOMGlobalObject.h:
* bindings/js/JSDOMWindowBase.cpp:
(WebCore::JSDOMWindowBase::JSDOMWindowBase):
* bindings/js/JSDOMWindowBase.h:
* bindings/js/JSDOMWindowShell.cpp:
(WebCore::JSDOMWindowShell::JSDOMWindowShell):
(WebCore::JSDOMWindowShell::setWindow):
* bindings/js/JSDOMWindowShell.h:
(WebCore::JSDOMWindowShell::createStructure):
* bindings/js/JSDedicatedWorkerConstructor.cpp:
(WebCore::JSDedicatedWorkerConstructor::JSDedicatedWorkerConstructor):
* bindings/js/JSHTMLAllCollection.h:
(WebCore::JSHTMLAllCollection::JSHTMLAllCollection):
(WebCore::JSHTMLAllCollection::createStructure):
* bindings/js/JSImageConstructor.cpp:
(WebCore::JSImageConstructor::JSImageConstructor):
* bindings/js/JSInspectedObjectWrapper.cpp:
(WebCore::JSInspectedObjectWrapper::wrap):
(WebCore::JSInspectedObjectWrapper::JSInspectedObjectWrapper):
* bindings/js/JSInspectedObjectWrapper.h:
* bindings/js/JSInspectorCallbackWrapper.cpp:
(WebCore::leakInspectorCallbackWrapperStructure):
(WebCore::JSInspectorCallbackWrapper::wrap):
(WebCore::JSInspectorCallbackWrapper::JSInspectorCallbackWrapper):
* bindings/js/JSInspectorCallbackWrapper.h:
* bindings/js/JSMessageChannelConstructor.cpp:
(WebCore::JSMessageChannelConstructor::JSMessageChannelConstructor):
* bindings/js/JSNamedNodesCollection.h:
(WebCore::JSNamedNodesCollection::createStructure):
* bindings/js/JSOptionConstructor.cpp:
(WebCore::JSOptionConstructor::JSOptionConstructor):
* bindings/js/JSQuarantinedObjectWrapper.cpp:
(WebCore::JSQuarantinedObjectWrapper::JSQuarantinedObjectWrapper):
* bindings/js/JSQuarantinedObjectWrapper.h:
(WebCore::JSQuarantinedObjectWrapper::createStructure):
* bindings/js/JSRGBColor.h:
(WebCore::JSRGBColor::createStructure):
* bindings/js/JSWorkerContext.cpp:
(WebCore::createJSWorkerContextStructure):
(WebCore::JSWorkerContext::JSWorkerContext):
(WebCore::JSWorkerContext::createPrototype):
* bindings/js/JSWorkerContext.h:
(WebCore::JSWorkerContext::createStructure):
(WebCore::JSWorkerContextPrototype::JSWorkerContextPrototype):
(WebCore::JSWorkerContextPrototype::createStructure):
* bindings/js/JSXMLHttpRequestConstructor.cpp:
(WebCore::JSXMLHttpRequestConstructor::JSXMLHttpRequestConstructor):
* bindings/js/JSXSLTProcessorConstructor.cpp:
(WebCore::JSXSLTProcessorConstructor::JSXSLTProcessorConstructor):
* bindings/scripts/CodeGeneratorJS.pm:
* bridge/objc/objc_runtime.h:
(JSC::Bindings::ObjcFallbackObjectImp::createStructure):
* bridge/qt/qt_runtime.cpp:
(JSC::Bindings::QtConnectionObject::execute):
* bridge/qt/qt_runtime.h:
(JSC::Bindings::QtRuntimeMethod::createStructure):
* bridge/runtime_array.h:
(JSC::RuntimeArray::createStructure):
* bridge/runtime_method.h:
(JSC::RuntimeMethod::createStructure):
* bridge/runtime_object.cpp:
(JSC::RuntimeObjectImp::RuntimeObjectImp):
* bridge/runtime_object.h:
(JSC::RuntimeObjectImp::createStructure):
WebKitTools:
2008-11-15 Darin Adler <darin@apple.com>
Rubber stamped by Geoff Garen.
- do the long-planned StructureID -> Structure rename
* Scripts/check-for-global-initializers: Update name of StructureID.o.
* Scripts/do-webcore-rename: Renaming script that I used.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@38440 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/JavaScriptCore/runtime/Structure.h b/JavaScriptCore/runtime/Structure.h
new file mode 100644
index 0000000..343fde4
--- /dev/null
+++ b/JavaScriptCore/runtime/Structure.h
@@ -0,0 +1,223 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * 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 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 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
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef Structure_h
+#define Structure_h
+
+#include "Identifier.h"
+#include "JSType.h"
+#include "JSValue.h"
+#include "PropertyMapHashTable.h"
+#include "StructureChain.h"
+#include "StructureTransitionTable.h"
+#include "TypeInfo.h"
+#include "UString.h"
+#include <wtf/HashFunctions.h>
+#include <wtf/HashTraits.h>
+#include <wtf/OwnArrayPtr.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+
+#ifndef NDEBUG
+#define DUMP_PROPERTYMAP_STATS 0
+#else
+#define DUMP_PROPERTYMAP_STATS 0
+#endif
+
+namespace JSC {
+
+ class PropertyNameArray;
+ class PropertyNameArrayData;
+
+ class Structure : public RefCounted<Structure> {
+ public:
+ friend class CTI;
+ static PassRefPtr<Structure> create(JSValue* prototype, const TypeInfo& typeInfo)
+ {
+ return adoptRef(new Structure(prototype, typeInfo));
+ }
+
+ static void startIgnoringLeaks();
+ static void stopIgnoringLeaks();
+
+ static void dumpStatistics();
+
+ static PassRefPtr<Structure> addPropertyTransition(Structure*, const Identifier& propertyName, unsigned attributes, size_t& offset);
+ static PassRefPtr<Structure> addPropertyTransitionToExistingStructure(Structure*, const Identifier& propertyName, unsigned attributes, size_t& offset);
+ static PassRefPtr<Structure> removePropertyTransition(Structure*, const Identifier& propertyName, size_t& offset);
+ static PassRefPtr<Structure> changePrototypeTransition(Structure*, JSValue* prototype);
+ static PassRefPtr<Structure> getterSetterTransition(Structure*);
+ static PassRefPtr<Structure> toDictionaryTransition(Structure*);
+ static PassRefPtr<Structure> fromDictionaryTransition(Structure*);
+
+ ~Structure();
+
+ void mark()
+ {
+ if (!m_prototype->marked())
+ m_prototype->mark();
+ }
+
+ // These should be used with caution.
+ size_t addPropertyWithoutTransition(const Identifier& propertyName, unsigned attributes);
+ size_t removePropertyWithoutTransition(const Identifier& propertyName);
+ void setPrototypeWithoutTransition(JSValue* prototype) { m_prototype = prototype; }
+
+ bool isDictionary() const { return m_isDictionary; }
+
+ const TypeInfo& typeInfo() const { return m_typeInfo; }
+
+ // For use when first creating a new structure.
+ TypeInfo& mutableTypeInfo() { return m_typeInfo; }
+
+ JSValue* storedPrototype() const { return m_prototype; }
+ JSValue* prototypeForLookup(ExecState*);
+
+ Structure* previousID() const { return m_previous.get(); }
+
+ StructureChain* createCachedPrototypeChain();
+ void setCachedPrototypeChain(PassRefPtr<StructureChain> cachedPrototypeChain) { m_cachedPrototypeChain = cachedPrototypeChain; }
+ StructureChain* cachedPrototypeChain() const { return m_cachedPrototypeChain.get(); }
+
+ void growPropertyStorageCapacity();
+ size_t propertyStorageCapacity() const { return m_propertyStorageCapacity; }
+ size_t propertyStorageSize() const { return m_propertyTable ? m_propertyTable->keyCount + m_deletedOffsets.size() : m_offset + 1; }
+
+ size_t get(const Identifier& propertyName);
+ size_t get(const Identifier& propertyName, unsigned& attributes);
+ void getEnumerablePropertyNames(ExecState*, PropertyNameArray&, JSObject*);
+
+ bool hasGetterSetterProperties() const { return m_hasGetterSetterProperties; }
+ void setHasGetterSetterProperties(bool hasGetterSetterProperties) { m_hasGetterSetterProperties = hasGetterSetterProperties; }
+
+ bool isEmpty() const { return m_propertyTable ? !m_propertyTable->keyCount : m_offset == WTF::notFound; }
+
+ private:
+ Structure(JSValue* prototype, const TypeInfo&);
+
+ size_t put(const Identifier& propertyName, unsigned attributes);
+ size_t remove(const Identifier& propertyName);
+ void getEnumerablePropertyNamesInternal(PropertyNameArray&);
+
+ void expandPropertyMapHashTable();
+ void rehashPropertyMapHashTable();
+ void rehashPropertyMapHashTable(unsigned newTableSize);
+ void createPropertyMapHashTable();
+ void createPropertyMapHashTable(unsigned newTableSize);
+ void insertIntoPropertyMapHashTable(const PropertyMapEntry&);
+ void checkConsistency();
+
+ PropertyMapHashTable* copyPropertyTable();
+ void materializePropertyMap();
+ void materializePropertyMapIfNecessary()
+ {
+ if (m_propertyTable || !m_previous)
+ return;
+ materializePropertyMap();
+ }
+
+ void clearEnumerationCache();
+
+ static const unsigned emptyEntryIndex = 0;
+
+ static const size_t s_maxTransitionLength = 64;
+
+ TypeInfo m_typeInfo;
+
+ JSValue* m_prototype;
+ RefPtr<StructureChain> m_cachedPrototypeChain;
+
+ RefPtr<Structure> m_previous;
+ UString::Rep* m_nameInPrevious;
+
+ size_t m_transitionCount;
+ union {
+ Structure* singleTransition;
+ StructureTransitionTable* table;
+ } m_transitions;
+
+ RefPtr<PropertyNameArrayData> m_cachedPropertyNameArrayData;
+
+ PropertyMapHashTable* m_propertyTable;
+ Vector<unsigned> m_deletedOffsets;
+
+ size_t m_propertyStorageCapacity;
+ size_t m_offset;
+
+ bool m_isDictionary : 1;
+ bool m_isPinnedPropertyTable : 1;
+ bool m_hasGetterSetterProperties : 1;
+ bool m_usingSingleTransitionSlot : 1;
+ unsigned m_attributesInPrevious : 5;
+ };
+
+ inline size_t Structure::get(const Identifier& propertyName)
+ {
+ ASSERT(!propertyName.isNull());
+
+ materializePropertyMapIfNecessary();
+ if (!m_propertyTable)
+ return WTF::notFound;
+
+ UString::Rep* rep = propertyName._ustring.rep();
+
+ unsigned i = rep->computedHash();
+
+#if DUMP_PROPERTYMAP_STATS
+ ++numProbes;
+#endif
+
+ unsigned entryIndex = m_propertyTable->entryIndices[i & m_propertyTable->sizeMask];
+ if (entryIndex == emptyEntryIndex)
+ return WTF::notFound;
+
+ if (rep == m_propertyTable->entries()[entryIndex - 1].key)
+ return m_propertyTable->entries()[entryIndex - 1].offset;
+
+#if DUMP_PROPERTYMAP_STATS
+ ++numCollisions;
+#endif
+
+ unsigned k = 1 | WTF::doubleHash(rep->computedHash());
+
+ while (1) {
+ i += k;
+
+#if DUMP_PROPERTYMAP_STATS
+ ++numRehashes;
+#endif
+
+ entryIndex = m_propertyTable->entryIndices[i & m_propertyTable->sizeMask];
+ if (entryIndex == emptyEntryIndex)
+ return WTF::notFound;
+
+ if (rep == m_propertyTable->entries()[entryIndex - 1].key)
+ return m_propertyTable->entries()[entryIndex - 1].offset;
+ }
+ }
+
+} // namespace JSC
+
+#endif // Structure_h