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())
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)
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);
+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.
__ZN3KJS14JSGlobalObject17startTimeoutCheckEv
__ZN3KJS14JSGlobalObject18getOwnPropertySlotEPNS_9ExecStateERKNS_10IdentifierERNS_12PropertySlotE
__ZN3KJS14JSGlobalObject3putEPNS_9ExecStateERKNS_10IdentifierEPNS_7JSValueE
-__ZN3KJS14JSGlobalObject4initEv
+__ZN3KJS14JSGlobalObject4initEPNS_8JSObjectE
__ZN3KJS14JSGlobalObject4markEv
__ZN3KJS14JSGlobalObject5resetEPNS_7JSValueE
__ZN3KJS14JSGlobalObjectD2Ev
__ZN3KJS14StringInstanceC1EPNS_8JSObjectERKNS_7UStringE
__ZN3KJS14StringInstanceC2EPNS_8JSObjectERKNS_7UStringE
__ZN3KJS15GlobalExecStateC1EPNS_14JSGlobalObjectEPNS_8JSObjectE
+__ZN3KJS15GlobalExecStateD1Ev
__ZN3KJS15JSWrapperObject4markEv
__ZN3KJS16JSVariableObject14deletePropertyEPNS_9ExecStateERKNS_10IdentifierE
__ZN3KJS16JSVariableObject16getPropertyNamesEPNS_9ExecStateERNS_17PropertyNameArrayE
__ZNK3KJS14JSGlobalObject14isDynamicScopeEv
__ZNK3KJS14JSGlobalObject14toGlobalObjectEPNS_9ExecStateE
__ZNK3KJS16JSVariableObject16isVariableObjectEv
-__ZNK3KJS16JSVariableObject21getPropertyAttributesERKNS_10IdentifierERj
+__ZNK3KJS16JSVariableObject21getPropertyAttributesEPNS_9ExecStateERKNS_10IdentifierERj
__ZNK3KJS19InternalFunctionImp14implementsCallEv
__ZNK3KJS19InternalFunctionImp21implementsHasInstanceEv
__ZNK3KJS4List8getSliceEiRS0_
__ZNK3KJS8JSObject14implementsCallEv
__ZNK3KJS8JSObject14toGlobalObjectEPNS_9ExecStateE
__ZNK3KJS8JSObject19implementsConstructEv
-__ZNK3KJS8JSObject21getPropertyAttributesERKNS_10IdentifierERj
+__ZNK3KJS8JSObject21getPropertyAttributesEPNS_9ExecStateERKNS_10IdentifierERj
__ZNK3KJS8JSObject21implementsHasInstanceEv
__ZNK3KJS8JSObject3getEPNS_9ExecStateERKNS_10IdentifierE
__ZNK3KJS8JSObject3getEPNS_9ExecStateEj
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)
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)
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)
class FunctionBodyNode;
class FunctionImp;
class GlobalFuncImp;
+ struct HashTable;
class Interpreter;
class JSGlobalObject;
class JSVariableObject;
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 {
// 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; }
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;
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)
#include "DateMath.h"
#include "dtoa.h"
#include "identifier.h"
+#include "JSGlobalObject.h"
#include "lexer.h"
#include "Parser.h"
#include "ustring.h"
CommonIdentifiers::shared();
lexer();
initDateMath();
+ JSGlobalObject::threadClassInfoHashTables();
}
#endif
}
#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;
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());
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());
d()->evalFunction = 0;
- ExecState* exec = &d()->globalExec;
+ ExecState* exec = d()->globalExec.get();
// Prototypes
d()->functionPrototype = new FunctionPrototype(exec);
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);
ExecState* JSGlobalObject::globalExec()
{
- return &d()->globalExec;
+ return d()->globalExec.get();
}
void JSGlobalObject::tearOffActivation(ExecState* exec, bool leaveRelic)
return true;
}
+
} // namespace KJS
class EvalErrorPrototype;
class FunctionObjectImp;
class FunctionPrototype;
+ struct HashTable;
class JSGlobalObject;
class NativeErrorImp;
class NativeErrorPrototype;
class UriError;
class UriErrorPrototype;
struct ActivationStackNode;
+ struct ThreadClassInfoHashTables;
typedef Vector<ExecState*, 16> ExecStateStack;
using JSVariableObject::JSVariableObjectData;
struct JSGlobalObjectData : public JSVariableObjectData {
- JSGlobalObjectData(JSGlobalObject* globalObject, JSObject* thisValue)
+ JSGlobalObjectData()
: JSVariableObjectData(&inlineSymbolTable)
- , globalExec(globalObject, thisValue)
{
}
Debugger* debugger;
- GlobalExecState globalExec;
+ OwnPtr<GlobalExecState> globalExec;
int recursion;
unsigned timeoutTime;
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:
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); }
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()
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
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)
{
// ------------------------------ 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
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);
}
// ------------------------------ BooleanInstance ---------------------------
-const ClassInfo BooleanInstance::info = { "Boolean", 0, 0 };
+const ClassInfo BooleanInstance::info = { "Boolean", 0, 0, 0 };
BooleanInstance::BooleanInstance(JSObject* proto)
: JSWrapperObject(proto)
}
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";
}
// ------------------------------ DateInstance ------------------------------
-const ClassInfo DateInstance::info = {"Date", 0, 0};
+const ClassInfo DateInstance::info = {"Date", 0, 0, 0};
DateInstance::DateInstance(JSObject *proto)
: JSWrapperObject(proto)
// ------------------------------ 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.
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 --------------------------------
: 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);
}
// ------------------------------ ErrorInstance ----------------------------
-const ClassInfo ErrorInstance::info = { "Error", 0, 0 };
+const ClassInfo ErrorInstance::info = { "Error", 0, 0, 0 };
ErrorInstance::ErrorInstance(JSObject* prototype)
: JSObject(prototype)
// ------------------------------ 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()))
// ----------------------------- 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)
// ------------------------------ 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)
// ------------------------------ ActivationImp --------------------------------
-const ClassInfo ActivationImp::info = { "Activation", 0, 0 };
+const ClassInfo ActivationImp::info = { "Activation", 0, 0, 0 };
ActivationImp::ActivationImp(const ActivationData& oldData, bool leaveRelic)
{
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
// ------------------------------ InternalFunctionImp --------------------------
-const ClassInfo InternalFunctionImp::info = { "Function", 0, 0 };
+const ClassInfo InternalFunctionImp::info = { "Function", 0, 0, 0 };
InternalFunctionImp::InternalFunctionImp()
{
, next1(0)
, next2(0)
, next3(0)
+ , mainTable(KJS::mainTable)
{
m_buffer8.reserveCapacity(initialReadBufferCapacity);
m_buffer16.reserveCapacity(initialReadBufferCapacity);
m_identifiers.reserveCapacity(initialStringTableCapacity);
}
+Lexer::~Lexer()
+{
+ delete[] mainTable.table;
+}
+
void Lexer::setCode(int startingLineNumber, const UChar* c, unsigned int len)
{
yylineno = 1 + startingLineNumber;
#ifndef Lexer_h
#define Lexer_h
+#include "lookup.h"
#include "ustring.h"
#include <wtf/Vector.h>
friend Lexer& lexer();
friend class WTF::ThreadSpecific<Lexer>;
Lexer();
+ ~Lexer();
int yylineno;
bool done;
UString m_pattern;
UString m_flags;
+
+ const HashTable mainTable;
};
Lexer& lexer(); // Returns the singletone JavaScript lexer.
};
#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]]")); \
// ------------------------------ 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
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
// ------------------------------ NumberInstance ----------------------------
-const ClassInfo NumberInstance::info = { "Number", 0, 0 };
+const ClassInfo NumberInstance::info = { "Number", 0, 0, 0 };
NumberInstance::NumberInstance(JSObject* proto)
: JSWrapperObject(proto)
// ------------------------------ 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
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
#include "date_object.h"
#include "error_object.h"
-#include "lookup.h"
#include "nodes.h"
#include "operations.h"
#include "PropertyNameArray.h"
}
// 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);
}
// 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?
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;
}
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;
// 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)
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
* 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()
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; }
PropertyMap _prop;
private:
- const HashEntry* findPropertyHashEntry( const Identifier& propertyName ) const;
+ const HashEntry* findPropertyHashEntry(ExecState*, const Identifier& propertyName) const;
JSValue *_proto;
};
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);
}
// 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);
}
// ------------------------------ 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
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
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)
// ------------------------------ 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
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
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)
// ------------------------------ StringInstance ----------------------------
-const ClassInfo StringInstance::info = { "String", 0, 0 };
+const ClassInfo StringInstance::info = { "String", 0, 0, 0 };
StringInstance::StringInstance(JSObject *proto)
: JSWrapperObject(proto)
}
// ------------------------------ 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
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 --------------------------
+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.
#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())
+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
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())
////////////////////// JSDOMWindowBase Object ////////////////////////
-const ClassInfo JSDOMWindowBase::s_info = { "Window", 0, &JSDOMWindowBaseTable };
+const ClassInfo JSDOMWindowBase::s_info = { "Window", 0, &JSDOMWindowBaseTable, 0 };
/*
@begin JSDOMWindowBaseTable 118
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;
// 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
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())
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)
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);
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;
}
};
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())
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())
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)
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())
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)
{
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)
{
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
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);
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],
namespace WebCore {
-const ClassInfo JSQuarantinedObjectWrapper::s_info = { "JSQuarantinedObjectWrapper", 0, 0 };
+const ClassInfo JSQuarantinedObjectWrapper::s_info = { "JSQuarantinedObjectWrapper", 0, 0, 0 };
JSQuarantinedObjectWrapper* JSQuarantinedObjectWrapper::asWrapper(JSValue* value)
{
namespace WebCore {
-const ClassInfo JSRGBColor::s_info = { "RGBColor", 0, &JSRGBColorTable };
+const ClassInfo JSRGBColor::s_info = { "RGBColor", 0, &JSRGBColorTable, 0 };
/*
@begin JSRGBColorTable 3
// 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();
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())
namespace WebCore {
-const ClassInfo JSXSLTProcessor::s_info = { "XSLTProcessor", 0, 0 };
+const ClassInfo JSXSLTProcessor::s_info = { "XSLTProcessor", 0, 0, 0 };
/*
@begin JSXSLTProcessorPrototypeTable 7
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())
\@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");
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
$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)
{
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)
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())
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)
+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.
#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>
self = [super init];
if (!self)
return nil;
+ KJS::initializeThreading();
allowsUndo = YES;
zoomMultiplier = 1;
zoomMultiplierIsTextOnly = YES;
+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.
#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>
, 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);
+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.
// Check for cancellation.
if (javaScriptThreadsShouldTerminate) {
+ javaScriptThreads()->remove(pthread_self());
pthread_mutex_unlock(&javaScriptThreadsMutex);
return 0;
}
for (int i = 0; i < javaScriptThreadsCount; i++) {
pthread_t pthread;
pthread_create(&pthread, 0, &runJavaScriptThread, 0);
+ pthread_detach(pthread);
javaScriptThreads()->add(pthread);
}
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);
}
}