Ignore:
Timestamp:
Dec 7, 2007, 2:05:55 PM (17 years ago)
Author:
[email protected]
Message:

JavaScriptCore:

Reviewed by Sam Weinig.

Next step in refactoring JSGlobalObject: Added JSVariableObject class,
and factored symbol-table-related code into it. (JSGlobalObject doesn't
use the symbol table code yet, though.)


Layout and JS tests, and testapi, pass. SunSpider reports no regression.

WebCore:

Reviewed by Sam Weinig.

Added some namespace qualifications and a forwarding header, now that
KJS::Node is sometimes #included in WebCore by JavaScriptCore headers.

  • ForwardingHeaders/wtf/ListRefPtr.h: Added.
  • bindings/js/JSXSLTProcessor.cpp: (KJS::JSXSLTProcessorPrototypeFunctionTransformToFragment::callAsFunction):
  • bindings/js/kjs_binding.cpp: (KJS::ScriptInterpreter::getDOMNodeForDocument): (KJS::ScriptInterpreter::forgetDOMNodeForDocument): (KJS::ScriptInterpreter::putDOMNodeForDocument): (KJS::ScriptInterpreter::markDOMNodesForDocument): (KJS::ScriptInterpreter::updateDOMNodeDocument):

WebKit/mac:

Reviewed by Sam Weinig.


Added a forwarding header, since we now #include nodes.h through some
JavaScriptCore headers.

  • ForwardingHeaders/wtf/ListRefPtr.h: Added.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/JSGlobalObject.h

    r28468 r28527  
    2424#define KJS_GlobalObject_h
    2525
    26 #include "object.h"
     26#include "JSVariableObject.h"
    2727
    2828namespace KJS {
     
    6868    enum CompatMode { NativeMode, IECompat, NetscapeCompat };
    6969
    70     class JSGlobalObject : public JSObject {
     70    class JSGlobalObject : public JSVariableObject {
    7171    protected:
    72         struct JSGlobalObjectData {
     72        using JSVariableObject::JSVariableObjectData;
     73
     74        struct JSGlobalObjectData : public JSVariableObjectData {
    7375            JSGlobalObjectData(JSGlobalObject* globalObject)
    74                 : globalExec(globalObject, globalObject, 0)
     76                : JSVariableObjectData(&inlineSymbolTable)
     77                , globalExec(globalObject, globalObject, 0)
    7578            {
    7679            }
     
    8184            Debugger* debugger;
    8285            CompatMode compatMode;
    83 
     86           
    8487            ExecState globalExec;
    8588            ExecState* currentExec;
     
    124127            NativeErrorPrototype* typeErrorPrototype;
    125128            NativeErrorPrototype* URIErrorPrototype;
     129
     130            SymbolTable inlineSymbolTable;
    126131        };
    127132
    128133    public:
    129134        JSGlobalObject()
     135            : JSVariableObject(new JSGlobalObjectData(this))
    130136        {
    131137            init();
     
    134140    protected:
    135141        JSGlobalObject(JSValue* proto)
    136             : JSObject(proto)
     142            : JSVariableObject(proto, new JSGlobalObjectData(this))
    137143        {
    138144            init();
     
    144150        // Linked list of all global objects.
    145151        static JSGlobalObject* head() { return s_head; }
    146         JSGlobalObject* next() { return d->next; }
     152        JSGlobalObject* next() { return d()->next; }
    147153
    148154        // Resets the global object to contain only built-in properties, sets
     
    155161        // replaces the global object's associated property.
    156162
    157         ObjectObjectImp* objectConstructor() const { return d->objectConstructor; }
    158         FunctionObjectImp* functionConstructor() const { return d->functionConstructor; }
    159         ArrayObjectImp* arrayConstructor() const { return d->arrayConstructor; }
    160         BooleanObjectImp* booleanConstructor() const { return d->booleanConstructor; }
    161         StringObjectImp* stringConstructor() const{ return d->stringConstructor; }
    162         NumberObjectImp* numberConstructor() const{ return d->numberConstructor; }
    163         DateObjectImp* dateConstructor() const{ return d->dateConstructor; }
    164         RegExpObjectImp* regExpConstructor() const { return d->regExpConstructor; }
    165         ErrorObjectImp* errorConstructor() const { return d->errorConstructor; }
    166         NativeErrorImp* evalErrorConstructor() const { return d->evalErrorConstructor; }
    167         NativeErrorImp* rangeErrorConstructor() const { return d->rangeErrorConstructor; }
    168         NativeErrorImp* referenceErrorConstructor() const { return d->referenceErrorConstructor; }
    169         NativeErrorImp* syntaxErrorConstructor() const { return d->syntaxErrorConstructor; }
    170         NativeErrorImp* typeErrorConstructor() const { return d->typeErrorConstructor; }
    171         NativeErrorImp* URIErrorConstructor() const { return d->URIErrorConstructor; }
    172 
    173         ObjectPrototype* objectPrototype() const { return d->objectPrototype; }
    174         FunctionPrototype* functionPrototype() const { return d->functionPrototype; }
    175         ArrayPrototype* arrayPrototype() const { return d->arrayPrototype; }
    176         BooleanPrototype* booleanPrototype() const { return d->booleanPrototype; }
    177         StringPrototype* stringPrototype() const { return d->stringPrototype; }
    178         NumberPrototype* numberPrototype() const { return d->numberPrototype; }
    179         DatePrototype* datePrototype() const { return d->datePrototype; }
    180         RegExpPrototype* regExpPrototype() const { return d->regExpPrototype; }
    181         ErrorPrototype* errorPrototype() const { return d->errorPrototype; }
    182         NativeErrorPrototype* evalErrorPrototype() const { return d->evalErrorPrototype; }
    183         NativeErrorPrototype* rangeErrorPrototype() const { return d->rangeErrorPrototype; }
    184         NativeErrorPrototype* referenceErrorPrototype() const { return d->referenceErrorPrototype; }
    185         NativeErrorPrototype* syntaxErrorPrototype() const { return d->syntaxErrorPrototype; }
    186         NativeErrorPrototype* typeErrorPrototype() const { return d->typeErrorPrototype; }
    187         NativeErrorPrototype* URIErrorPrototype() const { return d->URIErrorPrototype; }
     163        ObjectObjectImp* objectConstructor() const { return d()->objectConstructor; }
     164        FunctionObjectImp* functionConstructor() const { return d()->functionConstructor; }
     165        ArrayObjectImp* arrayConstructor() const { return d()->arrayConstructor; }
     166        BooleanObjectImp* booleanConstructor() const { return d()->booleanConstructor; }
     167        StringObjectImp* stringConstructor() const{ return d()->stringConstructor; }
     168        NumberObjectImp* numberConstructor() const{ return d()->numberConstructor; }
     169        DateObjectImp* dateConstructor() const{ return d()->dateConstructor; }
     170        RegExpObjectImp* regExpConstructor() const { return d()->regExpConstructor; }
     171        ErrorObjectImp* errorConstructor() const { return d()->errorConstructor; }
     172        NativeErrorImp* evalErrorConstructor() const { return d()->evalErrorConstructor; }
     173        NativeErrorImp* rangeErrorConstructor() const { return d()->rangeErrorConstructor; }
     174        NativeErrorImp* referenceErrorConstructor() const { return d()->referenceErrorConstructor; }
     175        NativeErrorImp* syntaxErrorConstructor() const { return d()->syntaxErrorConstructor; }
     176        NativeErrorImp* typeErrorConstructor() const { return d()->typeErrorConstructor; }
     177        NativeErrorImp* URIErrorConstructor() const { return d()->URIErrorConstructor; }
     178
     179        ObjectPrototype* objectPrototype() const { return d()->objectPrototype; }
     180        FunctionPrototype* functionPrototype() const { return d()->functionPrototype; }
     181        ArrayPrototype* arrayPrototype() const { return d()->arrayPrototype; }
     182        BooleanPrototype* booleanPrototype() const { return d()->booleanPrototype; }
     183        StringPrototype* stringPrototype() const { return d()->stringPrototype; }
     184        NumberPrototype* numberPrototype() const { return d()->numberPrototype; }
     185        DatePrototype* datePrototype() const { return d()->datePrototype; }
     186        RegExpPrototype* regExpPrototype() const { return d()->regExpPrototype; }
     187        ErrorPrototype* errorPrototype() const { return d()->errorPrototype; }
     188        NativeErrorPrototype* evalErrorPrototype() const { return d()->evalErrorPrototype; }
     189        NativeErrorPrototype* rangeErrorPrototype() const { return d()->rangeErrorPrototype; }
     190        NativeErrorPrototype* referenceErrorPrototype() const { return d()->referenceErrorPrototype; }
     191        NativeErrorPrototype* syntaxErrorPrototype() const { return d()->syntaxErrorPrototype; }
     192        NativeErrorPrototype* typeErrorPrototype() const { return d()->typeErrorPrototype; }
     193        NativeErrorPrototype* URIErrorPrototype() const { return d()->URIErrorPrototype; }
    188194
    189195        void saveBuiltins(SavedBuiltins&) const;
    190196        void restoreBuiltins(const SavedBuiltins&);
    191197
    192         void setTimeoutTime(unsigned timeoutTime) { d->timeoutTime = timeoutTime; }
     198        void setTimeoutTime(unsigned timeoutTime) { d()->timeoutTime = timeoutTime; }
    193199        void startTimeoutCheck();
    194200        void stopTimeoutCheck();
    195201        bool timedOut();
    196202
    197         Debugger* debugger() const { return d->debugger; }
    198         void setDebugger(Debugger* debugger) { d->debugger = debugger; }
    199 
    200         void setCurrentExec(ExecState* exec) { d->currentExec = exec; }
    201         ExecState* currentExec() const { return d->currentExec; }
     203        Debugger* debugger() const { return d()->debugger; }
     204        void setDebugger(Debugger* debugger) { d()->debugger = debugger; }
     205
     206        void setCurrentExec(ExecState* exec) { d()->currentExec = exec; }
     207        ExecState* currentExec() const { return d()->currentExec; }
    202208
    203209        // FIXME: Let's just pick one compatible behavior and go with it.
    204         void setCompatMode(CompatMode mode) { d->compatMode = mode; }
    205         CompatMode compatMode() const { return d->compatMode; }
     210        void setCompatMode(CompatMode mode) { d()->compatMode = mode; }
     211        CompatMode compatMode() const { return d()->compatMode; }
    206212       
    207         int recursion() { return d->recursion; }
    208         void incRecursion() { ++d->recursion; }
    209         void decRecursion() { --d->recursion; }
     213        int recursion() { return d()->recursion; }
     214        void incRecursion() { ++d()->recursion; }
     215        void decRecursion() { --d()->recursion; }
    210216
    211217        virtual void mark();
     
    218224
    219225        virtual bool isSafeScript(const JSGlobalObject*) const { return true; }
    220 
    221     protected:
    222         std::auto_ptr<JSGlobalObjectData> d;
    223226
    224227    private:
    225228        void init();
     229       
     230        JSGlobalObjectData* d() const { return static_cast<JSGlobalObjectData*>(JSVariableObject::d); }
    226231
    227232        bool checkTimeout();
     
    233238    inline bool JSGlobalObject::timedOut()
    234239    {
    235         d->tickCount++;
    236 
    237         if (d->tickCount != d->ticksUntilNextTimeoutCheck)
     240        d()->tickCount++;
     241
     242        if (d()->tickCount != d()->ticksUntilNextTimeoutCheck)
    238243            return false;
    239244
Note: See TracChangeset for help on using the changeset viewer.