Ignore:
Timestamp:
Apr 28, 2008, 11:22:14 AM (17 years ago)
Author:
[email protected]
Message:

Reviewed by Darin.

Fix run-webkit-tests --threading
and provisionally fix <https://bugs.webkit.org/show_bug.cgi?id=18661>
Proxy server issue in Sunday's Nightly

Changed ClassInfo objects for built-in objects to hold a getter function returning
a per-thread instance. This makes it safe to share these ClassInfo objects between threads -
and these are the only ones that need to be shared.

File:
1 edited

Legend:

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

    r32587 r32652  
    4343    class FunctionObjectImp;
    4444    class FunctionPrototype;
     45    struct HashTable;
    4546    class JSGlobalObject;
    4647    class NativeErrorImp;
     
    6869    class UriErrorPrototype;
    6970    struct ActivationStackNode;
     71    struct ThreadClassInfoHashTables;
    7072
    7173    typedef Vector<ExecState*, 16> ExecStateStack;
     
    7678
    7779        struct JSGlobalObjectData : public JSVariableObjectData {
    78             JSGlobalObjectData(JSGlobalObject* globalObject, JSObject* thisValue)
     80            JSGlobalObjectData()
    7981                : JSVariableObjectData(&inlineSymbolTable)
    80                 , globalExec(globalObject, thisValue)
    8182            {
    8283            }
     
    8788            Debugger* debugger;
    8889           
    89             GlobalExecState globalExec;
     90            OwnPtr<GlobalExecState> globalExec;
    9091            int recursion;
    9192
     
    141142
    142143            OwnPtr<HashSet<JSObject*> > arrayVisitedElements; // Global data shared by array prototype functions.
     144
     145            PerThreadData perThreadData;
    143146        };
    144147
    145148    public:
    146149        JSGlobalObject()
    147             : JSVariableObject(new JSGlobalObjectData(this, this))
     150            : JSVariableObject(new JSGlobalObjectData)
    148151        {
    149             init();
     152            init(this);
    150153        }
    151154
    152155    protected:
    153156        JSGlobalObject(JSValue* proto, JSObject* globalThisValue)
    154             : JSVariableObject(proto, new JSGlobalObjectData(this, globalThisValue))
     157            : JSVariableObject(proto, new JSGlobalObjectData)
    155158        {
    156             init();
     159            init(globalThisValue);
    157160        }
    158161
     
    247250        HashSet<JSObject*>& arrayVisitedElements() { if (!d()->arrayVisitedElements) d()->arrayVisitedElements.set(new HashSet<JSObject*>); return *d()->arrayVisitedElements; }
    248251
     252        // Per-thread hash tables, cached on the global object for faster access.
     253        const PerThreadData* perThreadData() const { return &d()->perThreadData; }
     254
     255        // Initialize and/or retrieve per-thread hash tables - use perThreadData() for faster access instead.
     256        static ThreadClassInfoHashTables* threadClassInfoHashTables();
     257
    249258    private:
    250         void init();
     259        void init(JSObject* thisValue);
    251260       
    252261        JSGlobalObjectData* d() const { return static_cast<JSGlobalObjectData*>(JSVariableObject::d); }
Note: See TracChangeset for help on using the changeset viewer.