Changeset 82971 in webkit


Ignore:
Timestamp:
Apr 5, 2011 1:03:08 PM (13 years ago)
Author:
oliver@apple.com
Message:

2011-04-05 Oliver Hunt <oliver@apple.com>

Reviewed by Gavin Barraclough.

Make caches window show more info about non-jsobject GC values
https://bugs.webkit.org/show_bug.cgi?id=57874

Add ClassInfo to the various internal JS types that currently
don't have any, and make the text for caches window show the
classname for non-JSObject instances.

  • runtime/Executable.cpp:
  • runtime/Executable.h: (JSC::ExecutableBase::createStructure): (JSC::NativeExecutable::createStructure): (JSC::NativeExecutable::NativeExecutable): (JSC::EvalExecutable::createStructure): (JSC::ProgramExecutable::createStructure): (JSC::FunctionExecutable::createStructure):
  • runtime/Heap.cpp: (JSC::TypeCounter::typeName):
  • runtime/JSGlobalData.cpp: (JSC::JSGlobalData::JSGlobalData):
  • runtime/JSGlobalData.h:
  • runtime/ScopeChain.cpp:
  • runtime/ScopeChain.h: (JSC::ScopeChainNode::createStructure):
  • runtime/StructureChain.cpp:
  • runtime/StructureChain.h: (JSC::StructureChain::createStructure):
Location:
trunk/Source/JavaScriptCore
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r82931 r82971  
     12011-04-05  Oliver Hunt  <oliver@apple.com>
     2
     3        Reviewed by Gavin Barraclough.
     4
     5        Make caches window show more info about non-jsobject GC values
     6        https://bugs.webkit.org/show_bug.cgi?id=57874
     7
     8        Add ClassInfo to the various internal JS types that currently
     9        don't have any, and make the text for caches window show the
     10        classname for non-JSObject instances.
     11
     12        * runtime/Executable.cpp:
     13        * runtime/Executable.h:
     14        (JSC::ExecutableBase::createStructure):
     15        (JSC::NativeExecutable::createStructure):
     16        (JSC::NativeExecutable::NativeExecutable):
     17        (JSC::EvalExecutable::createStructure):
     18        (JSC::ProgramExecutable::createStructure):
     19        (JSC::FunctionExecutable::createStructure):
     20        * runtime/Heap.cpp:
     21        (JSC::TypeCounter::typeName):
     22        * runtime/JSGlobalData.cpp:
     23        (JSC::JSGlobalData::JSGlobalData):
     24        * runtime/JSGlobalData.h:
     25        * runtime/ScopeChain.cpp:
     26        * runtime/ScopeChain.h:
     27        (JSC::ScopeChainNode::createStructure):
     28        * runtime/StructureChain.cpp:
     29        * runtime/StructureChain.h:
     30        (JSC::StructureChain::createStructure):
     31
    1322011-04-05  Nikolas Zimmermann  <nzimmermann@rim.com>
    233
  • trunk/Source/JavaScriptCore/runtime/Executable.cpp

    r81483 r82971  
    4141namespace JSC {
    4242
     43const ClassInfo ExecutableBase::s_info = { "Executable", 0, 0, 0 };
     44
     45const ClassInfo NativeExecutable::s_info = { "NativeExecutable", &ExecutableBase::s_info, 0, 0 };
     46
    4347NativeExecutable::~NativeExecutable()
    4448{
     
    4852{
    4953}
     54
     55const ClassInfo EvalExecutable::s_info = { "EvalExecutable", &ScriptExecutable::s_info, 0, 0 };
    5056
    5157EvalExecutable::EvalExecutable(ExecState* exec, const SourceCode& source, bool inStrictContext)
     
    5864}
    5965
     66const ClassInfo ProgramExecutable::s_info = { "ProgramExecutable", &ScriptExecutable::s_info, 0, 0 };
     67
    6068ProgramExecutable::ProgramExecutable(ExecState* exec, const SourceCode& source)
    6169    : ScriptExecutable(exec->globalData().programExecutableStructure.get(), exec, source, false)
     
    6674{
    6775}
     76
     77const ClassInfo FunctionExecutable::s_info = { "FunctionExecutable", &ScriptExecutable::s_info, 0, 0 };
    6878
    6979FunctionExecutable::FunctionExecutable(JSGlobalData* globalData, const Identifier& name, const SourceCode& source, bool forceUsesArguments, FunctionParameters* parameters, bool inStrictContext, int firstLine, int lastLine)
  • trunk/Source/JavaScriptCore/runtime/Executable.h

    r81904 r82971  
    6666        }
    6767
    68         static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue proto) { return Structure::create(globalData, proto, TypeInfo(CompoundType, StructureFlags), AnonymousSlotCount, 0); }
     68        static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue proto) { return Structure::create(globalData, proto, TypeInfo(CompoundType, StructureFlags), AnonymousSlotCount, &s_info); }
    6969
    7070    protected:
    7171        static const unsigned StructureFlags = 0;
     72        static const ClassInfo s_info;
    7273        int m_numParametersForCall;
    7374        int m_numParametersForConstruct;
     
    116117        NativeFunction function() { return m_function; }
    117118
     119        static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue proto) { return Structure::create(globalData, proto, TypeInfo(CompoundType, StructureFlags), AnonymousSlotCount, &s_info); }
     120
    118121    private:
    119122#if ENABLE(JIT)
    120123        NativeExecutable(JSGlobalData& globalData, JITCode callThunk, NativeFunction function, JITCode constructThunk, NativeFunction constructor)
    121             : ExecutableBase(globalData.executableStructure.get(), NUM_PARAMETERS_IS_HOST)
     124            : ExecutableBase(globalData.nativeExecutableStructure.get(), NUM_PARAMETERS_IS_HOST)
    122125            , m_function(function)
    123126            , m_constructor(constructor)
     
    130133#else
    131134        NativeExecutable(JSGlobalData& globalData, NativeFunction function, NativeFunction constructor)
    132             : ExecutableBase(globalData.executableStructure.get(), NUM_PARAMETERS_IS_HOST)
     135            : ExecutableBase(globalData.nativeExecutableStructure.get(), NUM_PARAMETERS_IS_HOST)
    133136            , m_function(function)
    134137            , m_constructor(constructor)
     
    141144        // trampoline. It may be easier to make NativeFunction be passed 'this' as a part of the ArgList.
    142145        NativeFunction m_constructor;
     146        static const ClassInfo s_info;
    143147    };
    144148
     
    239243        }
    240244#endif
    241         static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue proto) { return Structure::create(globalData, proto, TypeInfo(CompoundType, StructureFlags), AnonymousSlotCount, 0); }
     245        static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue proto) { return Structure::create(globalData, proto, TypeInfo(CompoundType, StructureFlags), AnonymousSlotCount, &s_info); }
    242246
    243247    private:
    244248        static const unsigned StructureFlags = OverridesMarkChildren | ScriptExecutable::StructureFlags;
     249        static const ClassInfo s_info;
    245250        EvalExecutable(ExecState*, const SourceCode&, bool);
    246251
     
    285290#endif
    286291       
    287         static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue proto) { return Structure::create(globalData, proto, TypeInfo(CompoundType, StructureFlags), AnonymousSlotCount, 0); }
     292        static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue proto) { return Structure::create(globalData, proto, TypeInfo(CompoundType, StructureFlags), AnonymousSlotCount, &s_info); }
    288293
    289294    private:
    290295        static const unsigned StructureFlags = OverridesMarkChildren | ScriptExecutable::StructureFlags;
     296        static const ClassInfo s_info;
    291297        ProgramExecutable(ExecState*, const SourceCode&);
    292298
     
    377383        void markChildren(MarkStack&);
    378384        static FunctionExecutable* fromGlobalCode(const Identifier&, ExecState*, Debugger*, const SourceCode&, JSObject** exception);
    379         static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue proto) { return Structure::create(globalData, proto, TypeInfo(CompoundType, StructureFlags), AnonymousSlotCount, 0); }
     385        static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue proto) { return Structure::create(globalData, proto, TypeInfo(CompoundType, StructureFlags), AnonymousSlotCount, &s_info); }
    380386
    381387    private:
     
    387393       
    388394        static const unsigned StructureFlags = OverridesMarkChildren | ScriptExecutable::StructureFlags;
     395        static const ClassInfo s_info;
    389396        unsigned m_numCapturedVariables : 31;
    390397        bool m_forceUsesArguments : 1;
  • trunk/Source/JavaScriptCore/runtime/Heap.cpp

    r82875 r82971  
    319319    if (cell->isPropertyNameIterator())
    320320        return "For-in iterator";
     321    if (const ClassInfo* info = cell->classInfo())
     322        return info->className;
    321323    if (!cell->isObject())
    322324        return "[empty cell]";
    323     const ClassInfo* info = cell->classInfo();
    324     return info ? info->className : "Object";
     325    return "Object";
    325326}
    326327
  • trunk/Source/JavaScriptCore/runtime/JSGlobalData.cpp

    r82849 r82971  
    181181    scopeChainNodeStructure = ScopeChainNode::createStructure(*this, jsNull());
    182182    executableStructure = ExecutableBase::createStructure(*this, jsNull());
     183    nativeExecutableStructure = NativeExecutable::createStructure(*this, jsNull());
    183184    evalExecutableStructure = EvalExecutable::createStructure(*this, jsNull());
    184185    programExecutableStructure = ProgramExecutable::createStructure(*this, jsNull());
  • trunk/Source/JavaScriptCore/runtime/JSGlobalData.h

    r82849 r82971  
    158158        RefPtr<Structure> scopeChainNodeStructure;
    159159        RefPtr<Structure> executableStructure;
     160        RefPtr<Structure> nativeExecutableStructure;
    160161        RefPtr<Structure> evalExecutableStructure;
    161162        RefPtr<Structure> programExecutableStructure;
  • trunk/Source/JavaScriptCore/runtime/ScopeChain.cpp

    r79904 r82971  
    5252#endif
    5353
     54const ClassInfo ScopeChainNode::s_info = { "ScopeChainNode", 0, 0, 0 };
     55
    5456int ScopeChainNode::localDepth()
    5557{
  • trunk/Source/JavaScriptCore/runtime/ScopeChain.h

    r82898 r82971  
    6666#endif
    6767       
    68         static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue proto) { return Structure::create(globalData, proto, TypeInfo(CompoundType, StructureFlags), AnonymousSlotCount, 0); }
     68        static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue proto) { return Structure::create(globalData, proto, TypeInfo(CompoundType, StructureFlags), AnonymousSlotCount, &s_info); }
    6969        virtual void markChildren(MarkStack&);
    7070    private:
    7171        static const unsigned StructureFlags = OverridesMarkChildren;
     72        static const ClassInfo s_info;
    7273    };
    7374
  • trunk/Source/JavaScriptCore/runtime/StructureChain.cpp

    r82849 r82971  
    3232
    3333namespace JSC {
     34   
     35ClassInfo StructureChain::s_info = { "StructureChain", 0, 0, 0 };
    3436
    3537StructureChain::StructureChain(NonNullPassRefPtr<Structure> structure, Structure* head)
  • trunk/Source/JavaScriptCore/runtime/StructureChain.h

    r82898 r82971  
    4747        void markChildren(MarkStack&);
    4848
    49         static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue prototype) { return Structure::create(globalData, prototype, TypeInfo(CompoundType, OverridesMarkChildren), 0, 0); }
     49        static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue prototype) { return Structure::create(globalData, prototype, TypeInfo(CompoundType, OverridesMarkChildren), 0, &s_info); }
    5050
    5151    private:
     
    5353        ~StructureChain();
    5454        OwnArrayPtr<RefPtr<Structure> > m_vector;
     55        static ClassInfo s_info;
    5556    };
    5657
Note: See TracChangeset for help on using the changeset viewer.