Ignore:
Timestamp:
Jan 28, 2010, 2:51:06 PM (15 years ago)
Author:
[email protected]
Message:

2010-01-28 Oliver Hunt <[email protected]>

Reviewed by Gavin Barraclough.

Simplify anonymous slot implementation
https://bugs.webkit.org/show_bug.cgi?id=34282

A class must now specify the number of slots it needs at construction time
rather than later on with a transition. This makes many things simpler,
we no longer need to need an additional transition on object creation to
add the anonymous slots, and we remove the need for a number of transition
type checks.

  • API/JSCallbackConstructor.h: (JSC::JSCallbackConstructor::createStructure):
  • API/JSCallbackFunction.h: (JSC::JSCallbackFunction::createStructure):
  • API/JSCallbackObject.h: (JSC::JSCallbackObject::createStructure):
  • JavaScriptCore.exp:
  • debugger/DebuggerActivation.h: (JSC::DebuggerActivation::createStructure):
  • runtime/Arguments.h: (JSC::Arguments::createStructure):
  • runtime/BooleanObject.h: (JSC::BooleanObject::createStructure):
  • runtime/DateInstance.h: (JSC::DateInstance::createStructure):
  • runtime/DatePrototype.h: (JSC::DatePrototype::createStructure):
  • runtime/FunctionPrototype.h: (JSC::FunctionPrototype::createStructure):
  • runtime/GetterSetter.h: (JSC::GetterSetter::createStructure):
  • runtime/GlobalEvalFunction.h: (JSC::GlobalEvalFunction::createStructure):
  • runtime/InternalFunction.h: (JSC::InternalFunction::createStructure):
  • runtime/JSAPIValueWrapper.h: (JSC::JSAPIValueWrapper::createStructure):
  • runtime/JSActivation.h: (JSC::JSActivation::createStructure):
  • runtime/JSArray.h: (JSC::JSArray::createStructure):
  • runtime/JSByteArray.cpp: (JSC::JSByteArray::createStructure):
  • runtime/JSCell.h: (JSC::JSCell::createDummyStructure):
  • runtime/JSFunction.h: (JSC::JSFunction::createStructure):
  • runtime/JSGlobalObject.h: (JSC::JSGlobalObject::createStructure):
  • runtime/JSNotAnObject.h: (JSC::JSNotAnObject::createStructure):
  • runtime/JSONObject.h: (JSC::JSONObject::createStructure):
  • runtime/JSObject.h: (JSC::JSObject::createStructure): (JSC::JSObject::putAnonymousValue): (JSC::JSObject::getAnonymousValue):
  • runtime/JSPropertyNameIterator.h: (JSC::JSPropertyNameIterator::createStructure):
  • runtime/JSStaticScopeObject.h: (JSC::JSStaticScopeObject::createStructure):
  • runtime/JSString.h: (JSC::Fiber::createStructure):
  • runtime/JSVariableObject.h: (JSC::JSVariableObject::createStructure):
  • runtime/JSWrapperObject.h: (JSC::JSWrapperObject::createStructure): (JSC::JSWrapperObject::JSWrapperObject):
  • runtime/MathObject.h: (JSC::MathObject::createStructure):
  • runtime/NumberConstructor.h: (JSC::NumberConstructor::createStructure):
  • runtime/NumberObject.h: (JSC::NumberObject::createStructure):
  • runtime/RegExpConstructor.h: (JSC::RegExpConstructor::createStructure):
  • runtime/RegExpObject.h: (JSC::RegExpObject::createStructure):
  • runtime/StringObject.h: (JSC::StringObject::createStructure):
  • runtime/StringObjectThatMasqueradesAsUndefined.h: (JSC::StringObjectThatMasqueradesAsUndefined::createStructure):
  • runtime/Structure.cpp: (JSC::Structure::~Structure): (JSC::Structure::materializePropertyMap):
  • runtime/Structure.h: (JSC::Structure::create): (JSC::Structure::anonymousSlotCount):
  • runtime/StructureTransitionTable.h:

2010-01-28 Oliver Hunt <[email protected]>

Reviewed by Gavin Barraclough.

Simplify anonymous slot implementation
https://bugs.webkit.org/show_bug.cgi?id=34282

Update JSGlue Structure usage to pass the anonymous slot count.

  • UserObjectImp.h: (UserObjectImp::createStructure):

2010-01-28 Oliver Hunt <[email protected]>

Reviewed by Gavin Barraclough.

Simplify anonymous slot implementation
https://bugs.webkit.org/show_bug.cgi?id=34282

Update the WebCore JS DOM bindings to correctly pass and
propagate the anonymous slot count information.

  • bindings/js/JSDOMBinding.h: (WebCore::DOMObjectWithGlobalPointer::createStructure): (WebCore::DOMConstructorObject::createStructure):
  • bindings/js/JSDOMWindowShell.h: (WebCore::JSDOMWindowShell::createStructure):
  • bindings/scripts/CodeGeneratorJS.pm:
  • bridge/objc/objc_runtime.h: (JSC::Bindings::ObjcFallbackObjectImp::createStructure):
  • bridge/runtime_array.h: (JSC::RuntimeArray::createStructure):
  • bridge/runtime_method.h: (JSC::RuntimeMethod::createStructure):
  • bridge/runtime_object.h: (JSC::RuntimeObjectImp::createStructure):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/runtime/StructureTransitionTable.h

    r53320 r54022  
    7070    class StructureTransitionTable {
    7171        typedef std::pair<Structure*, Structure*> Transition;
    72         struct TransitionTable : public HashMap<StructureTransitionTableHash::Key, Transition, StructureTransitionTableHash, StructureTransitionTableHashTraits> {
    73             typedef HashMap<unsigned, Structure*> AnonymousSlotMap;
    74 
    75             void addSlotTransition(unsigned count, Structure* structure)
    76             {
    77                 ASSERT(!getSlotTransition(count));
    78                 if (!m_anonymousSlotTable)
    79                     m_anonymousSlotTable.set(new AnonymousSlotMap);
    80                 m_anonymousSlotTable->add(count, structure);
    81             }
    82 
    83             void removeSlotTransition(unsigned count)
    84             {
    85                 ASSERT(getSlotTransition(count));
    86                 m_anonymousSlotTable->remove(count);
    87             }
    88 
    89             Structure* getSlotTransition(unsigned count)
    90             {
    91                 if (!m_anonymousSlotTable)
    92                     return 0;
    93 
    94                 AnonymousSlotMap::iterator find = m_anonymousSlotTable->find(count);
    95                 if (find == m_anonymousSlotTable->end())
    96                     return 0;
    97                 return find->second;
    98             }
    99         private:
    100             OwnPtr<AnonymousSlotMap> m_anonymousSlotTable;
    101         };
     72        typedef HashMap<StructureTransitionTableHash::Key, Transition, StructureTransitionTableHash, StructureTransitionTableHashTraits> TransitionTable;
    10273    public:
    10374        StructureTransitionTable() {
     
    155126        }
    156127
    157         Structure* getAnonymousSlotTransition(unsigned count)
    158         {
    159             if (usingSingleTransitionSlot())
    160                 return 0;
    161             return table()->getSlotTransition(count);
    162         }
    163 
    164         void addAnonymousSlotTransition(unsigned count, Structure* structure)
    165         {
    166             if (usingSingleTransitionSlot())
    167                 reifySingleTransition();
    168             ASSERT(!table()->getSlotTransition(count));
    169             table()->addSlotTransition(count, structure);
    170         }
    171        
    172         void removeAnonymousSlotTransition(unsigned count)
    173         {
    174             ASSERT(!usingSingleTransitionSlot());
    175             table()->removeSlotTransition(count);
    176         }
    177128    private:
    178129        TransitionTable* table() const { ASSERT(!usingSingleTransitionSlot()); return m_transitions.m_table; }
Note: See TracChangeset for help on using the changeset viewer.