Reviewed by Darin.
authorap@webkit.org <ap@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 28 Apr 2008 18:22:14 +0000 (18:22 +0000)
committerap@webkit.org <ap@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 28 Apr 2008 18:22:14 +0000 (18:22 +0000)
        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.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@32652 268f45cc-cd09-0410-ab3c-d52691b4dbfc

64 files changed:
JavaScriptCore/API/JSCallbackConstructor.cpp
JavaScriptCore/API/JSCallbackFunction.cpp
JavaScriptCore/API/JSCallbackObject.cpp
JavaScriptCore/ChangeLog
JavaScriptCore/JavaScriptCore.exp
JavaScriptCore/kjs/ExecState.cpp
JavaScriptCore/kjs/ExecState.h
JavaScriptCore/kjs/ExecStateInlines.h
JavaScriptCore/kjs/InitializeThreading.cpp
JavaScriptCore/kjs/JSGlobalObject.cpp
JavaScriptCore/kjs/JSGlobalObject.h
JavaScriptCore/kjs/JSVariableObject.cpp
JavaScriptCore/kjs/JSVariableObject.h
JavaScriptCore/kjs/array_instance.cpp
JavaScriptCore/kjs/array_object.cpp
JavaScriptCore/kjs/bool_object.cpp
JavaScriptCore/kjs/create_hash_table
JavaScriptCore/kjs/date_object.cpp
JavaScriptCore/kjs/error_object.cpp
JavaScriptCore/kjs/function.cpp
JavaScriptCore/kjs/function_object.cpp
JavaScriptCore/kjs/internal.cpp
JavaScriptCore/kjs/lexer.cpp
JavaScriptCore/kjs/lexer.h
JavaScriptCore/kjs/lookup.h
JavaScriptCore/kjs/math_object.cpp
JavaScriptCore/kjs/number_object.cpp
JavaScriptCore/kjs/object.cpp
JavaScriptCore/kjs/object.h
JavaScriptCore/kjs/object_object.cpp
JavaScriptCore/kjs/regexp_object.cpp
JavaScriptCore/kjs/string_object.cpp
JavaScriptGlue/ChangeLog
JavaScriptGlue/UserObjectImp.cpp
WebCore/ChangeLog
WebCore/bindings/js/JSAudioConstructor.cpp
WebCore/bindings/js/JSDOMWindowBase.cpp
WebCore/bindings/js/JSDOMWindowCustom.cpp
WebCore/bindings/js/JSDOMWindowWrapper.cpp
WebCore/bindings/js/JSDOMWindowWrapper.h
WebCore/bindings/js/JSEventTargetBase.h
WebCore/bindings/js/JSHTMLInputElementBase.cpp
WebCore/bindings/js/JSHTMLOptionElementConstructor.cpp
WebCore/bindings/js/JSHistoryCustom.cpp
WebCore/bindings/js/JSImageConstructor.cpp
WebCore/bindings/js/JSInspectedObjectWrapper.cpp
WebCore/bindings/js/JSInspectorCallbackWrapper.cpp
WebCore/bindings/js/JSLocationCustom.cpp
WebCore/bindings/js/JSNamedNodesCollection.cpp
WebCore/bindings/js/JSQuarantinedObjectWrapper.cpp
WebCore/bindings/js/JSRGBColor.cpp
WebCore/bindings/js/JSStorageCustom.cpp
WebCore/bindings/js/JSXMLHttpRequestConstructor.cpp
WebCore/bindings/js/JSXSLTProcessor.cpp
WebCore/bindings/scripts/CodeGeneratorJS.pm
WebCore/bridge/objc/objc_runtime.mm
WebCore/bridge/runtime_array.cpp
WebCore/bridge/runtime_object.cpp
WebKit/mac/ChangeLog
WebKit/mac/WebView/WebView.mm
WebKit/win/ChangeLog
WebKit/win/WebView.cpp
WebKitTools/ChangeLog
WebKitTools/DumpRenderTree/pthreads/JavaScriptThreadingPthreads.cpp

index 46c1823..99585c1 100644 (file)
@@ -34,7 +34,7 @@
 
 namespace KJS {
 
-const ClassInfo JSCallbackConstructor::info = { "CallbackConstructor", 0, 0};
+const ClassInfo JSCallbackConstructor::info = { "CallbackConstructor", 0, 0, 0 };
 
 JSCallbackConstructor::JSCallbackConstructor(ExecState* exec, JSClassRef jsClass, JSObjectCallAsConstructorCallback callback)
     : JSObject(exec->lexicalGlobalObject()->objectPrototype())
index fb3937d..947e649 100644 (file)
@@ -36,7 +36,7 @@
 
 namespace KJS {
 
-const ClassInfo JSCallbackFunction::info = { "CallbackFunction", &InternalFunctionImp::info, 0};
+const ClassInfo JSCallbackFunction::info = { "CallbackFunction", &InternalFunctionImp::info, 0, 0 };
 
 JSCallbackFunction::JSCallbackFunction(ExecState* exec, JSObjectCallAsFunctionCallback callback, const Identifier& name)
     : InternalFunctionImp(exec->lexicalGlobalObject()->functionPrototype(), name)
index 129b304..a462535 100644 (file)
@@ -33,8 +33,8 @@
 namespace KJS {
 
 // Define the two types of JSCallbackObjects we support.
-template <> const ClassInfo JSCallbackObject<JSObject>::info = { "CallbackObject", 0, 0 };
-template <> const ClassInfo JSCallbackObject<JSGlobalObject>::info = { "CallbackGlobalObject", 0, 0 };
+template <> const ClassInfo JSCallbackObject<JSObject>::info = { "CallbackObject", 0, 0, 0 };
+template <> const ClassInfo JSCallbackObject<JSGlobalObject>::info = { "CallbackGlobalObject", 0, 0, 0 };
 
 COMPILE_ASSERT(sizeof(JSCallbackObject<JSGlobalObject>) <= CELL_SIZE, global_callback_object_fits_in_cell);
 
index fd51916..c8e0f5d 100644 (file)
@@ -1,3 +1,122 @@
+2008-04-28  Alexey Proskuryakov  <ap@webkit.org>
+
+        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.
+
+        * kjs/lexer.cpp:
+        (KJS::Lexer::Lexer):
+        (KJS::Lexer::~Lexer):
+        * kjs/lexer.h:
+        Made mainTable a member of Lexer, so that it no longer needs to be shared between threads.
+
+        * kjs/object.cpp:
+        (KJS::JSObject::deleteProperty):
+        (KJS::JSObject::findPropertyHashEntry):
+        (KJS::JSObject::propertyIsEnumerable):
+        (KJS::JSObject::getPropertyAttributes):
+        (KJS::JSObject::getPropertyNames):
+        * kjs/object.h:
+        (KJS::ClassInfo::propHashTable):
+        Added a new classPropHashTableGetterFunction field to ClassInfo. If it is non-zero, the
+        static table is not used.
+
+        * kjs/JSGlobalObject.cpp:
+        (KJS::ThreadClassInfoHashTables::ThreadClassInfoHashTables): This new class holds per-thread
+        HashTables for built-in classes. The old static structs are copied to create per-thread
+        instances.
+        (KJS::JSGlobalObject::threadClassInfoHashTables): An accessor/initializer for the above.
+        (KJS::JSGlobalObject::init): Copy per-thread data into a single structure for faster access.
+        Also, construct globalExec.
+        (KJS::JSGlobalObject::reset): Adapted for globalExec now being an OwnPtr.
+        (KJS::JSGlobalObject::mark): Ditto.
+        (KJS::JSGlobalObject::globalExec): Ditto.
+        * kjs/JSGlobalObject.h:
+        (KJS::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData): Made JSGlobalObject::JSGlobalObjectData::globalExec an OwnPtr, so that it can
+        be initialized from JSGlobalObject::init() after them. Otherwise, ExecState constructor was
+        trying to access half-initialized JSGlobalObject to make its own copy of these table
+        references, and failed.
+        (KJS::JSGlobalObject::JSGlobalObject): Pass "this" value to init() to create globalExec.
+        (KJS::JSGlobalObject::perThreadData): An accessor for per-thread data.
+
+        * kjs/ExecState.cpp:
+        (KJS::ExecState::ExecState):
+        * kjs/ExecState.h:
+        (KJS::ExecState::propertyNames):
+        (KJS::ExecState::emptyList):
+        (KJS::ExecState::arrayTable):
+        (KJS::ExecState::dateTable):
+        (KJS::ExecState::mathTable):
+        (KJS::ExecState::numberTable):
+        (KJS::ExecState::RegExpImpTable):
+        (KJS::ExecState::RegExpObjectImpTable):
+        (KJS::ExecState::stringTable):
+        * kjs/ExecStateInlines.h:
+        (KJS::ExecState::ExecState):
+        Each ExecState holds its own reference to per-thread data, for even faster access. Moved
+        m_emptyList and m_propertyNames to the same structure, making ExecState faster to construct
+        and take less space on the stack.
+
+        * kjs/InitializeThreading.cpp: (KJS::initializeThreading): Initialize thread-static data
+        added to JSGlobalObject.
+
+        * API/JSCallbackConstructor.cpp:
+        (KJS::):
+        * API/JSCallbackFunction.cpp:
+        (KJS::):
+        * API/JSCallbackObject.cpp:
+        (KJS::):
+        * JavaScriptCore.exp:
+        * kjs/JSVariableObject.cpp:
+        (KJS::JSVariableObject::getPropertyAttributes):
+        * kjs/JSVariableObject.h:
+        * kjs/array_instance.cpp:
+        (KJS::):
+        * kjs/array_object.cpp:
+        (KJS::):
+        (KJS::ArrayPrototype::getOwnPropertySlot):
+        * kjs/bool_object.cpp:
+        (KJS::):
+        * kjs/create_hash_table:
+        * kjs/date_object.cpp:
+        (KJS::):
+        (KJS::DatePrototype::getOwnPropertySlot):
+        (KJS::DateObjectImp::DateObjectImp):
+        * kjs/error_object.cpp:
+        (KJS::):
+        * kjs/function.cpp:
+        (KJS::):
+        * kjs/function_object.cpp:
+        (KJS::FunctionPrototype::FunctionPrototype):
+        * kjs/internal.cpp:
+        (KJS::):
+        * kjs/lookup.h:
+        * kjs/math_object.cpp:
+        (KJS::):
+        (KJS::MathObjectImp::getOwnPropertySlot):
+        * kjs/number_object.cpp:
+        (KJS::):
+        (KJS::NumberObjectImp::getOwnPropertySlot):
+        * kjs/object_object.cpp:
+        (KJS::ObjectPrototype::ObjectPrototype):
+        * kjs/regexp_object.cpp:
+        (KJS::):
+        (KJS::RegExpPrototype::RegExpPrototype):
+        (KJS::RegExpImp::getOwnPropertySlot):
+        (KJS::RegExpImp::put):
+        (KJS::RegExpObjectImp::getOwnPropertySlot):
+        (KJS::RegExpObjectImp::put):
+        * kjs/string_object.cpp:
+        (KJS::):
+        (KJS::StringPrototype::getOwnPropertySlot):
+        Adjust for the above changes.
+
 2008-04-28  Darin Adler  <darin@apple.com>
 
         Reviewed by Adam.
index 25b6bcf..9c131b0 100644 (file)
@@ -107,7 +107,7 @@ __ZN3KJS14JSGlobalObject17putWithAttributesEPNS_9ExecStateERKNS_10IdentifierEPNS
 __ZN3KJS14JSGlobalObject17startTimeoutCheckEv
 __ZN3KJS14JSGlobalObject18getOwnPropertySlotEPNS_9ExecStateERKNS_10IdentifierERNS_12PropertySlotE
 __ZN3KJS14JSGlobalObject3putEPNS_9ExecStateERKNS_10IdentifierEPNS_7JSValueE
-__ZN3KJS14JSGlobalObject4initEv
+__ZN3KJS14JSGlobalObject4initEPNS_8JSObjectE
 __ZN3KJS14JSGlobalObject4markEv
 __ZN3KJS14JSGlobalObject5resetEPNS_7JSValueE
 __ZN3KJS14JSGlobalObjectD2Ev
@@ -120,6 +120,7 @@ __ZN3KJS14StringInstance4infoE
 __ZN3KJS14StringInstanceC1EPNS_8JSObjectERKNS_7UStringE
 __ZN3KJS14StringInstanceC2EPNS_8JSObjectERKNS_7UStringE
 __ZN3KJS15GlobalExecStateC1EPNS_14JSGlobalObjectEPNS_8JSObjectE
+__ZN3KJS15GlobalExecStateD1Ev
 __ZN3KJS15JSWrapperObject4markEv
 __ZN3KJS16JSVariableObject14deletePropertyEPNS_9ExecStateERKNS_10IdentifierE
 __ZN3KJS16JSVariableObject16getPropertyNamesEPNS_9ExecStateERNS_17PropertyNameArrayE
@@ -237,7 +238,7 @@ __ZNK3KJS13ArrayInstance7getItemEj
 __ZNK3KJS14JSGlobalObject14isDynamicScopeEv
 __ZNK3KJS14JSGlobalObject14toGlobalObjectEPNS_9ExecStateE
 __ZNK3KJS16JSVariableObject16isVariableObjectEv
-__ZNK3KJS16JSVariableObject21getPropertyAttributesERKNS_10IdentifierERj
+__ZNK3KJS16JSVariableObject21getPropertyAttributesEPNS_9ExecStateERKNS_10IdentifierERj
 __ZNK3KJS19InternalFunctionImp14implementsCallEv
 __ZNK3KJS19InternalFunctionImp21implementsHasInstanceEv
 __ZNK3KJS4List8getSliceEiRS0_
@@ -266,7 +267,7 @@ __ZNK3KJS8JSObject12toThisObjectEPNS_9ExecStateE
 __ZNK3KJS8JSObject14implementsCallEv
 __ZNK3KJS8JSObject14toGlobalObjectEPNS_9ExecStateE
 __ZNK3KJS8JSObject19implementsConstructEv
-__ZNK3KJS8JSObject21getPropertyAttributesERKNS_10IdentifierERj
+__ZNK3KJS8JSObject21getPropertyAttributesEPNS_9ExecStateERKNS_10IdentifierERj
 __ZNK3KJS8JSObject21implementsHasInstanceEv
 __ZNK3KJS8JSObject3getEPNS_9ExecStateERKNS_10IdentifierE
 __ZNK3KJS8JSObject3getEPNS_9ExecStateEj
index 8540118..edab7fc 100644 (file)
 
 namespace KJS {
 
-static inline List* globalEmptyList()
-{
-    static List staticEmptyList;
-    return &staticEmptyList;
-}
-
 // ECMA 10.2
 
 // The constructor for the globalExec pseudo-ExecState
 inline ExecState::ExecState(JSGlobalObject* globalObject, JSObject* thisObject)
     : m_globalObject(globalObject)
     , m_exception(0)
-    , m_propertyNames(CommonIdentifiers::shared())
-    , m_emptyList(globalEmptyList())
     , m_callingExec(0)
+    , m_perThreadData(globalObject->perThreadData())
     , m_scopeNode(0)
     , m_function(0)
     , m_arguments(0)
@@ -67,9 +60,8 @@ inline ExecState::ExecState(JSGlobalObject* globalObject, JSObject* thisObject)
 inline ExecState::ExecState(JSGlobalObject* globalObject, JSObject* thisObject, ProgramNode* programNode)
     : m_globalObject(globalObject)
     , m_exception(0)
-    , m_propertyNames(CommonIdentifiers::shared())
-    , m_emptyList(globalEmptyList())
     , m_callingExec(0)
+    , m_perThreadData(globalObject->perThreadData())
     , m_scopeNode(programNode)
     , m_function(0)
     , m_arguments(0)
@@ -90,9 +82,8 @@ inline ExecState::ExecState(JSGlobalObject* globalObject, JSObject* thisObject,
 inline ExecState::ExecState(JSGlobalObject* globalObject, JSObject* thisObject, EvalNode* evalNode, ExecState* callingExec, const ScopeChain& scopeChain, JSVariableObject* variableObject)
     : m_globalObject(globalObject)
     , m_exception(0)
-    , m_propertyNames(callingExec->m_propertyNames)
-    , m_emptyList(callingExec->m_emptyList)
     , m_callingExec(callingExec)
+    , m_perThreadData(callingExec->m_perThreadData)
     , m_scopeNode(evalNode)
     , m_function(0)
     , m_arguments(0)
index 9ad480d..bfc0541 100644 (file)
@@ -38,6 +38,7 @@ namespace KJS  {
     class FunctionBodyNode;
     class FunctionImp;
     class GlobalFuncImp;
+    struct HashTable;
     class Interpreter;
     class JSGlobalObject;
     class JSVariableObject;
@@ -46,6 +47,19 @@ namespace KJS  {
     
     enum CodeType { GlobalCode, EvalCode, FunctionCode };
 
+    struct PerThreadData {
+        const HashTable* arrayTable;
+        const HashTable* dateTable;
+        const HashTable* mathTable;
+        const HashTable* numberTable;
+        const HashTable* RegExpImpTable;
+        const HashTable* RegExpObjectImpTable;
+        const HashTable* stringTable;
+
+        CommonIdentifiers* propertyNames;
+        const List emptyList;
+    };
+
     // Represents the current state of script execution.
     // Passed as the first argument to most functions.
     class ExecState : Noncopyable {
@@ -96,8 +110,15 @@ namespace KJS  {
 
         // These pointers are used to avoid accessing global variables for these,
         // to avoid taking PIC branches in Mach-O binaries.
-        const CommonIdentifiers& propertyNames() const { return *m_propertyNames; }
-        const List& emptyList() const { return *m_emptyList; }
+        const CommonIdentifiers& propertyNames() const { return *m_perThreadData->propertyNames; }
+        const List& emptyList() const { return m_perThreadData->emptyList; }
+        static const HashTable* arrayTable(ExecState* exec) { return exec->m_perThreadData->arrayTable; }
+        static const HashTable* dateTable(ExecState* exec) { return exec->m_perThreadData->dateTable; }
+        static const HashTable* mathTable(ExecState* exec) { return exec->m_perThreadData->mathTable; }
+        static const HashTable* numberTable(ExecState* exec) { return exec->m_perThreadData->numberTable; }
+        static const HashTable* RegExpImpTable(ExecState* exec) { return exec->m_perThreadData->RegExpImpTable; }
+        static const HashTable* RegExpObjectImpTable(ExecState* exec) { return exec->m_perThreadData->RegExpObjectImpTable; }
+        static const HashTable* stringTable(ExecState* exec) { return exec->m_perThreadData->stringTable; }
 
         LocalStorage& localStorage() { return *m_localStorage; }
         void setLocalStorage(LocalStorage* s) { m_localStorage = s; }
@@ -176,11 +197,11 @@ namespace KJS  {
 
         JSGlobalObject* m_globalObject;
         JSValue* m_exception;
-        CommonIdentifiers* m_propertyNames;
-        const List* m_emptyList;
 
         ExecState* m_callingExec;
 
+        const PerThreadData* m_perThreadData;
+
         ScopeNode* m_scopeNode;
         
         FunctionImp* m_function;
index 6f0f38c..c0d29e5 100644 (file)
@@ -35,9 +35,8 @@ namespace KJS  {
                                 FunctionImp* func, const List& args)
         : m_globalObject(globalObject)
         , m_exception(0)
-        , m_propertyNames(callingExec->m_propertyNames)
-        , m_emptyList(callingExec->m_emptyList)
         , m_callingExec(callingExec)
+        , m_perThreadData(callingExec->m_perThreadData)
         , m_scopeNode(functionBodyNode)
         , m_function(func)
         , m_arguments(&args)
index f9c2c6a..b07ec45 100644 (file)
@@ -33,6 +33,7 @@
 #include "DateMath.h"
 #include "dtoa.h"
 #include "identifier.h"
+#include "JSGlobalObject.h"
 #include "lexer.h"
 #include "Parser.h"
 #include "ustring.h"
@@ -54,6 +55,7 @@ void initializeThreading()
         CommonIdentifiers::shared();
         lexer();
         initDateMath();
+        JSGlobalObject::threadClassInfoHashTables();
     }
 #endif
 }
index e28e30f..328c20d 100644 (file)
 #include "scope_chain_mark.h"
 #include "string_object.h"
 
+#if USE(MULTIPLE_THREADS)
+#include <wtf/ThreadSpecific.h>
+using namespace WTF;
+#endif
+
 #if HAVE(SYS_TIME_H)
 #include <sys/time.h>
 #endif
 
 namespace KJS {
 
+extern HashTable arrayTable;
+extern HashTable dateTable;
+extern HashTable mathTable;
+extern HashTable numberTable;
+extern HashTable RegExpImpTable;
+extern HashTable RegExpObjectImpTable;
+extern HashTable stringTable;
+
 // Default number of ticks before a timeout check should be done.
 static const int initialTickCountThreshold = 255;
 
@@ -118,7 +131,62 @@ JSGlobalObject::~JSGlobalObject()
     delete d();
 }
 
-void JSGlobalObject::init()
+struct ThreadClassInfoHashTables {
+    ThreadClassInfoHashTables()
+        : arrayTable(KJS::arrayTable)
+        , dateTable(KJS::dateTable)
+        , mathTable(KJS::mathTable)
+        , numberTable(KJS::numberTable)
+        , RegExpImpTable(KJS::RegExpImpTable)
+        , RegExpObjectImpTable(KJS::RegExpObjectImpTable)
+        , stringTable(KJS::stringTable)
+    {
+    }
+
+    ~ThreadClassInfoHashTables()
+    {
+#if USE(MULTIPLE_THREADS)
+        delete[] arrayTable.table;
+        delete[] dateTable.table;
+        delete[] mathTable.table;
+        delete[] numberTable.table;
+        delete[] RegExpImpTable.table;
+        delete[] RegExpObjectImpTable.table;
+        delete[] stringTable.table;
+#endif
+    }
+
+#if USE(MULTIPLE_THREADS)
+    HashTable arrayTable;
+    HashTable dateTable;
+    HashTable mathTable;
+    HashTable numberTable;
+    HashTable RegExpImpTable;
+    HashTable RegExpObjectImpTable;
+    HashTable stringTable;
+#else
+    HashTable& arrayTable;
+    HashTable& dateTable;
+    HashTable& mathTable;
+    HashTable& numberTable;
+    HashTable& RegExpImpTable;
+    HashTable& RegExpObjectImpTable;
+    HashTable& stringTable;
+#endif
+};
+
+ThreadClassInfoHashTables* JSGlobalObject::threadClassInfoHashTables()
+{
+#if USE(MULTIPLE_THREADS)
+    static ThreadSpecific<ThreadClassInfoHashTables> sharedInstance;
+    return sharedInstance;
+#else
+    static ThreadClassInfoHashTables sharedInstance;
+    return &sharedInstance;
+#endif
+}
+
+void JSGlobalObject::init(JSObject* thisValue)
 {
     ASSERT(JSLock::currentThreadIsHoldingLock());
 
@@ -142,6 +210,17 @@ void JSGlobalObject::init()
     d()->activations = newStackNode;
     d()->activationCount = 0;
 
+    d()->perThreadData.arrayTable = &threadClassInfoHashTables()->arrayTable;
+    d()->perThreadData.dateTable = &threadClassInfoHashTables()->dateTable;
+    d()->perThreadData.mathTable = &threadClassInfoHashTables()->mathTable;
+    d()->perThreadData.numberTable = &threadClassInfoHashTables()->numberTable;
+    d()->perThreadData.RegExpImpTable = &threadClassInfoHashTables()->RegExpImpTable;
+    d()->perThreadData.RegExpObjectImpTable = &threadClassInfoHashTables()->RegExpObjectImpTable;
+    d()->perThreadData.stringTable = &threadClassInfoHashTables()->stringTable;
+    d()->perThreadData.propertyNames = CommonIdentifiers::shared();
+
+    d()->globalExec.set(new GlobalExecState(this, thisValue));
+
     d()->pageGroupIdentifier = 0;
 
     reset(prototype());
@@ -231,7 +310,7 @@ void JSGlobalObject::reset(JSValue* prototype)
 
     d()->evalFunction = 0;
 
-    ExecState* exec = &d()->globalExec;
+    ExecState* exec = d()->globalExec.get();
 
     // Prototypes
     d()->functionPrototype = new FunctionPrototype(exec);
@@ -418,7 +497,7 @@ void JSGlobalObject::mark()
     for (ExecStateStack::const_iterator it = d()->activeExecStates.begin(); it != end; ++it)
         (*it)->m_scopeChain.mark();
 
-    markIfNeeded(d()->globalExec.exception());
+    markIfNeeded(d()->globalExec->exception());
 
     markIfNeeded(d()->objectConstructor);
     markIfNeeded(d()->functionConstructor);
@@ -462,7 +541,7 @@ JSGlobalObject* JSGlobalObject::toGlobalObject(ExecState*) const
 
 ExecState* JSGlobalObject::globalExec()
 {
-    return &d()->globalExec;
+    return d()->globalExec.get();
 }
 
 void JSGlobalObject::tearOffActivation(ExecState* exec, bool leaveRelic)
@@ -492,4 +571,5 @@ bool JSGlobalObject::isDynamicScope() const
     return true;
 }
 
+
 } // namespace KJS
index ceb122f..dbfe3f9 100644 (file)
@@ -42,6 +42,7 @@ namespace KJS {
     class EvalErrorPrototype;
     class FunctionObjectImp;
     class FunctionPrototype;
+    struct HashTable;
     class JSGlobalObject;
     class NativeErrorImp;
     class NativeErrorPrototype;
@@ -67,6 +68,7 @@ namespace KJS {
     class UriError;
     class UriErrorPrototype;
     struct ActivationStackNode;
+    struct ThreadClassInfoHashTables;
 
     typedef Vector<ExecState*, 16> ExecStateStack;
 
@@ -75,9 +77,8 @@ namespace KJS {
         using JSVariableObject::JSVariableObjectData;
 
         struct JSGlobalObjectData : public JSVariableObjectData {
-            JSGlobalObjectData(JSGlobalObject* globalObject, JSObject* thisValue)
+            JSGlobalObjectData()
                 : JSVariableObjectData(&inlineSymbolTable)
-                , globalExec(globalObject, thisValue)
             {
             }
 
@@ -86,7 +87,7 @@ namespace KJS {
 
             Debugger* debugger;
             
-            GlobalExecState globalExec;
+            OwnPtr<GlobalExecState> globalExec;
             int recursion;
 
             unsigned timeoutTime;
@@ -140,20 +141,22 @@ namespace KJS {
             unsigned pageGroupIdentifier;
 
             OwnPtr<HashSet<JSObject*> > arrayVisitedElements; // Global data shared by array prototype functions.
+
+            PerThreadData perThreadData;
         };
 
     public:
         JSGlobalObject()
-            : JSVariableObject(new JSGlobalObjectData(this, this))
+            : JSVariableObject(new JSGlobalObjectData)
         {
-            init();
+            init(this);
         }
 
     protected:
         JSGlobalObject(JSValue* proto, JSObject* globalThisValue)
-            : JSVariableObject(proto, new JSGlobalObjectData(this, globalThisValue))
+            : JSVariableObject(proto, new JSGlobalObjectData)
         {
-            init();
+            init(globalThisValue);
         }
 
     public:
@@ -246,8 +249,14 @@ namespace KJS {
 
         HashSet<JSObject*>& arrayVisitedElements() { if (!d()->arrayVisitedElements) d()->arrayVisitedElements.set(new HashSet<JSObject*>); return *d()->arrayVisitedElements; }
 
+        // Per-thread hash tables, cached on the global object for faster access.
+        const PerThreadData* perThreadData() const { return &d()->perThreadData; }
+
+        // Initialize and/or retrieve per-thread hash tables - use perThreadData() for faster access instead.
+        static ThreadClassInfoHashTables* threadClassInfoHashTables();
+
     private:
-        void init();
+        void init(JSObject* thisValue);
         
         JSGlobalObjectData* d() const { return static_cast<JSGlobalObjectData*>(JSVariableObject::d); }
 
index e4d6172..720a7bc 100644 (file)
@@ -53,14 +53,14 @@ void JSVariableObject::getPropertyNames(ExecState* exec, PropertyNameArray& prop
     JSObject::getPropertyNames(exec, propertyNames);
 }
 
-bool JSVariableObject::getPropertyAttributes(const Identifier& propertyName, unsigned& attributes) const
+bool JSVariableObject::getPropertyAttributes(ExecState* exec, const Identifier& propertyName, unsigned& attributes) const
 {
     size_t index = symbolTable().get(propertyName.ustring().rep());
     if (index != missingSymbolMarker()) {
         attributes = localStorage()[index].attributes;
         return true;
     }
-    return JSObject::getPropertyAttributes(propertyName, attributes);
+    return JSObject::getPropertyAttributes(exec, propertyName, attributes);
 }
 
 void JSVariableObject::mark()
index 75850ee..ee12221 100644 (file)
@@ -50,7 +50,7 @@ namespace KJS {
         virtual bool isVariableObject() const;
         virtual bool isDynamicScope() const = 0;
 
-        virtual bool getPropertyAttributes(const Identifier& propertyName, unsigned& attributes) const;
+        virtual bool getPropertyAttributes(ExecState*, const Identifier& propertyName, unsigned& attributes) const;
 
     protected:
         // Subclasses of JSVariableObject can subclass this struct to add data
index b52c2b3..cf30dd5 100644 (file)
@@ -50,7 +50,7 @@ static const unsigned minDensityMultiplier = 8;
 
 static const unsigned copyingSortCutoff = 50000;
 
-const ClassInfo ArrayInstance::info = {"Array", 0, 0};
+const ClassInfo ArrayInstance::info = {"Array", 0, 0, 0};
 
 static inline size_t storageSize(unsigned vectorLength)
 {
index 814bc24..26b877d 100644 (file)
@@ -38,7 +38,7 @@ namespace KJS {
 
 // ------------------------------ ArrayPrototype ----------------------------
 
-const ClassInfo ArrayPrototype::info = {"Array", &ArrayInstance::info, &arrayTable};
+const ClassInfo ArrayPrototype::info = {"Array", &ArrayInstance::info, 0, ExecState::arrayTable};
 
 /* Source for array_object.lut.h
 @begin arrayTable 16
@@ -72,7 +72,7 @@ ArrayPrototype::ArrayPrototype(ExecState*, ObjectPrototype* objProto)
 
 bool ArrayPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
 {
-    return getStaticFunctionSlot<ArrayInstance>(exec, &arrayTable, this, propertyName, slot);
+    return getStaticFunctionSlot<ArrayInstance>(exec, ExecState::arrayTable(exec), this, propertyName, slot);
 }
 
 
index 1e129f5..2d770ee 100644 (file)
@@ -30,7 +30,7 @@ namespace KJS {
 
 // ------------------------------ BooleanInstance ---------------------------
 
-const ClassInfo BooleanInstance::info = { "Boolean", 0, 0 };
+const ClassInfo BooleanInstance::info = { "Boolean", 0, 0, 0 };
 
 BooleanInstance::BooleanInstance(JSObject* proto)
     : JSWrapperObject(proto)
index 19fb864..7e8e603 100755 (executable)
@@ -202,7 +202,7 @@ sub output() {
     }
     print "   { 0, 0, 0, 0 }\n";
     print "};\n\n";
-    print "const struct HashTable $name = ";
+    print "extern const struct HashTable $name = ";
     print "\{ ", $size - 1, ", $nameEntries, 0 \};\n\n";
     print "} // namespace\n";
 }
index 1cb4ee7..5de0747 100644 (file)
@@ -330,7 +330,7 @@ static bool fillStructuresUsingDateArgs(ExecState *exec, const List &args, int m
 
 // ------------------------------ DateInstance ------------------------------
 
-const ClassInfo DateInstance::info = {"Date", 0, 0};
+const ClassInfo DateInstance::info = {"Date", 0, 0, 0};
 
 DateInstance::DateInstance(JSObject *proto)
   : JSWrapperObject(proto)
@@ -416,7 +416,7 @@ static inline bool isTime_tSigned()
 
 // ------------------------------ DatePrototype -----------------------------
 
-const ClassInfo DatePrototype::info = {"Date", &DateInstance::info, &dateTable};
+const ClassInfo DatePrototype::info = {"Date", &DateInstance::info, 0, ExecState::dateTable};
 
 /* Source for date_object.lut.h
    FIXMEL We could use templates to simplify the UTC variants.
@@ -478,7 +478,7 @@ DatePrototype::DatePrototype(ExecState *, ObjectPrototype *objectProto)
 
 bool DatePrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
 {
-    return getStaticFunctionSlot<JSObject>(exec, &dateTable, this, propertyName, slot);
+    return getStaticFunctionSlot<JSObject>(exec, ExecState::dateTable(exec), this, propertyName, slot);
 }
 
 // ------------------------------ DateObjectImp --------------------------------
@@ -489,8 +489,8 @@ DateObjectImp::DateObjectImp(ExecState* exec, FunctionPrototype* funcProto, Date
   : InternalFunctionImp(funcProto, dateProto->classInfo()->className)
 {
   putDirect(exec->propertyNames().prototype, dateProto, DontEnum|DontDelete|ReadOnly);
-  putDirectFunction(new DateObjectFuncImp(exec, funcProto, DateObjectFuncImp::Parse, 1, CommonIdentifiers::shared()->parse), DontEnum);
-  putDirectFunction(new DateObjectFuncImp(exec, funcProto, DateObjectFuncImp::UTC, 7, CommonIdentifiers::shared()->UTC), DontEnum);
+  putDirectFunction(new DateObjectFuncImp(exec, funcProto, DateObjectFuncImp::Parse, 1, exec->propertyNames().parse), DontEnum);
+  putDirectFunction(new DateObjectFuncImp(exec, funcProto, DateObjectFuncImp::UTC, 7, exec->propertyNames().UTC), DontEnum);
   putDirect(exec->propertyNames().length, 7, ReadOnly|DontDelete|DontEnum);
 }
 
index 75ef0ba..ac773b6 100644 (file)
@@ -31,7 +31,7 @@ namespace KJS {
 
 // ------------------------------ ErrorInstance ----------------------------
 
-const ClassInfo ErrorInstance::info = { "Error", 0, 0 };
+const ClassInfo ErrorInstance::info = { "Error", 0, 0, 0 };
 
 ErrorInstance::ErrorInstance(JSObject* prototype)
     : JSObject(prototype)
@@ -114,7 +114,7 @@ NativeErrorPrototype::NativeErrorPrototype(ExecState* exec, ErrorPrototype* erro
 
 // ------------------------------ NativeErrorImp -------------------------------
 
-const ClassInfo NativeErrorImp::info = { "Function", &InternalFunctionImp::info, 0 };
+const ClassInfo NativeErrorImp::info = { "Function", &InternalFunctionImp::info, 0, 0 };
 
 NativeErrorImp::NativeErrorImp(ExecState* exec, FunctionPrototype* funcProto, NativeErrorPrototype* prot)
     : InternalFunctionImp(funcProto, Identifier(prot->getDirect(exec->propertyNames().name)->getString()))
index 431a909..fe2458c 100644 (file)
@@ -57,7 +57,7 @@ namespace KJS {
 
 // ----------------------------- FunctionImp ----------------------------------
 
-const ClassInfo FunctionImp::info = { "Function", &InternalFunctionImp::info, 0 };
+const ClassInfo FunctionImp::info = { "Function", &InternalFunctionImp::info, 0, 0 };
 
 FunctionImp::FunctionImp(ExecState* exec, const Identifier& name, FunctionBodyNode* b, const ScopeChain& sc)
   : InternalFunctionImp(exec->lexicalGlobalObject()->functionPrototype(), name)
@@ -279,7 +279,7 @@ Identifier& IndexToNameMap::operator[](const Identifier& index)
 
 // ------------------------------ Arguments ---------------------------------
 
-const ClassInfo Arguments::info = { "Arguments", 0, 0 };
+const ClassInfo Arguments::info = { "Arguments", 0, 0, 0 };
 
 // ECMA 10.1.8
 Arguments::Arguments(ExecState* exec, FunctionImp* func, const List& args, ActivationImp* act)
@@ -342,7 +342,7 @@ bool Arguments::deleteProperty(ExecState* exec, const Identifier& propertyName)
 
 // ------------------------------ ActivationImp --------------------------------
 
-const ClassInfo ActivationImp::info = { "Activation", 0, 0 };
+const ClassInfo ActivationImp::info = { "Activation", 0, 0, 0 };
 
 ActivationImp::ActivationImp(const ActivationData& oldData, bool leaveRelic)
 {
index eb1bf99..c849b4d 100644 (file)
@@ -47,8 +47,8 @@ FunctionPrototype::FunctionPrototype(ExecState* exec)
     putDirect(exec->propertyNames().length, jsNumber(0), DontDelete | ReadOnly | DontEnum);
 
     putDirectFunction(new PrototypeFunction(exec, this, 0, exec->propertyNames().toString, functionProtoFuncToString), DontEnum);
-    putDirectFunction(new PrototypeFunction(exec, this, 2, CommonIdentifiers::shared()->apply, functionProtoFuncApply), DontEnum);
-    putDirectFunction(new PrototypeFunction(exec, this, 1, CommonIdentifiers::shared()->call, functionProtoFuncCall), DontEnum);
+    putDirectFunction(new PrototypeFunction(exec, this, 2, exec->propertyNames().apply, functionProtoFuncApply), DontEnum);
+    putDirectFunction(new PrototypeFunction(exec, this, 1, exec->propertyNames().call, functionProtoFuncCall), DontEnum);
 }
 
 // ECMA 15.3.4
index 87007e3..4155418 100644 (file)
@@ -220,7 +220,7 @@ bool LabelStack::contains(const Identifier &id) const
 
 // ------------------------------ InternalFunctionImp --------------------------
 
-const ClassInfo InternalFunctionImp::info = { "Function", 0, 0 };
+const ClassInfo InternalFunctionImp::info = { "Function", 0, 0, 0 };
 
 InternalFunctionImp::InternalFunctionImp()
 {
index 031d030..fd55a34 100644 (file)
@@ -88,6 +88,7 @@ Lexer::Lexer()
     , next1(0)
     , next2(0)
     , next3(0)
+    , mainTable(KJS::mainTable)
 {
     m_buffer8.reserveCapacity(initialReadBufferCapacity);
     m_buffer16.reserveCapacity(initialReadBufferCapacity);
@@ -95,6 +96,11 @@ Lexer::Lexer()
     m_identifiers.reserveCapacity(initialStringTableCapacity);
 }
 
+Lexer::~Lexer()
+{
+    delete[] mainTable.table;
+}
+
 void Lexer::setCode(int startingLineNumber, const UChar* c, unsigned int len)
 {
   yylineno = 1 + startingLineNumber;
index faaa215..cd3085a 100644 (file)
@@ -24,6 +24,7 @@
 #ifndef Lexer_h
 #define Lexer_h
 
+#include "lookup.h"
 #include "ustring.h"
 #include <wtf/Vector.h>
 
@@ -94,6 +95,7 @@ namespace KJS {
     friend Lexer& lexer();
     friend class WTF::ThreadSpecific<Lexer>;
     Lexer();
+    ~Lexer();
 
     int yylineno;
     bool done;
@@ -145,6 +147,8 @@ namespace KJS {
     
     UString m_pattern;
     UString m_flags;
+
+    const HashTable mainTable;
   };
   
   Lexer& lexer(); // Returns the singletone JavaScript lexer.
index 1106d44..d6fa857 100644 (file)
@@ -281,7 +281,7 @@ namespace KJS {
     };
 
 #define KJS_IMPLEMENT_PROTOTYPE(ClassName, ClassPrototype) \
-    const ClassInfo ClassPrototype::info = { ClassName"Prototype", 0, &ClassPrototype##Table  }; \
+    const ClassInfo ClassPrototype::info = { ClassName"Prototype", 0, &ClassPrototype##Table, 0  }; \
     JSObject* ClassPrototype::self(ExecState* exec) \
     { \
         return KJS::cacheGlobalObject<ClassPrototype>(exec, Identifier("[[" ClassName ".prototype]]")); \
index cd2c68d..21fa92c 100644 (file)
@@ -31,7 +31,7 @@ namespace KJS {
 
 // ------------------------------ MathObjectImp --------------------------------
 
-const ClassInfo MathObjectImp::info = { "Math", 0, &mathTable };
+const ClassInfo MathObjectImp::info = { "Math", 0, 0, ExecState::mathTable };
 
 /* Source for math_object.lut.h
 @begin mathTable 21
@@ -73,7 +73,7 @@ MathObjectImp::MathObjectImp(ExecState*, ObjectPrototype* objectPrototype)
 
 bool MathObjectImp::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot &slot)
 {
-    return getStaticPropertySlot<MathObjectImp, JSObject>(exec, &mathTable, this, propertyName, slot);
+    return getStaticPropertySlot<MathObjectImp, JSObject>(exec, ExecState::mathTable(exec), this, propertyName, slot);
 }
 
 JSValue* MathObjectImp::getValueProperty(ExecState*, int token) const
index bf48309..b72c0e6 100644 (file)
@@ -34,7 +34,7 @@ namespace KJS {
 
 // ------------------------------ NumberInstance ----------------------------
 
-const ClassInfo NumberInstance::info = { "Number", 0, 0 };
+const ClassInfo NumberInstance::info = { "Number", 0, 0, 0 };
 
 NumberInstance::NumberInstance(JSObject* proto)
     : JSWrapperObject(proto)
@@ -450,7 +450,7 @@ JSValue* numberProtoFuncToPrecision(ExecState* exec, JSObject* thisObj, const Li
 
 // ------------------------------ NumberObjectImp ------------------------------
 
-const ClassInfo NumberObjectImp::info = { "Function", &InternalFunctionImp::info, &numberTable };
+const ClassInfo NumberObjectImp::info = { "Function", &InternalFunctionImp::info, 0, ExecState::numberTable };
 
 /* Source for number_object.lut.h
 @begin numberTable 5
@@ -473,7 +473,7 @@ NumberObjectImp::NumberObjectImp(ExecState* exec, FunctionPrototype* funcProto,
 
 bool NumberObjectImp::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
 {
-    return getStaticValueSlot<NumberObjectImp, InternalFunctionImp>(exec, &numberTable, this, propertyName, slot);
+    return getStaticValueSlot<NumberObjectImp, InternalFunctionImp>(exec, ExecState::numberTable(exec), this, propertyName, slot);
 }
 
 JSValue* NumberObjectImp::getValueProperty(ExecState*, int token) const
index 1a0ffc9..096675f 100644 (file)
@@ -27,7 +27,6 @@
 
 #include "date_object.h"
 #include "error_object.h"
-#include "lookup.h"
 #include "nodes.h"
 #include "operations.h"
 #include "PropertyNameArray.h"
@@ -318,7 +317,7 @@ bool JSObject::hasProperty(ExecState *exec, unsigned propertyName) const
 }
 
 // ECMA 8.6.2.5
-bool JSObject::deleteProperty(ExecState* /*exec*/, const Identifier &propertyName)
+bool JSObject::deleteProperty(ExecState* exec, const Identifier &propertyName)
 {
   unsigned attributes;
   JSValue *v = _prop.get(propertyName, attributes);
@@ -332,7 +331,7 @@ bool JSObject::deleteProperty(ExecState* /*exec*/, const Identifier &propertyNam
   }
 
   // Look in the static hashtable of properties
-  const HashEntry* entry = findPropertyHashEntry(propertyName);
+  const HashEntry* entry = findPropertyHashEntry(exec, propertyName);
   if (entry && entry->attributes & DontDelete)
     return false; // this builtin property can't be deleted
   // FIXME: Should the code here actually do some deletion?
@@ -395,10 +394,10 @@ JSValue* JSObject::defaultValue(ExecState* exec, JSType hint) const
   return throwError(exec, TypeError, "No default value");
 }
 
-const HashEntry* JSObject::findPropertyHashEntry(const Identifier& propertyName) const
+const HashEntry* JSObject::findPropertyHashEntry(ExecState* exec, const Identifier& propertyName) const
 {
     for (const ClassInfo* info = classInfo(); info; info = info->parentClass) {
-        if (const HashTable* propHashTable = info->propHashTable) {
+        if (const HashTable* propHashTable = info->propHashTable(exec)) {
             if (const HashEntry* e = propHashTable->entry(propertyName))
                 return e;
         }
@@ -529,23 +528,23 @@ bool JSObject::hasInstance(ExecState* exec, JSValue* value)
     return false;
 }
 
-bool JSObject::propertyIsEnumerable(ExecState*, const Identifier& propertyName) const
+bool JSObject::propertyIsEnumerable(ExecState* exec, const Identifier& propertyName) const
 {
   unsigned attributes;
  
-  if (!getPropertyAttributes(propertyName, attributes))
+  if (!getPropertyAttributes(exec, propertyName, attributes))
     return false;
   else
     return !(attributes & DontEnum);
 }
 
-bool JSObject::getPropertyAttributes(const Identifier& propertyName, unsigned& attributes) const
+bool JSObject::getPropertyAttributes(ExecState* exec, const Identifier& propertyName, unsigned& attributes) const
 {
   if (_prop.get(propertyName, attributes))
     return true;
     
   // Look in the static hashtable of properties
-  const HashEntry* e = findPropertyHashEntry(propertyName);
+  const HashEntry* e = findPropertyHashEntry(exec, propertyName);
   if (e) {
     attributes = e->attributes;
     return true;
@@ -560,7 +559,7 @@ void JSObject::getPropertyNames(ExecState* exec, PropertyNameArray& propertyName
 
     // Add properties from the static hashtables of properties
     for (const ClassInfo* info = classInfo(); info; info = info->parentClass) {
-        const HashTable* table = info->propHashTable;
+        const HashTable* table = info->propHashTable(exec);
         if (!table)
             continue;
         if (!table->table)
index b1c1bc5..90f5c32 100644 (file)
@@ -65,8 +65,18 @@ namespace KJS {
     const ClassInfo* parentClass;
     /**
      * Static hash-table of properties.
+     * For classes that can be used from multiple threads, it is accessed via a getter function that would typically return a pointer to thread-specific value.
      */
-    const HashTable* propHashTable;
+    const HashTable* propHashTable(ExecState* exec) const
+    {
+        if (classPropHashTableGetterFunction)
+            return classPropHashTableGetterFunction(exec);
+        return staticPropHashTable;
+    }
+
+    const HashTable* staticPropHashTable;
+    typedef const HashTable* (*ClassPropHashTableGetterFunction)(ExecState*);
+    const ClassPropHashTableGetterFunction classPropHashTableGetterFunction;
   };
   
   // This is an internal value object which stores getter and setter functions
@@ -145,8 +155,8 @@ namespace KJS {
      * And in your source file:
      *
      * \code
-     *   const ClassInfo BarImp::info = { "Bar", 0, 0 }; // no parent class
-     *   const ClassInfo FooImp::info = { "Foo", &BarImp::info, 0 };
+     *   const ClassInfo BarImp::info = { "Bar", 0, 0, 0 }; // no parent class
+     *   const ClassInfo FooImp::info = { "Foo", &BarImp::info, 0, 0 };
      * \endcode
      *
      * @see inherits()
@@ -409,7 +419,7 @@ namespace KJS {
     virtual JSObject* toThisObject(ExecState*) const;
     virtual JSGlobalObject* toGlobalObject(ExecState*) const;
 
-    virtual bool getPropertyAttributes(const Identifier& propertyName, unsigned& attributes) const;
+    virtual bool getPropertyAttributes(ExecState*, const Identifier& propertyName, unsigned& attributes) const;
     
     // WebCore uses this to make document.all and style.filter undetectable
     virtual bool masqueradeAsUndefined() const { return false; }
@@ -443,7 +453,7 @@ namespace KJS {
     PropertyMap _prop;
 
   private:
-    const HashEntry* findPropertyHashEntry( const Identifier& propertyName ) const;
+    const HashEntry* findPropertyHashEntry(ExecState*, const Identifier& propertyName) const;
     JSValue *_proto;
   };
 
index 0ac2c6a..9bc1fe2 100644 (file)
@@ -46,15 +46,15 @@ ObjectPrototype::ObjectPrototype(ExecState* exec, FunctionPrototype* functionPro
     putDirectFunction(new PrototypeFunction(exec, functionPrototype, 0, exec->propertyNames().toString, objectProtoFuncToString), DontEnum);
     putDirectFunction(new PrototypeFunction(exec, functionPrototype, 0, exec->propertyNames().toLocaleString, objectProtoFuncToLocaleString), DontEnum);
     putDirectFunction(new PrototypeFunction(exec, functionPrototype, 0, exec->propertyNames().valueOf, objectProtoFuncValueOf), DontEnum);
-    putDirectFunction(new PrototypeFunction(exec, functionPrototype, 1, CommonIdentifiers::shared()->hasOwnProperty, objectProtoFuncHasOwnProperty), DontEnum);
-    putDirectFunction(new PrototypeFunction(exec, functionPrototype, 1, CommonIdentifiers::shared()->propertyIsEnumerable, objectProtoFuncPropertyIsEnumerable), DontEnum);
-    putDirectFunction(new PrototypeFunction(exec, functionPrototype, 1, CommonIdentifiers::shared()->isPrototypeOf, objectProtoFuncIsPrototypeOf), DontEnum);
+    putDirectFunction(new PrototypeFunction(exec, functionPrototype, 1, exec->propertyNames().hasOwnProperty, objectProtoFuncHasOwnProperty), DontEnum);
+    putDirectFunction(new PrototypeFunction(exec, functionPrototype, 1, exec->propertyNames().propertyIsEnumerable, objectProtoFuncPropertyIsEnumerable), DontEnum);
+    putDirectFunction(new PrototypeFunction(exec, functionPrototype, 1, exec->propertyNames().isPrototypeOf, objectProtoFuncIsPrototypeOf), DontEnum);
 
     // Mozilla extensions
-    putDirectFunction(new PrototypeFunction(exec, functionPrototype, 2, CommonIdentifiers::shared()->__defineGetter__, objectProtoFuncDefineGetter), DontEnum);
-    putDirectFunction(new PrototypeFunction(exec, functionPrototype, 2, CommonIdentifiers::shared()->__defineSetter__, objectProtoFuncDefineSetter), DontEnum);
-    putDirectFunction(new PrototypeFunction(exec, functionPrototype, 1, CommonIdentifiers::shared()->__lookupGetter__, objectProtoFuncLookupGetter), DontEnum);
-    putDirectFunction(new PrototypeFunction(exec, functionPrototype, 1, CommonIdentifiers::shared()->__lookupSetter__, objectProtoFuncLookupSetter), DontEnum);
+    putDirectFunction(new PrototypeFunction(exec, functionPrototype, 2, exec->propertyNames().__defineGetter__, objectProtoFuncDefineGetter), DontEnum);
+    putDirectFunction(new PrototypeFunction(exec, functionPrototype, 2, exec->propertyNames().__defineSetter__, objectProtoFuncDefineSetter), DontEnum);
+    putDirectFunction(new PrototypeFunction(exec, functionPrototype, 1, exec->propertyNames().__lookupGetter__, objectProtoFuncLookupGetter), DontEnum);
+    putDirectFunction(new PrototypeFunction(exec, functionPrototype, 1, exec->propertyNames().__lookupSetter__, objectProtoFuncLookupSetter), DontEnum);
 }
 
 
index bdcb27f..b723798 100644 (file)
@@ -46,14 +46,14 @@ static JSValue* regExpProtoFuncToString(ExecState*, JSObject*, const List&);
 
 // ECMA 15.10.5
 
-const ClassInfo RegExpPrototype::info = { "RegExpPrototype", 0, 0 };
+const ClassInfo RegExpPrototype::info = { "RegExpPrototype", 0, 0, 0 };
 
 RegExpPrototype::RegExpPrototype(ExecState* exec, ObjectPrototype* objectPrototype, FunctionPrototype* functionPrototype)
     : JSObject(objectPrototype)
 {
-    putDirectFunction(new PrototypeFunction(exec, functionPrototype, 0, CommonIdentifiers::shared()->compile, regExpProtoFuncCompile), DontEnum);
-    putDirectFunction(new PrototypeFunction(exec, functionPrototype, 0, CommonIdentifiers::shared()->exec, regExpProtoFuncExec), DontEnum);
-    putDirectFunction(new PrototypeFunction(exec, functionPrototype, 0, CommonIdentifiers::shared()->test, regExpProtoFuncTest), DontEnum);
+    putDirectFunction(new PrototypeFunction(exec, functionPrototype, 0, exec->propertyNames().compile, regExpProtoFuncCompile), DontEnum);
+    putDirectFunction(new PrototypeFunction(exec, functionPrototype, 0, exec->propertyNames().exec, regExpProtoFuncExec), DontEnum);
+    putDirectFunction(new PrototypeFunction(exec, functionPrototype, 0, exec->propertyNames().test, regExpProtoFuncTest), DontEnum);
     putDirectFunction(new PrototypeFunction(exec, functionPrototype, 0, exec->propertyNames().toString, regExpProtoFuncToString), DontEnum);
 }
 
@@ -122,7 +122,7 @@ JSValue* regExpProtoFuncToString(ExecState* exec, JSObject* thisObj, const List&
 
 // ------------------------------ RegExpImp ------------------------------------
 
-const ClassInfo RegExpImp::info = { "RegExp", 0, &RegExpImpTable };
+const ClassInfo RegExpImp::info = { "RegExp", 0, 0, ExecState::RegExpImpTable };
 
 /* Source for regexp_object.lut.h
 @begin RegExpImpTable 5
@@ -147,7 +147,7 @@ RegExpImp::~RegExpImp()
 
 bool RegExpImp::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
 {
-  return getStaticValueSlot<RegExpImp, JSObject>(exec, &RegExpImpTable, this, propertyName, slot);
+  return getStaticValueSlot<RegExpImp, JSObject>(exec, ExecState::RegExpImpTable(exec), this, propertyName, slot);
 }
 
 JSValue* RegExpImp::getValueProperty(ExecState*, int token) const
@@ -171,7 +171,7 @@ JSValue* RegExpImp::getValueProperty(ExecState*, int token) const
 
 void RegExpImp::put(ExecState* exec, const Identifier& propertyName, JSValue* value)
 {
-    lookupPut<RegExpImp, JSObject>(exec, propertyName, value, &RegExpImpTable, this);
+    lookupPut<RegExpImp, JSObject>(exec, propertyName, value, ExecState::RegExpImpTable(exec), this);
 }
 
 void RegExpImp::putValueProperty(ExecState* exec, int token, JSValue* value)
@@ -242,7 +242,7 @@ JSValue* RegExpImp::callAsFunction(ExecState* exec, JSObject*, const List& args)
 
 // ------------------------------ RegExpObjectImp ------------------------------
 
-const ClassInfo RegExpObjectImp::info = { "Function", &InternalFunctionImp::info, &RegExpObjectImpTable };
+const ClassInfo RegExpObjectImp::info = { "Function", &InternalFunctionImp::info, 0, ExecState::RegExpObjectImpTable };
 
 /* Source for regexp_object.lut.h
 @begin RegExpObjectImpTable 21
@@ -363,7 +363,7 @@ JSValue *RegExpObjectImp::getRightContext() const
 
 bool RegExpObjectImp::getOwnPropertySlot(ExecState *exec, const Identifier& propertyName, PropertySlot& slot)
 {
-  return getStaticValueSlot<RegExpObjectImp, InternalFunctionImp>(exec, &RegExpObjectImpTable, this, propertyName, slot);
+  return getStaticValueSlot<RegExpObjectImp, InternalFunctionImp>(exec, ExecState::RegExpObjectImpTable(exec), this, propertyName, slot);
 }
 
 JSValue *RegExpObjectImp::getValueProperty(ExecState*, int token) const
@@ -408,7 +408,7 @@ JSValue *RegExpObjectImp::getValueProperty(ExecState*, int token) const
 
 void RegExpObjectImp::put(ExecState *exec, const Identifier &propertyName, JSValue *value)
 {
-    lookupPut<RegExpObjectImp, InternalFunctionImp>(exec, propertyName, value, &RegExpObjectImpTable, this);
+    lookupPut<RegExpObjectImp, InternalFunctionImp>(exec, propertyName, value, ExecState::RegExpObjectImpTable(exec), this);
 }
 
 void RegExpObjectImp::putValueProperty(ExecState *exec, int token, JSValue *value)
index 8dbdac8..415ae37 100644 (file)
@@ -38,7 +38,7 @@ namespace KJS {
 
 // ------------------------------ StringInstance ----------------------------
 
-const ClassInfo StringInstance::info = { "String", 0, 0 };
+const ClassInfo StringInstance::info = { "String", 0, 0, 0 };
 
 StringInstance::StringInstance(JSObject *proto)
   : JSWrapperObject(proto)
@@ -125,7 +125,7 @@ void StringInstance::getPropertyNames(ExecState* exec, PropertyNameArray& proper
 }
 
 // ------------------------------ StringPrototype ---------------------------
-const ClassInfo StringPrototype::info = { "String", &StringInstance::info, &stringTable };
+const ClassInfo StringPrototype::info = { "String", &StringInstance::info, 0, ExecState::stringTable };
 /* Source for string_object.lut.h
 @begin stringTable 26
   toString              &stringProtoFuncToString          DontEnum|Function       0
@@ -173,7 +173,7 @@ StringPrototype::StringPrototype(ExecState* exec, ObjectPrototype* objProto)
 
 bool StringPrototype::getOwnPropertySlot(ExecState *exec, const Identifier& propertyName, PropertySlot &slot)
 {
-  return getStaticFunctionSlot<StringInstance>(exec, &stringTable, this, propertyName, slot);
+  return getStaticFunctionSlot<StringInstance>(exec, ExecState::stringTable(exec), this, propertyName, slot);
 }
 
 // ------------------------------ Functions --------------------------
index 53a4928..bff9f07 100644 (file)
@@ -1,3 +1,13 @@
+2008-04-25  Alexey Proskuryakov  <ap@webkit.org>
+
+        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
+
+        * UserObjectImp.cpp: Adjusted for the new member added to ClassInfo.
+
 2008-04-25  Mark Rowe  <mrowe@apple.com>
 
         Reviewed by Adele Peterson.
index 20c06c3..7217c40 100644 (file)
@@ -30,7 +30,7 @@
 #include "UserObjectImp.h"
 #include <JavaScriptCore/PropertyNameArray.h>
 
-const ClassInfo UserObjectImp::info = { "UserObject", 0, 0 };
+const ClassInfo UserObjectImp::info = { "UserObject", 0, 0, 0 };
 
 UserObjectImp::UserObjectImp(JSUserObject* userObject)
     : fJSUserObject((JSUserObject*)userObject->Retain())
index 6d289b3..474a2a0 100644 (file)
@@ -1,3 +1,58 @@
+2008-04-25  Alexey Proskuryakov  <ap@webkit.org>
+
+        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
+
+        Adjusted for JavaScriptCore changes: added a new member to ClassInfo objects, turned
+        ClassInfo::propHashTable into a function, made getPropertyAttributes() take an ExecState pointer.
+
+        * bindings/js/JSAudioConstructor.cpp:
+        (WebCore::):
+        * bindings/js/JSDOMWindowBase.cpp:
+        (WebCore::):
+        * bindings/js/JSDOMWindowCustom.cpp:
+        (WebCore::JSDOMWindow::customGetOwnPropertySlot):
+        * bindings/js/JSDOMWindowWrapper.cpp:
+        (WebCore::):
+        (WebCore::JSDOMWindowWrapper::getPropertyAttributes):
+        * bindings/js/JSDOMWindowWrapper.h:
+        * bindings/js/JSEventTargetBase.h:
+        (WebCore::JSEventTargetPrototype::classInfo):
+        * bindings/js/JSHTMLInputElementBase.cpp:
+        (WebCore::):
+        * bindings/js/JSHTMLOptionElementConstructor.cpp:
+        (WebCore::):
+        * bindings/js/JSHistoryCustom.cpp:
+        (WebCore::JSHistory::customGetOwnPropertySlot):
+        * bindings/js/JSImageConstructor.cpp:
+        (WebCore::):
+        * bindings/js/JSInspectedObjectWrapper.cpp:
+        (WebCore::):
+        * bindings/js/JSInspectorCallbackWrapper.cpp:
+        (WebCore::):
+        * bindings/js/JSLocationCustom.cpp:
+        (WebCore::JSLocation::customGetOwnPropertySlot):
+        (WebCore::JSLocation::customPut):
+        * bindings/js/JSNamedNodesCollection.cpp:
+        (WebCore::):
+        * bindings/js/JSQuarantinedObjectWrapper.cpp:
+        (WebCore::):
+        * bindings/js/JSRGBColor.cpp:
+        (WebCore::):
+        * bindings/js/JSStorageCustom.cpp:
+        (WebCore::JSStorage::customPut):
+        * bindings/js/JSXMLHttpRequestConstructor.cpp:
+        (WebCore::):
+        * bindings/js/JSXSLTProcessor.cpp:
+        (WebCore::):
+        * bindings/scripts/CodeGeneratorJS.pm:
+        * bridge/objc/objc_runtime.mm:
+        * bridge/runtime_array.cpp:
+        * bridge/runtime_object.cpp:
+
 2008-04-28  David Hyatt  <hyatt@apple.com>
 
         https://bugs.webkit.org/show_bug.cgi?id=18779
index a60a403..ab4e735 100644 (file)
@@ -37,7 +37,7 @@ using namespace KJS;
 
 namespace WebCore {
 
-const ClassInfo JSAudioConstructor::s_info = { "AudioConstructor", 0, 0 };
+const ClassInfo JSAudioConstructor::s_info = { "AudioConstructor", 0, 0, 0 };
 
 JSAudioConstructor::JSAudioConstructor(ExecState* exec, Document* document)
     : DOMObject(exec->lexicalGlobalObject()->objectPrototype())
index 8071921..ab9b2aa 100644 (file)
@@ -137,7 +137,7 @@ private:
 
 ////////////////////// JSDOMWindowBase Object ////////////////////////
 
-const ClassInfo JSDOMWindowBase::s_info = { "Window", 0, &JSDOMWindowBaseTable };
+const ClassInfo JSDOMWindowBase::s_info = { "Window", 0, &JSDOMWindowBaseTable, 0 };
 
 /*
 @begin JSDOMWindowBaseTable 118
index a31e47a..2e201f9 100644 (file)
@@ -82,12 +82,12 @@ bool JSDOMWindow::customGetOwnPropertySlot(ExecState* exec, const Identifier& pr
     if (!impl()->frame()) {
         // The following code is safe for cross-domain and same domain use.
         // It ignores any custom properties that might be set on the DOMWindow (including a custom prototype).
-        entry = s_info.propHashTable->entry(propertyName);
+        entry = s_info.propHashTable(exec)->entry(propertyName);
         if (entry && !(entry->attributes & Function) && entry->integerValue == ClosedAttrNum) {
             slot.setStaticEntry(this, entry, staticValueGetter<JSDOMWindow>);
             return true;
         }
-        entry = JSDOMWindowPrototype::s_info.propHashTable->entry(propertyName);
+        entry = JSDOMWindowPrototype::s_info.propHashTable(exec)->entry(propertyName);
         if (entry && (entry->attributes & Function) && entry->functionValue == jsDOMWindowPrototypeFunctionClose) {
             slot.setStaticEntry(this, entry, nonCachingStaticFunctionGetter);
             return true;
@@ -115,7 +115,7 @@ bool JSDOMWindow::customGetOwnPropertySlot(ExecState* exec, const Identifier& pr
     // prototype due to the blanket same origin (allowsAccessFrom) check at the end of getOwnPropertySlot.
     // Also, it's important to get the implementation straight out of the DOMWindow prototype regardless of
     // what prototype is actually set on this object.
-    entry = JSDOMWindowPrototype::s_info.propHashTable->entry(propertyName);
+    entry = JSDOMWindowPrototype::s_info.propHashTable(exec)->entry(propertyName);
     if (entry) {
         if ((entry->attributes & Function)
                 && (entry->functionValue == jsDOMWindowPrototypeFunctionBlur
index 5314cf9..3334af2 100644 (file)
@@ -39,7 +39,7 @@ using namespace KJS;
 
 namespace WebCore {
 
-const ClassInfo JSDOMWindowWrapper::s_info = { "JSDOMWindowWrapper", 0, 0 };
+const ClassInfo JSDOMWindowWrapper::s_info = { "JSDOMWindowWrapper", 0, 0, 0 };
 
 JSDOMWindowWrapper::JSDOMWindowWrapper(DOMWindow* domWindow)
     : Base(jsNull())
@@ -94,9 +94,9 @@ void JSDOMWindowWrapper::getPropertyNames(ExecState* exec, PropertyNameArray& pr
     m_window->getPropertyNames(exec, propertyNames);
 }
 
-bool JSDOMWindowWrapper::getPropertyAttributes(const Identifier& propertyName, unsigned& attributes) const
+bool JSDOMWindowWrapper::getPropertyAttributes(KJS::ExecState* exec, const Identifier& propertyName, unsigned& attributes) const
 {
-    return m_window->getPropertyAttributes(propertyName, attributes);
+    return m_window->getPropertyAttributes(exec, propertyName, attributes);
 }
 
 void JSDOMWindowWrapper::defineGetter(ExecState* exec, const Identifier& propertyName, JSObject* getterFunction)
index 57861c8..d93f075 100644 (file)
@@ -64,7 +64,7 @@ namespace WebCore {
         virtual void putWithAttributes(KJS::ExecState*, const KJS::Identifier& propertyName, KJS::JSValue*, unsigned attributes);
         virtual bool deleteProperty(KJS::ExecState*, const KJS::Identifier& propertyName);
         virtual void getPropertyNames(KJS::ExecState*, KJS::PropertyNameArray&);
-        virtual bool getPropertyAttributes(const KJS::Identifier& propertyName, unsigned& attributes) const;
+        virtual bool getPropertyAttributes(KJS::ExecState*, const KJS::Identifier& propertyName, unsigned& attributes) const;
         virtual void defineGetter(KJS::ExecState*, const KJS::Identifier& propertyName, KJS::JSObject* getterFunction);
         virtual void defineSetter(KJS::ExecState*, const KJS::Identifier& propertyName, KJS::JSObject* setterFunction);
         virtual KJS::JSValue* lookupGetter(KJS::ExecState*, const KJS::Identifier& propertyName);
index a8fd713..b8142d9 100644 (file)
@@ -144,7 +144,7 @@ namespace WebCore {
 
         virtual const KJS::ClassInfo* classInfo() const
         {
-            static const KJS::ClassInfo s_classInfo = { JSEventTargetPrototypeInformation::prototypeClassName(), 0, &KJS::JSEventTargetPrototypeTable };
+            static const KJS::ClassInfo s_classInfo = { JSEventTargetPrototypeInformation::prototypeClassName(), 0, &KJS::JSEventTargetPrototypeTable, 0 };
             return &s_classInfo;
         }
     };
index aac0d11..bedd719 100644 (file)
@@ -49,7 +49,7 @@ JSValue* jsHTMLInputElementBaseFunctionSetSelectionRange(ExecState* exec, JSObje
     return jsUndefined();
 }
 
-const ClassInfo JSHTMLInputElementBase::s_info = { "HTMLInputElementBase", &JSHTMLElement::s_info, &JSHTMLInputElementBaseTable };
+const ClassInfo JSHTMLInputElementBase::s_info = { "HTMLInputElementBase", &JSHTMLElement::s_info, &JSHTMLInputElementBaseTable, 0 };
 
 JSHTMLInputElementBase::JSHTMLInputElementBase(KJS::JSObject* prototype, PassRefPtr<HTMLInputElement> e)
     : JSHTMLElement(prototype, e.get())
index 03524dd..0453761 100644 (file)
@@ -29,7 +29,7 @@ using namespace KJS;
 
 namespace WebCore {
 
-const ClassInfo JSHTMLOptionElementConstructor::s_info = { "OptionConstructor", 0, 0 };
+const ClassInfo JSHTMLOptionElementConstructor::s_info = { "OptionConstructor", 0, 0, 0 };
 
 JSHTMLOptionElementConstructor::JSHTMLOptionElementConstructor(ExecState* exec, Document* document)
     : DOMObject(exec->lexicalGlobalObject()->objectPrototype())
index b9b6e06..ee89fb8 100644 (file)
@@ -48,7 +48,7 @@ bool JSHistory::customGetOwnPropertySlot(ExecState* exec, const Identifier& prop
         return false;
 
     // Check for the few functions that we allow, even when called cross-domain.
-    const HashEntry* entry = JSHistoryPrototype::s_info.propHashTable->entry(propertyName);
+    const HashEntry* entry = JSHistoryPrototype::s_info.propHashTable(exec)->entry(propertyName);
     if (entry) {
         // Allow access to back(), forward() and go() from any frame.
         if ((entry->attributes & Function)
index 8596500..a628f7e 100644 (file)
@@ -28,7 +28,7 @@ using namespace KJS;
 
 namespace WebCore {
 
-const ClassInfo JSImageConstructor::s_info = { "ImageConstructor", 0, 0 };
+const ClassInfo JSImageConstructor::s_info = { "ImageConstructor", 0, 0, 0 };
 
 JSImageConstructor::JSImageConstructor(ExecState* exec, Document* document)
     : DOMObject(exec->lexicalGlobalObject()->objectPrototype())
index 9cd0bc2..bb46e8c 100644 (file)
@@ -40,7 +40,7 @@ static WrapperMap& wrappers()
     return map;
 }
 
-const ClassInfo JSInspectedObjectWrapper::s_info = { "JSInspectedObjectWrapper", &JSQuarantinedObjectWrapper::s_info, 0 };
+const ClassInfo JSInspectedObjectWrapper::s_info = { "JSInspectedObjectWrapper", &JSQuarantinedObjectWrapper::s_info, 0, 0 };
 
 JSValue* JSInspectedObjectWrapper::wrap(ExecState* unwrappedExec, JSValue* unwrappedValue)
 {
index abac242..785cee2 100644 (file)
@@ -40,7 +40,7 @@ static WrapperMap& wrappers()
     return map;
 }
 
-const ClassInfo JSInspectorCallbackWrapper::s_info = { "JSInspectorCallbackWrapper", &JSQuarantinedObjectWrapper::s_info, 0 };
+const ClassInfo JSInspectorCallbackWrapper::s_info = { "JSInspectorCallbackWrapper", &JSQuarantinedObjectWrapper::s_info, 0, 0 };
 
 JSValue* JSInspectorCallbackWrapper::wrap(ExecState* unwrappedExec, JSValue* unwrappedValue)
 {
index 779dcdd..d53ef2f 100644 (file)
@@ -54,7 +54,7 @@ bool JSLocation::customGetOwnPropertySlot(ExecState* exec, const Identifier& pro
         return false;
 
     // Check for the few functions that we allow, even when called cross-domain.
-    const HashEntry* entry = JSLocationPrototype::s_info.propHashTable->entry(propertyName);
+    const HashEntry* entry = JSLocationPrototype::s_info.propHashTable(exec)->entry(propertyName);
     if (entry && (entry->attributes & Function)
             && (entry->functionValue == jsLocationPrototypeFunctionReplace
                 || entry->functionValue == jsLocationPrototypeFunctionReload
@@ -80,7 +80,7 @@ bool JSLocation::customPut(ExecState* exec, const Identifier& propertyName, JSVa
 
     bool sameDomainAccess = allowsAccessFromFrame(exec, frame);
 
-    const HashEntry* entry = JSLocation::s_info.propHashTable->entry(propertyName);
+    const HashEntry* entry = JSLocation::s_info.propHashTable(exec)->entry(propertyName);
     if (!entry) {
         if (sameDomainAccess)
             JSObject::put(exec, propertyName, value);
index 7fbff25..bcde4c6 100644 (file)
@@ -35,7 +35,7 @@ namespace WebCore {
 
 using namespace KJS;
 
-const ClassInfo JSNamedNodesCollection::s_info = { "Collection", 0, 0 };
+const ClassInfo JSNamedNodesCollection::s_info = { "Collection", 0, 0, 0 };
 
 // Such a collection is usually very short-lived, it only exists
 // for constructs like document.forms.<name>[1],
index 208d632..8edc8ac 100644 (file)
@@ -32,7 +32,7 @@ using namespace KJS;
 
 namespace WebCore {
 
-const ClassInfo JSQuarantinedObjectWrapper::s_info = { "JSQuarantinedObjectWrapper", 0, 0 };
+const ClassInfo JSQuarantinedObjectWrapper::s_info = { "JSQuarantinedObjectWrapper", 0, 0, 0 };
 
 JSQuarantinedObjectWrapper* JSQuarantinedObjectWrapper::asWrapper(JSValue* value)
 {
index f081948..44f00a9 100644 (file)
@@ -32,7 +32,7 @@ using namespace KJS;
 
 namespace WebCore {
 
-const ClassInfo JSRGBColor::s_info = { "RGBColor", 0, &JSRGBColorTable };
+const ClassInfo JSRGBColor::s_info = { "RGBColor", 0, &JSRGBColorTable, 0 };
 
 /*
 @begin JSRGBColorTable 3
index da1265e..918c0e6 100644 (file)
@@ -63,7 +63,7 @@ bool JSStorage::customPut(ExecState* exec, const Identifier& propertyName, JSVal
     // Since hasProperty() would end up calling canGetItemsForName() and be fooled, we need to check
     // the native property slots manually.
     PropertySlot slot;
-    if (getStaticValueSlot<JSStorage, Base>(exec, s_info.propHashTable, this, propertyName, slot))
+    if (getStaticValueSlot<JSStorage, Base>(exec, s_info.propHashTable(exec), this, propertyName, slot))
         return false;
         
     JSValue* prototype = this->prototype();
index bfa20dd..4795258 100644 (file)
@@ -28,7 +28,7 @@ using namespace KJS;
 
 namespace WebCore {
 
-const ClassInfo JSXMLHttpRequestConstructor::s_info = { "XMLHttpRequestConstructor", 0, 0 };
+const ClassInfo JSXMLHttpRequestConstructor::s_info = { "XMLHttpRequestConstructor", 0, 0, 0 };
 
 JSXMLHttpRequestConstructor::JSXMLHttpRequestConstructor(ExecState* exec, Document* document)
     : DOMObject(exec->lexicalGlobalObject()->objectPrototype())
index 1255fe8..e2f40c7 100644 (file)
@@ -41,7 +41,7 @@ using namespace WebCore;
 
 namespace WebCore {
 
-const ClassInfo JSXSLTProcessor::s_info = { "XSLTProcessor", 0, 0 };
+const ClassInfo JSXSLTProcessor::s_info = { "XSLTProcessor", 0, 0, 0 };
 
 /*
 @begin JSXSLTProcessorPrototypeTable 7
@@ -186,7 +186,7 @@ JSValue* jsXSLTProcessorPrototypeFunctionReset(ExecState* exec, JSObject* thisOb
     return jsUndefined();
 }
 
-const ClassInfo JSXSLTProcessorConstructor::s_info = { "XSLTProcessorConsructor", 0, 0 };
+const ClassInfo JSXSLTProcessorConstructor::s_info = { "XSLTProcessorConsructor", 0, 0, 0 };
 
 JSXSLTProcessorConstructor::JSXSLTProcessorConstructor(ExecState* exec)
     : DOMObject(exec->lexicalGlobalObject()->objectPrototype())
index 03ba4a6..2b66995 100644 (file)
@@ -730,7 +730,7 @@ sub GenerateImplementation
                                \@hashKeys, \@hashValues,
                                \@hashSpecials, \@hashParameters);
 
-    push(@implContent, "const ClassInfo ${className}Prototype::s_info = { \"${visibleClassName}Prototype\", 0, &${className}PrototypeTable };\n\n");
+    push(@implContent, "const ClassInfo ${className}Prototype::s_info = { \"${visibleClassName}Prototype\", 0, &${className}PrototypeTable, 0 };\n\n");
     if ($dataNode->extendedAttributes->{"DoNotCache"}) {
         push(@implContent, "JSObject* ${className}Prototype::self()\n");
         push(@implContent, "{\n");
@@ -772,8 +772,9 @@ sub GenerateImplementation
     if ($numAttributes > 0) {
         push(@implContent, "&${className}Table ");
     } else {
-        push(@implContent, "0 ")
+        push(@implContent, "0 ");
     }
+    push(@implContent, ", 0 ");
     push(@implContent, "};\n\n");
 
     # Get correct pass/store types respecting PODType flag
@@ -1778,7 +1779,7 @@ EOF
 $implContent .= << "EOF";
 };
 
-const ClassInfo ${className}Constructor::s_info = { "${visibleClassName}Constructor", 0, &${className}ConstructorTable };
+const ClassInfo ${className}Constructor::s_info = { "${visibleClassName}Constructor", 0, &${className}ConstructorTable, 0 };
 
 bool ${className}Constructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
 {
index d5d95fa..7232e7d 100644 (file)
@@ -196,7 +196,7 @@ unsigned int ObjcArray::getLength() const
     return [_array.get() count];
 }
 
-const ClassInfo ObjcFallbackObjectImp::info = { "ObjcFallbackObject", 0, 0 };
+const ClassInfo ObjcFallbackObjectImp::info = { "ObjcFallbackObject", 0, 0, 0 };
 
 ObjcFallbackObjectImp::ObjcFallbackObjectImp(ObjcInstance* i, const KJS::Identifier propertyName)
 : _instance(i)
index b1ad588..2dea92b 100644 (file)
@@ -30,7 +30,7 @@
 
 using namespace KJS;
 
-const ClassInfo RuntimeArray::s_info = { "RuntimeArray", &ArrayInstance::info, 0 };
+const ClassInfo RuntimeArray::s_info = { "RuntimeArray", &ArrayInstance::info, 0, 0 };
 
 RuntimeArray::RuntimeArray(ExecState *exec, Bindings::Array *a)
     : JSObject(exec->lexicalGlobalObject()->arrayPrototype())
index 3592ec1..5e61ca4 100644 (file)
@@ -32,7 +32,7 @@
 using namespace KJS;
 using namespace Bindings;
 
-const ClassInfo RuntimeObjectImp::s_info = { "RuntimeObject", 0, 0 };
+const ClassInfo RuntimeObjectImp::s_info = { "RuntimeObject", 0, 0, 0 };
 
 RuntimeObjectImp::RuntimeObjectImp(PassRefPtr<Bindings::Instance> i)
     : instance(i)
index 1acbc8c..9d0e54f 100644 (file)
@@ -1,3 +1,14 @@
+2008-04-25  Alexey Proskuryakov  <ap@webkit.org>
+
+        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
+
+        * WebView/WebView.mm: (-[WebViewPrivate init]): Initialize threading. Previously, this was
+        only done from icon database code, which is not robust enough.
+
 2008-04-20 Adam Barth <hk9565@gmail.com>
 
         Reviewed by Adam Roben and Sam Weinig.
index 46c2902..4d21e8a 100644 (file)
 #import <WebKit/DOMPrivate.h>
 #import <WebKit/WebDashboardRegion.h>
 #import <WebKitSystemInterface.h>
+#import <kjs/InitializeThreading.h>
 #import <mach-o/dyld.h>
 #import <objc/objc-auto.h>
 #import <objc/objc-runtime.h>
@@ -457,6 +458,7 @@ static BOOL grammarCheckingEnabled;
     self = [super init];
     if (!self)
         return nil;
+    KJS::initializeThreading();
     allowsUndo = YES;
     zoomMultiplier = 1;
     zoomMultiplierIsTextOnly = YES;
index 112c24a..c93818c 100644 (file)
@@ -1,3 +1,14 @@
+2008-04-25  Alexey Proskuryakov  <ap@webkit.org>
+
+        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
+
+        * WebView.cpp: (WebView::WebView): Initialize threading. Previously, this was only done from
+        icon database code, which is not robust enough.
+
 2008-04-26  Adam Barth <hk9565@gmail.com>
 
         Reviewed by Adam Roben and Sam Weinig.
index b6b936a..c254d4e 100644 (file)
@@ -94,6 +94,7 @@
 #include <WebCore/TypingCommand.h>
 #include <WebCore/WindowMessageBroadcaster.h>
 #pragma warning(pop)
+#include <kjs/InitializeThreading.h>
 #include <JavaScriptCore/value.h>
 #include <CFNetwork/CFURLCachePriv.h>
 #include <CFNetwork/CFURLProtocolPriv.h>
@@ -273,6 +274,8 @@ WebView::WebView()
 , m_topLevelParent(0)
 , m_deleteBackingStoreTimerActive(false)
 {
+    KJS::initializeThreading();
+
     m_backingStoreSize.cx = m_backingStoreSize.cy = 0;
 
     CoCreateInstance(CLSID_DragDropHelper, 0, CLSCTX_INPROC_SERVER, IID_IDropTargetHelper,(void**)&m_dropTargetHelper);
index d52d8da..3aa7470 100644 (file)
@@ -1,3 +1,19 @@
+2008-04-25  Alexey Proskuryakov  <ap@webkit.org>
+
+        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
+
+        * DumpRenderTree/pthreads/JavaScriptThreadingPthreads.cpp:
+        (runJavaScriptThread):
+        (startJavaScriptThreads):
+        (stopJavaScriptThreads):
+        Spawned threads were immediately detached, unlike the original ones, so joining them
+        made no sense. Now, all threads are created detached, and stopJavaScriptThreads() just
+        waits for them all to exit.
+
 2008-04-28  Holger Hans Peter Freyther  <zecke@selfish.org>
 
         Reviewed by Simon.
index 19f6dc2..11be1b9 100644 (file)
@@ -77,6 +77,7 @@ void* runJavaScriptThread(void* arg)
 
         // Check for cancellation.
         if (javaScriptThreadsShouldTerminate) {
+            javaScriptThreads()->remove(pthread_self());
             pthread_mutex_unlock(&javaScriptThreadsMutex);
             return 0;
         }
@@ -105,6 +106,7 @@ void startJavaScriptThreads()
     for (int i = 0; i < javaScriptThreadsCount; i++) {
         pthread_t pthread;
         pthread_create(&pthread, 0, &runJavaScriptThread, 0);
+        pthread_detach(pthread);
         javaScriptThreads()->add(pthread);
     }
 
@@ -121,9 +123,14 @@ void stopJavaScriptThreads()
 
     pthread_mutex_unlock(&javaScriptThreadsMutex);
 
-    ThreadSet::iterator end = javaScriptThreads()->end();
-    for (ThreadSet::iterator it = javaScriptThreads()->begin(); it != end; ++it) {
-        pthread_t pthread = *it;
-        pthread_join(pthread, 0);
+    while (true) {
+        pthread_mutex_lock(&javaScriptThreadsMutex);
+        int threadCount = javaScriptThreads()->size();
+        pthread_mutex_unlock(&javaScriptThreadsMutex);
+
+        if (!threadCount)
+            break;
+
+        usleep(1000);
     }
 }