Add ParentClass typedef in all JSC classes

https://bugs.webkit.org/show_bug.cgi?id=65731

Patch by Mark Hahnenberg <mhahnenberg@apple.com> on 2011-08-09
Reviewed by Oliver Hunt.

Source/JavaScriptCore:

Just added the Base typedefs in all the classes that are a subclass of JSCell
to point at their parent classes.  This is a change to support future changes to the way
constructors and destructors are implemented in JS objects, among other things.

* API/JSCallbackConstructor.h:
* API/JSCallbackFunction.h:
* API/JSCallbackObject.h:
(JSC::JSCallbackObject::createStructure):
(JSC::JSCallbackObject::visitChildren):
* API/JSCallbackObjectFunctions.h:
(JSC::::asCallbackObject):
(JSC::::JSCallbackObject):
(JSC::::init):
(JSC::::className):
(JSC::::getOwnPropertySlot):
(JSC::::getOwnPropertyDescriptor):
(JSC::::put):
(JSC::::deleteProperty):
(JSC::::getConstructData):
(JSC::::construct):
(JSC::::hasInstance):
(JSC::::getCallData):
(JSC::::call):
(JSC::::getOwnPropertyNames):
(JSC::::toNumber):
(JSC::::toString):
(JSC::::setPrivate):
(JSC::::getPrivate):
(JSC::::inherits):
(JSC::::getStaticValue):
(JSC::::staticFunctionGetter):
(JSC::::callbackGetter):
* debugger/DebuggerActivation.h:
* jsc.cpp:
* runtime/Arguments.h:
* runtime/ArrayConstructor.h:
* runtime/ArrayPrototype.h:
* runtime/BooleanConstructor.h:
* runtime/BooleanObject.h:
* runtime/BooleanPrototype.h:
* runtime/DateConstructor.h:
* runtime/DateInstance.h:
* runtime/DatePrototype.h:
* runtime/Error.cpp:
* runtime/ErrorConstructor.h:
* runtime/ErrorInstance.h:
* runtime/ErrorPrototype.h:
* runtime/ExceptionHelpers.cpp:
* runtime/Executable.h:
* runtime/FunctionConstructor.h:
* runtime/FunctionPrototype.h:
* runtime/GetterSetter.h:
* runtime/InternalFunction.h:
* runtime/JSAPIValueWrapper.h:
* runtime/JSActivation.h:
* runtime/JSArray.h:
* runtime/JSFunction.h:
* runtime/JSGlobalObject.h:
* runtime/JSNotAnObject.h:
* runtime/JSONObject.h:
* runtime/JSObject.h:
* runtime/JSPropertyNameIterator.h:
* runtime/JSStaticScopeObject.h:
* runtime/JSString.h:
* runtime/JSVariableObject.h:
* runtime/JSWrapperObject.h:
* runtime/MathObject.h:
* runtime/NativeErrorConstructor.h:
* runtime/NativeErrorPrototype.h:
* runtime/NumberConstructor.h:
* runtime/NumberObject.h:
* runtime/NumberPrototype.h:
* runtime/ObjectConstructor.h:
* runtime/ObjectPrototype.h:
* runtime/RegExp.h:
* runtime/RegExpConstructor.h:
* runtime/RegExpMatchesArray.h:
* runtime/RegExpObject.h:
(JSC::RegExpObject::create):
* runtime/RegExpPrototype.h:
* runtime/ScopeChain.h:
* runtime/StrictEvalActivation.h:
* runtime/StringConstructor.h:
* runtime/StringObject.h:
* runtime/StringObjectThatMasqueradesAsUndefined.h:
* runtime/StringPrototype.h:
* runtime/Structure.h:
* runtime/StructureChain.h:

Source/JavaScriptGlue:

Just added the Base typedefs in all the classes that are a subclass of JSCell
to point at their parent classes.  This is a change to support future changes to the way
constructors and destructors are implemented in JS objects, among other things.

* JSRun.h:
* UserObjectImp.h:

Source/WebCore:

No new tests.

Just added the Base typedefs in all the classes that are a subclass of JSCell
to point at their parent classes.  This is a change to support future changes to the way
constructors and destructors are implemented in JS objects, among other things.

* bindings/js/JSAudioConstructor.h:
* bindings/js/JSImageConstructor.h:
* bindings/js/JSOptionConstructor.h:
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateHeader):
(GenerateConstructorDeclaration):
* bindings/scripts/test/JS/JSTestInterface.cpp:
* bindings/scripts/test/JS/JSTestInterface.h:
* bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
* bindings/scripts/test/JS/JSTestMediaQueryListListener.h:
* bindings/scripts/test/JS/JSTestObj.cpp:
* bindings/scripts/test/JS/JSTestObj.h:
* bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
* bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.h:
* bridge/c/CRuntimeObject.h:
* bridge/c/c_instance.cpp:
* bridge/jni/jsc/JavaInstanceJSC.cpp:
* bridge/jni/jsc/JavaRuntimeObject.h:
* bridge/objc/ObjCRuntimeObject.h:
* bridge/objc/objc_runtime.h:
* bridge/qt/qt_instance.cpp:
* bridge/qt/qt_pixmapruntime.cpp:
* bridge/qt/qt_runtime.h:
* bridge/runtime_array.h:
* bridge/runtime_method.h:
* bridge/runtime_object.h:
* bridge/testqtbindings.cpp:
(Global::className):

Source/WebKit/mac:

Just added the Base typedefs in all the classes that are a subclass of JSCell
to point at their parent classes.  This is a change to support future changes to the way
constructors and destructors are implemented in JS objects, among other things.

* Plugins/Hosted/ProxyInstance.mm:
* Plugins/Hosted/ProxyRuntimeObject.h:

Source/WebKit2:

Just added the Base typedefs in all the classes that are a subclass of JSCell
to point at their parent classes.  This is a change to support future changes to the way
constructors and destructors are implemented in JS objects, among other things.

* WebProcess/Plugins/Netscape/JSNPMethod.h:
* WebProcess/Plugins/Netscape/JSNPObject.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@92706 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 37ba767f
......@@ -32,9 +32,9 @@
namespace JSC {
class JSCallbackConstructor : public JSObjectWithGlobalObject {
protected:
JSCallbackConstructor(JSGlobalObject*, Structure*, JSClassRef, JSObjectCallAsConstructorCallback);
public:
typedef JSObjectWithGlobalObject Base;
static JSCallbackConstructor* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, JSClassRef classRef, JSObjectCallAsConstructorCallback callback)
{
return new (allocateCell<JSCallbackConstructor>(*exec->heap())) JSCallbackConstructor(globalObject, structure, classRef, callback);
......@@ -51,6 +51,7 @@ public:
}
protected:
JSCallbackConstructor(JSGlobalObject*, Structure*, JSClassRef, JSObjectCallAsConstructorCallback);
static const unsigned StructureFlags = ImplementsHasInstance | JSObject::StructureFlags;
private:
......
......@@ -36,6 +36,8 @@ protected:
JSCallbackFunction(ExecState*, JSGlobalObject*, JSObjectCallAsFunctionCallback, const Identifier& name);
public:
typedef InternalFunction Base;
static JSCallbackFunction* create(ExecState* exec, JSGlobalObject* globalObject, JSObjectCallAsFunctionCallback callback, const Identifier& name)
{
return new (allocateCell<JSCallbackFunction>(*exec->heap())) JSCallbackFunction(exec, globalObject, callback, name);
......
......@@ -114,17 +114,19 @@ struct JSCallbackObjectData : WeakHandleOwner {
};
template <class Base>
class JSCallbackObject : public Base {
template <class Parent>
class JSCallbackObject : public Parent {
protected:
JSCallbackObject(ExecState*, JSGlobalObject*, Structure*, JSClassRef, void* data);
JSCallbackObject(JSGlobalData&, JSClassRef, Structure*);
// We'd like to use the placement version of operator new defined in JSCell, but
// we can't because Base is a template argument, so we just duplicate the same
// we can't because Parent is a template argument, so we just duplicate the same
// functionality here.
void* operator new(size_t, void* ptr) { return ptr; }
public:
typedef Parent Base;
static JSCallbackObject* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, JSClassRef classRef, void* data)
{
return new (allocateCell<JSCallbackObject>(*exec->heap())) JSCallbackObject(exec, globalObject, structure, classRef, data);
......@@ -144,7 +146,7 @@ public:
static Structure* createStructure(JSGlobalData& globalData, JSValue proto)
{
return Structure::create(globalData, proto, TypeInfo(ObjectType, StructureFlags), Base::AnonymousSlotCount, &s_info);
return Structure::create(globalData, proto, TypeInfo(ObjectType, StructureFlags), Parent::AnonymousSlotCount, &s_info);
}
JSValue getPrivateProperty(const Identifier& propertyName) const
......@@ -163,7 +165,7 @@ public:
}
protected:
static const unsigned StructureFlags = ProhibitsPropertyCaching | OverridesGetOwnPropertySlot | ImplementsHasInstance | OverridesHasInstance | OverridesVisitChildren | OverridesGetPropertyNames | Base::StructureFlags;
static const unsigned StructureFlags = ProhibitsPropertyCaching | OverridesGetOwnPropertySlot | ImplementsHasInstance | OverridesHasInstance | OverridesVisitChildren | OverridesGetPropertyNames | Parent::StructureFlags;
private:
virtual UString className() const;
......@@ -188,10 +190,10 @@ private:
virtual void visitChildren(SlotVisitor& visitor)
{
ASSERT_GC_OBJECT_INHERITS((static_cast<Base*>(this)), &JSCallbackObject<Base>::s_info);
ASSERT_GC_OBJECT_INHERITS((static_cast<Parent*>(this)), &JSCallbackObject<Parent>::s_info);
COMPILE_ASSERT(StructureFlags & OverridesVisitChildren, OverridesVisitChildrenWithoutSettingFlag);
ASSERT(Base::structure()->typeInfo().overridesVisitChildren());
Base::visitChildren(visitor);
ASSERT(Parent::structure()->typeInfo().overridesVisitChildren());
Parent::visitChildren(visitor);
m_callbackObjectData->visitChildren(visitor);
}
......
......@@ -42,36 +42,36 @@
namespace JSC {
template <class Base>
inline JSCallbackObject<Base>* JSCallbackObject<Base>::asCallbackObject(JSValue value)
template <class Parent>
inline JSCallbackObject<Parent>* JSCallbackObject<Parent>::asCallbackObject(JSValue value)
{
ASSERT(asObject(value)->inherits(&s_info));
return static_cast<JSCallbackObject*>(asObject(value));
}
template <class Base>
JSCallbackObject<Base>::JSCallbackObject(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, JSClassRef jsClass, void* data)
: Base(globalObject, structure)
template <class Parent>
JSCallbackObject<Parent>::JSCallbackObject(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, JSClassRef jsClass, void* data)
: Parent(globalObject, structure)
, m_callbackObjectData(adoptPtr(new JSCallbackObjectData(data, jsClass)))
{
ASSERT(Base::inherits(&s_info));
ASSERT(Parent::inherits(&s_info));
init(exec);
}
// Global object constructor.
// FIXME: Move this into a separate JSGlobalCallbackObject class derived from this one.
template <class Base>
JSCallbackObject<Base>::JSCallbackObject(JSGlobalData& globalData, JSClassRef jsClass, Structure* structure)
: Base(globalData, structure)
template <class Parent>
JSCallbackObject<Parent>::JSCallbackObject(JSGlobalData& globalData, JSClassRef jsClass, Structure* structure)
: Parent(globalData, structure)
, m_callbackObjectData(adoptPtr(new JSCallbackObjectData(0, jsClass)))
{
ASSERT(Base::inherits(&s_info));
ASSERT(Base::isGlobalObject());
ASSERT(Parent::inherits(&s_info));
ASSERT(Parent::isGlobalObject());
init(static_cast<JSGlobalObject*>(this)->globalExec());
}
template <class Base>
void JSCallbackObject<Base>::init(ExecState* exec)
template <class Parent>
void JSCallbackObject<Parent>::init(ExecState* exec)
{
ASSERT(exec);
......@@ -100,18 +100,18 @@ void JSCallbackObject<Base>::init(ExecState* exec)
}
}
template <class Base>
UString JSCallbackObject<Base>::className() const
template <class Parent>
UString JSCallbackObject<Parent>::className() const
{
UString thisClassName = classRef()->className();
if (!thisClassName.isEmpty())
return thisClassName;
return Base::className();
return Parent::className();
}
template <class Base>
bool JSCallbackObject<Base>::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
template <class Parent>
bool JSCallbackObject<Parent>::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
{
JSContextRef ctx = toRef(exec);
JSObjectRef thisRef = toRef(this);
......@@ -165,11 +165,11 @@ bool JSCallbackObject<Base>::getOwnPropertySlot(ExecState* exec, const Identifie
}
}
return Base::getOwnPropertySlot(exec, propertyName, slot);
return Parent::getOwnPropertySlot(exec, propertyName, slot);
}
template <class Base>
bool JSCallbackObject<Base>::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
template <class Parent>
bool JSCallbackObject<Parent>::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
{
PropertySlot slot;
if (getOwnPropertySlot(exec, propertyName, slot)) {
......@@ -184,11 +184,11 @@ bool JSCallbackObject<Base>::getOwnPropertyDescriptor(ExecState* exec, const Ide
return true;
}
return Base::getOwnPropertyDescriptor(exec, propertyName, descriptor);
return Parent::getOwnPropertyDescriptor(exec, propertyName, descriptor);
}
template <class Base>
void JSCallbackObject<Base>::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot)
template <class Parent>
void JSCallbackObject<Parent>::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot)
{
JSContextRef ctx = toRef(exec);
JSObjectRef thisRef = toRef(this);
......@@ -236,17 +236,17 @@ void JSCallbackObject<Base>::put(ExecState* exec, const Identifier& propertyName
if (StaticFunctionEntry* entry = staticFunctions->get(propertyName.impl())) {
if (entry->attributes & kJSPropertyAttributeReadOnly)
return;
JSCallbackObject<Base>::putDirect(exec->globalData(), propertyName, value); // put as override property
JSCallbackObject<Parent>::putDirect(exec->globalData(), propertyName, value); // put as override property
return;
}
}
}
return Base::put(exec, propertyName, value, slot);
return Parent::put(exec, propertyName, value, slot);
}
template <class Base>
bool JSCallbackObject<Base>::deleteProperty(ExecState* exec, const Identifier& propertyName)
template <class Parent>
bool JSCallbackObject<Parent>::deleteProperty(ExecState* exec, const Identifier& propertyName)
{
JSContextRef ctx = toRef(exec);
JSObjectRef thisRef = toRef(this);
......@@ -285,17 +285,17 @@ bool JSCallbackObject<Base>::deleteProperty(ExecState* exec, const Identifier& p
}
}
return Base::deleteProperty(exec, propertyName);
return Parent::deleteProperty(exec, propertyName);
}
template <class Base>
bool JSCallbackObject<Base>::deleteProperty(ExecState* exec, unsigned propertyName)
template <class Parent>
bool JSCallbackObject<Parent>::deleteProperty(ExecState* exec, unsigned propertyName)
{
return deleteProperty(exec, Identifier::from(exec, propertyName));
}
template <class Base>
ConstructType JSCallbackObject<Base>::getConstructData(ConstructData& constructData)
template <class Parent>
ConstructType JSCallbackObject<Parent>::getConstructData(ConstructData& constructData)
{
for (JSClassRef jsClass = classRef(); jsClass; jsClass = jsClass->parentClass) {
if (jsClass->callAsConstructor) {
......@@ -306,14 +306,14 @@ ConstructType JSCallbackObject<Base>::getConstructData(ConstructData& constructD
return ConstructTypeNone;
}
template <class Base>
EncodedJSValue JSCallbackObject<Base>::construct(ExecState* exec)
template <class Parent>
EncodedJSValue JSCallbackObject<Parent>::construct(ExecState* exec)
{
JSObject* constructor = exec->callee();
JSContextRef execRef = toRef(exec);
JSObjectRef constructorRef = toRef(constructor);
for (JSClassRef jsClass = static_cast<JSCallbackObject<Base>*>(constructor)->classRef(); jsClass; jsClass = jsClass->parentClass) {
for (JSClassRef jsClass = static_cast<JSCallbackObject<Parent>*>(constructor)->classRef(); jsClass; jsClass = jsClass->parentClass) {
if (JSObjectCallAsConstructorCallback callAsConstructor = jsClass->callAsConstructor) {
int argumentCount = static_cast<int>(exec->argumentCount());
Vector<JSValueRef, 16> arguments(argumentCount);
......@@ -335,8 +335,8 @@ EncodedJSValue JSCallbackObject<Base>::construct(ExecState* exec)
return JSValue::encode(JSValue());
}
template <class Base>
bool JSCallbackObject<Base>::hasInstance(ExecState* exec, JSValue value, JSValue)
template <class Parent>
bool JSCallbackObject<Parent>::hasInstance(ExecState* exec, JSValue value, JSValue)
{
JSContextRef execRef = toRef(exec);
JSObjectRef thisRef = toRef(this);
......@@ -358,8 +358,8 @@ bool JSCallbackObject<Base>::hasInstance(ExecState* exec, JSValue value, JSValue
return false;
}
template <class Base>
CallType JSCallbackObject<Base>::getCallData(CallData& callData)
template <class Parent>
CallType JSCallbackObject<Parent>::getCallData(CallData& callData)
{
for (JSClassRef jsClass = classRef(); jsClass; jsClass = jsClass->parentClass) {
if (jsClass->callAsFunction) {
......@@ -370,14 +370,14 @@ CallType JSCallbackObject<Base>::getCallData(CallData& callData)
return CallTypeNone;
}
template <class Base>
EncodedJSValue JSCallbackObject<Base>::call(ExecState* exec)
template <class Parent>
EncodedJSValue JSCallbackObject<Parent>::call(ExecState* exec)
{
JSContextRef execRef = toRef(exec);
JSObjectRef functionRef = toRef(exec->callee());
JSObjectRef thisObjRef = toRef(exec->hostThisValue().toThisObject(exec));
for (JSClassRef jsClass = static_cast<JSCallbackObject<Base>*>(toJS(functionRef))->classRef(); jsClass; jsClass = jsClass->parentClass) {
for (JSClassRef jsClass = static_cast<JSCallbackObject<Parent>*>(toJS(functionRef))->classRef(); jsClass; jsClass = jsClass->parentClass) {
if (JSObjectCallAsFunctionCallback callAsFunction = jsClass->callAsFunction) {
int argumentCount = static_cast<int>(exec->argumentCount());
Vector<JSValueRef, 16> arguments(argumentCount);
......@@ -399,8 +399,8 @@ EncodedJSValue JSCallbackObject<Base>::call(ExecState* exec)
return JSValue::encode(JSValue());
}
template <class Base>
void JSCallbackObject<Base>::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)
template <class Parent>
void JSCallbackObject<Parent>::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)
{
JSContextRef execRef = toRef(exec);
JSObjectRef thisRef = toRef(this);
......@@ -434,11 +434,11 @@ void JSCallbackObject<Base>::getOwnPropertyNames(ExecState* exec, PropertyNameAr
}
}
Base::getOwnPropertyNames(exec, propertyNames, mode);
Parent::getOwnPropertyNames(exec, propertyNames, mode);
}
template <class Base>
double JSCallbackObject<Base>::toNumber(ExecState* exec) const
template <class Parent>
double JSCallbackObject<Parent>::toNumber(ExecState* exec) const
{
// We need this check to guard against the case where this object is rhs of
// a binary expression where lhs threw an exception in its conversion to
......@@ -466,11 +466,11 @@ double JSCallbackObject<Base>::toNumber(ExecState* exec) const
return toJS(exec, value).getNumber(dValue) ? dValue : std::numeric_limits<double>::quiet_NaN();
}
return Base::toNumber(exec);
return Parent::toNumber(exec);
}
template <class Base>
UString JSCallbackObject<Base>::toString(ExecState* exec) const
template <class Parent>
UString JSCallbackObject<Parent>::toString(ExecState* exec) const
{
JSContextRef ctx = toRef(exec);
JSObjectRef thisRef = toRef(this);
......@@ -491,23 +491,23 @@ UString JSCallbackObject<Base>::toString(ExecState* exec) const
return toJS(exec, value).getString(exec);
}
return Base::toString(exec);
return Parent::toString(exec);
}
template <class Base>
void JSCallbackObject<Base>::setPrivate(void* data)
template <class Parent>
void JSCallbackObject<Parent>::setPrivate(void* data)
{
m_callbackObjectData->privateData = data;
}
template <class Base>
void* JSCallbackObject<Base>::getPrivate()
template <class Parent>
void* JSCallbackObject<Parent>::getPrivate()
{
return m_callbackObjectData->privateData;
}
template <class Base>
bool JSCallbackObject<Base>::inherits(JSClassRef c) const
template <class Parent>
bool JSCallbackObject<Parent>::inherits(JSClassRef c) const
{
for (JSClassRef jsClass = classRef(); jsClass; jsClass = jsClass->parentClass)
if (jsClass == c)
......@@ -516,8 +516,8 @@ bool JSCallbackObject<Base>::inherits(JSClassRef c) const
return false;
}
template <class Base>
JSValue JSCallbackObject<Base>::getStaticValue(ExecState* exec, const Identifier& propertyName)
template <class Parent>
JSValue JSCallbackObject<Parent>::getStaticValue(ExecState* exec, const Identifier& propertyName)
{
JSObjectRef thisRef = toRef(this);
RefPtr<OpaqueJSString> propertyNameRef;
......@@ -545,14 +545,14 @@ JSValue JSCallbackObject<Base>::getStaticValue(ExecState* exec, const Identifier
return JSValue();
}
template <class Base>
JSValue JSCallbackObject<Base>::staticFunctionGetter(ExecState* exec, JSValue slotBase, const Identifier& propertyName)
template <class Parent>
JSValue JSCallbackObject<Parent>::staticFunctionGetter(ExecState* exec, JSValue slotParent, const Identifier& propertyName)
{
JSCallbackObject* thisObj = asCallbackObject(slotBase);
JSCallbackObject* thisObj = asCallbackObject(slotParent);
// Check for cached or override property.
PropertySlot slot2(thisObj);
if (thisObj->Base::getOwnPropertySlot(exec, propertyName, slot2))
if (thisObj->Parent::getOwnPropertySlot(exec, propertyName, slot2))
return slot2.getValue(exec, propertyName);
for (JSClassRef jsClass = thisObj->classRef(); jsClass; jsClass = jsClass->parentClass) {
......@@ -571,10 +571,10 @@ JSValue JSCallbackObject<Base>::staticFunctionGetter(ExecState* exec, JSValue sl
return throwError(exec, createReferenceError(exec, "Static function property defined with NULL callAsFunction callback."));
}
template <class Base>
JSValue JSCallbackObject<Base>::callbackGetter(ExecState* exec, JSValue slotBase, const Identifier& propertyName)
template <class Parent>
JSValue JSCallbackObject<Parent>::callbackGetter(ExecState* exec, JSValue slotParent, const Identifier& propertyName)
{
JSCallbackObject* thisObj = asCallbackObject(slotBase);
JSCallbackObject* thisObj = asCallbackObject(slotParent);
JSObjectRef thisRef = toRef(thisObj);
RefPtr<OpaqueJSString> propertyNameRef;
......
2011-08-09 Mark Hahnenberg <mhahnenberg@apple.com>
Add ParentClass typedef in all JSC classes
https://bugs.webkit.org/show_bug.cgi?id=65731
Reviewed by Oliver Hunt.
Just added the Base typedefs in all the classes that are a subclass of JSCell
to point at their parent classes. This is a change to support future changes to the way
constructors and destructors are implemented in JS objects, among other things.
* API/JSCallbackConstructor.h:
* API/JSCallbackFunction.h:
* API/JSCallbackObject.h:
(JSC::JSCallbackObject::createStructure):
(JSC::JSCallbackObject::visitChildren):
* API/JSCallbackObjectFunctions.h:
(JSC::::asCallbackObject):
(JSC::::JSCallbackObject):
(JSC::::init):
(JSC::::className):
(JSC::::getOwnPropertySlot):
(JSC::::getOwnPropertyDescriptor):
(JSC::::put):
(JSC::::deleteProperty):
(JSC::::getConstructData):
(JSC::::construct):
(JSC::::hasInstance):
(JSC::::getCallData):
(JSC::::call):
(JSC::::getOwnPropertyNames):
(JSC::::toNumber):
(JSC::::toString):
(JSC::::setPrivate):
(JSC::::getPrivate):
(JSC::::inherits):
(JSC::::getStaticValue):
(JSC::::staticFunctionGetter):
(JSC::::callbackGetter):
* debugger/DebuggerActivation.h:
* jsc.cpp:
* runtime/Arguments.h:
* runtime/ArrayConstructor.h:
* runtime/ArrayPrototype.h:
* runtime/BooleanConstructor.h:
* runtime/BooleanObject.h:
* runtime/BooleanPrototype.h:
* runtime/DateConstructor.h:
* runtime/DateInstance.h:
* runtime/DatePrototype.h:
* runtime/Error.cpp:
* runtime/ErrorConstructor.h:
* runtime/ErrorInstance.h:
* runtime/ErrorPrototype.h:
* runtime/ExceptionHelpers.cpp:
* runtime/Executable.h:
* runtime/FunctionConstructor.h:
* runtime/FunctionPrototype.h:
* runtime/GetterSetter.h:
* runtime/InternalFunction.h:
* runtime/JSAPIValueWrapper.h:
* runtime/JSActivation.h:
* runtime/JSArray.h:
* runtime/JSFunction.h:
* runtime/JSGlobalObject.h:
* runtime/JSNotAnObject.h:
* runtime/JSONObject.h:
* runtime/JSObject.h:
* runtime/JSPropertyNameIterator.h:
* runtime/JSStaticScopeObject.h:
* runtime/JSString.h:
* runtime/JSVariableObject.h:
* runtime/JSWrapperObject.h:
* runtime/MathObject.h:
* runtime/NativeErrorConstructor.h:
* runtime/NativeErrorPrototype.h:
* runtime/NumberConstructor.h:
* runtime/NumberObject.h:
* runtime/NumberPrototype.h:
* runtime/ObjectConstructor.h:
* runtime/ObjectPrototype.h:
* runtime/RegExp.h:
* runtime/RegExpConstructor.h:
* runtime/RegExpMatchesArray.h:
* runtime/RegExpObject.h:
(JSC::RegExpObject::create):
* runtime/RegExpPrototype.h:
* runtime/ScopeChain.h:
* runtime/StrictEvalActivation.h:
* runtime/StringConstructor.h:
* runtime/StringObject.h:
* runtime/StringObjectThatMasqueradesAsUndefined.h:
* runtime/StringPrototype.h:
* runtime/Structure.h:
* runtime/StructureChain.h:
2011-08-08 Oliver Hunt <oliver@apple.com>
Using mprotect to create guard pages breaks our use of madvise to release executable memory
......
......@@ -34,6 +34,8 @@ namespace JSC {
class DebuggerActivation : public JSNonFinalObject {
public:
typedef JSNonFinalObject Base;
static DebuggerActivation* create(JSGlobalData& globalData, JSObject* object)
{
return new (allocateCell<DebuggerActivation>(globalData.heap)) DebuggerActivation(globalData, object);
......
......@@ -148,6 +148,8 @@ private:
GlobalObject(JSGlobalData&, Structure*, const Vector<UString>& arguments);
public:
typedef JSGlobalObject Base;
static GlobalObject* create(JSGlobalData& globalData, Structure* structure, const Vector<UString>& arguments)
{
return new (allocateCell<GlobalObject>(globalData.heap)) GlobalObject(globalData, structure, arguments);
......
......@@ -59,6 +59,8 @@ namespace JSC {
class Arguments : public JSNonFinalObject {
public:
typedef JSNonFinalObject Base;
static Arguments* create(JSGlobalData& globalData, CallFrame* callFrame)
{
return new (allocateCell<Arguments>(globalData.heap)) Arguments(callFrame);
......
......@@ -28,10 +28,9 @@ namespace JSC {
class ArrayPrototype;
class ArrayConstructor : public InternalFunction {
private:
ArrayConstructor(ExecState*, JSGlobalObject*, Structure*, ArrayPrototype*);
public:
typedef InternalFunction Base;
static ArrayConstructor* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, ArrayPrototype* arrPrototype)
{
return new (allocateCell<ArrayConstructor>(*exec->heap())) ArrayConstructor(exec, globalObject, structure, arrPrototype);
......@@ -48,6 +47,7 @@ namespace JSC {
static const unsigned StructureFlags = OverridesGetOwnPropertySlot | InternalFunction::StructureFlags;
private:
ArrayConstructor(ExecState*, JSGlobalObject*, Structure*, ArrayPrototype*);
virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
......
......@@ -31,6 +31,8 @@ namespace JSC {
ArrayPrototype(JSGlobalObject*, Structure*);
public:
typedef JSArray Base;
static ArrayPrototype* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure)
{
return new (allocateCell<ArrayPrototype>(*exec->heap())) ArrayPrototype(globalObject, structure);
......
......@@ -28,16 +28,16 @@ namespace JSC {
class BooleanPrototype;
class BooleanConstructor : public InternalFunction {
private:
BooleanConstructor(ExecState*, JSGlobalObject*, Structure*, BooleanPrototype*);
public:
typedef InternalFunction Base;
static BooleanConstructor* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, BooleanPrototype* boolPrototype)
{
return new (allocateCell<BooleanConstructor>(*