Commit 737a158c authored by barraclough@apple.com's avatar barraclough@apple.com

Bug 54894 - Make inheritance structure described by ClassInfo match C++ class hierarchy.

Reviewed by Sam Weinig.

The ClassInfo objects describe an inheritance hierarchy, with each ClassInfo instance
containing a pointer to its parent class. These links should reflect the inheritance
hierarchy of C++ classes below JSObject. For the large part it does, but in some cases
entries in the C++ hierarchy are skipped over. This presently likely doesn't matter,
since intervening C++ classes may not have ClassInfo - but would be a potential bug
were ClassInfo were to be added.

Source/JavaScriptCore: 

* API/JSCallbackConstructor.cpp:
* API/JSCallbackFunction.cpp:
* API/JSCallbackObjectFunctions.h:
* runtime/Arguments.h:
* runtime/ArrayPrototype.cpp:
* runtime/BooleanObject.cpp:
* runtime/DateInstance.cpp:
* runtime/DatePrototype.cpp:
* runtime/ErrorInstance.cpp:
* runtime/InternalFunction.cpp:
* runtime/JSActivation.cpp:
* runtime/JSArray.cpp:
* runtime/JSFunction.cpp:
* runtime/JSONObject.cpp:
* runtime/JSObject.h:
* runtime/JSZombie.h:
* runtime/MathObject.cpp:
* runtime/NativeErrorConstructor.cpp:
* runtime/NumberConstructor.cpp:
* runtime/NumberObject.cpp:
* runtime/RegExpConstructor.cpp:
* runtime/RegExpObject.cpp:
* runtime/StringObject.cpp:
* runtime/StringPrototype.cpp:

Source/WebCore: 

* bindings/js/JSAudioConstructor.cpp:
* bindings/js/JSDOMGlobalObject.cpp:
* bindings/js/JSImageConstructor.cpp:
* bindings/js/JSOptionConstructor.cpp:
* bindings/scripts/CodeGeneratorJS.pm:
* bridge/objc/objc_runtime.mm:
* bridge/runtime_object.cpp:

Source/WebKit2: 

* WebProcess/Plugins/Netscape/JSNPObject.cpp:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@79240 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent a3f96aa8
......@@ -43,6 +43,7 @@ JSCallbackConstructor::JSCallbackConstructor(JSGlobalObject* globalObject, NonNu
, m_class(jsClass)
, m_callback(callback)
{
ASSERT(inherits(&s_info));
if (m_class)
JSClassRetain(jsClass);
}
......
......@@ -46,6 +46,7 @@ JSCallbackFunction::JSCallbackFunction(ExecState* exec, JSGlobalObject* globalOb
: InternalFunction(&exec->globalData(), globalObject, globalObject->callbackFunctionStructure(), name)
, m_callback(callback)
{
ASSERT(inherits(&s_info));
}
EncodedJSValue JSCallbackFunction::call(ExecState* exec)
......
......@@ -54,6 +54,7 @@ JSCallbackObject<Base>::JSCallbackObject(ExecState* exec, JSGlobalObject* global
: Base(globalObject, structure)
, m_callbackObjectData(adoptPtr(new JSCallbackObjectData(data, jsClass)))
{
ASSERT(Base::inherits(&s_info));
init(exec);
}
......@@ -64,6 +65,7 @@ JSCallbackObject<Base>::JSCallbackObject(JSClassRef jsClass, NonNullPassRefPtr<S
: Base(structure)
, m_callbackObjectData(adoptPtr(new JSCallbackObjectData(0, jsClass)))
{
ASSERT(Base::inherits(&s_info));
ASSERT(Base::isGlobalObject());
init(static_cast<JSGlobalObject*>(this)->globalExec());
}
......
2011-02-21 Gavin Barraclough <barraclough@apple.com>
Reviewed by Sam Weinig.
Bug 54894 - Make inheritance structure described by ClassInfo match C++ class hierarchy.
The ClassInfo objects describe an inheritance hierarchy, with each ClassInfo instance
containing a pointer to its parent class. These links should reflect the inheritance
hierarchy of C++ classes below JSObject. For the large part it does, but in some cases
entries in the C++ hierarchy are skipped over. This presently likely doesn't matter,
since intervening C++ classes may not have ClassInfo - but would be a potential bug
were ClassInfo were to be added.
* API/JSCallbackConstructor.cpp:
* API/JSCallbackFunction.cpp:
* API/JSCallbackObjectFunctions.h:
* runtime/Arguments.h:
* runtime/ArrayPrototype.cpp:
* runtime/BooleanObject.cpp:
* runtime/DateInstance.cpp:
* runtime/DatePrototype.cpp:
* runtime/ErrorInstance.cpp:
* runtime/InternalFunction.cpp:
* runtime/JSActivation.cpp:
* runtime/JSArray.cpp:
* runtime/JSFunction.cpp:
* runtime/JSONObject.cpp:
* runtime/JSObject.h:
* runtime/JSZombie.h:
* runtime/MathObject.cpp:
* runtime/NativeErrorConstructor.cpp:
* runtime/NumberConstructor.cpp:
* runtime/NumberObject.cpp:
* runtime/RegExpConstructor.cpp:
* runtime/RegExpObject.cpp:
* runtime/StringObject.cpp:
* runtime/StringPrototype.cpp:
2011-02-21 Adam Roben <aroben@apple.com>
Export JSObject::s_info from JavaScriptCore.dll
......
......@@ -145,6 +145,8 @@ namespace JSC {
: JSNonFinalObject(callFrame->lexicalGlobalObject()->argumentsStructure())
, d(adoptPtr(new ArgumentsData))
{
ASSERT(inherits(&s_info));
JSFunction* callee;
ptrdiff_t firstParameterIndex;
Register* argv;
......@@ -185,6 +187,7 @@ namespace JSC {
: JSNonFinalObject(callFrame->lexicalGlobalObject()->argumentsStructure())
, d(adoptPtr(new ArgumentsData))
{
ASSERT(inherits(&s_info));
ASSERT(!asFunction(callFrame->callee())->jsExecutable()->parameterCount());
unsigned numArguments = callFrame->argumentCount();
......
......@@ -117,6 +117,7 @@ const ClassInfo ArrayPrototype::s_info = {"Array", &JSArray::s_info, 0, ExecStat
ArrayPrototype::ArrayPrototype(JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure)
: JSArray(structure)
{
ASSERT(inherits(&s_info));
putAnonymousValue(globalObject->globalData(), 0, globalObject);
}
......
......@@ -30,6 +30,7 @@ const ClassInfo BooleanObject::s_info = { "Boolean", &JSWrapperObject::s_info, 0
BooleanObject::BooleanObject(JSGlobalData& globalData, NonNullPassRefPtr<Structure> structure)
: JSWrapperObject(globalData, structure)
{
ASSERT(inherits(&s_info));
}
} // namespace JSC
......@@ -37,18 +37,21 @@ const ClassInfo DateInstance::s_info = {"Date", &JSWrapperObject::s_info, 0, 0};
DateInstance::DateInstance(ExecState* exec, NonNullPassRefPtr<Structure> structure)
: JSWrapperObject(exec->globalData(), structure)
{
ASSERT(inherits(&s_info));
setInternalValue(exec->globalData(), jsNaN());
}
DateInstance::DateInstance(ExecState* exec, NonNullPassRefPtr<Structure> structure, double time)
: JSWrapperObject(exec->globalData(), structure)
{
ASSERT(inherits(&s_info));
setInternalValue(exec->globalData(), jsNumber(timeClip(time)));
}
DateInstance::DateInstance(ExecState* exec, double time)
: JSWrapperObject(exec->globalData(), exec->lexicalGlobalObject()->dateStructure())
{
ASSERT(inherits(&s_info));
setInternalValue(exec->globalData(), jsNumber(timeClip(time)));
}
......
......@@ -432,6 +432,8 @@ const ClassInfo DatePrototype::s_info = {"Date", &DateInstance::s_info, 0, ExecS
DatePrototype::DatePrototype(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure)
: DateInstance(exec, structure)
{
ASSERT(inherits(&s_info));
// The constructor will be added later, after DateConstructor has been built.
putAnonymousValue(exec->globalData(), 0, globalObject);
}
......
......@@ -29,6 +29,7 @@ ErrorInstance::ErrorInstance(JSGlobalData* globalData, NonNullPassRefPtr<Structu
: JSNonFinalObject(structure)
, m_appendSourceToMessage(false)
{
ASSERT(inherits(&s_info));
putDirect(*globalData, globalData->propertyNames->message, jsString(globalData, ""));
}
......@@ -36,6 +37,7 @@ ErrorInstance::ErrorInstance(JSGlobalData* globalData, NonNullPassRefPtr<Structu
: JSNonFinalObject(structure)
, m_appendSourceToMessage(false)
{
ASSERT(inherits(&s_info));
putDirect(*globalData, globalData->propertyNames->message, jsString(globalData, message));
}
......
......@@ -39,11 +39,13 @@ const ClassInfo InternalFunction::s_info = { "Function", &JSObjectWithGlobalObje
InternalFunction::InternalFunction(NonNullPassRefPtr<Structure> structure)
: JSObjectWithGlobalObject(structure)
{
ASSERT(inherits(&s_info));
}
InternalFunction::InternalFunction(JSGlobalData* globalData, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, const Identifier& name)
: JSObjectWithGlobalObject(globalObject, structure)
{
ASSERT(inherits(&s_info));
putDirect(*globalData, globalData->propertyNames->name, jsString(globalData, name.isNull() ? "" : name.ustring()), DontDelete | ReadOnly | DontEnum);
}
......
......@@ -42,6 +42,7 @@ const ClassInfo JSActivation::s_info = { "JSActivation", &Base::s_info, 0, 0 };
JSActivation::JSActivation(CallFrame* callFrame, NonNullPassRefPtr<FunctionExecutable> functionExecutable)
: Base(callFrame->globalData().activationStructure, new JSActivationData(functionExecutable, callFrame->registers()))
{
ASSERT(inherits(&s_info));
}
JSActivation::~JSActivation()
......
......@@ -129,6 +129,8 @@ inline void JSArray::checkConsistency(ConsistencyCheckType)
JSArray::JSArray(VPtrStealingHackType)
: JSNonFinalObject(createStructure(jsNull()))
{
ASSERT(inherits(&s_info));
unsigned initialCapacity = 0;
m_storage = static_cast<ArrayStorage*>(fastZeroedMalloc(storageSize(initialCapacity)));
......@@ -146,6 +148,8 @@ JSArray::JSArray(VPtrStealingHackType)
JSArray::JSArray(NonNullPassRefPtr<Structure> structure)
: JSNonFinalObject(structure)
{
ASSERT(inherits(&s_info));
unsigned initialCapacity = 0;
m_storage = static_cast<ArrayStorage*>(fastZeroedMalloc(storageSize(initialCapacity)));
......@@ -161,6 +165,8 @@ JSArray::JSArray(NonNullPassRefPtr<Structure> structure)
JSArray::JSArray(NonNullPassRefPtr<Structure> structure, unsigned initialLength, ArrayCreationMode creationMode)
: JSNonFinalObject(structure)
{
ASSERT(inherits(&s_info));
unsigned initialCapacity;
if (creationMode == CreateCompact)
initialCapacity = initialLength;
......@@ -201,6 +207,8 @@ JSArray::JSArray(NonNullPassRefPtr<Structure> structure, unsigned initialLength,
JSArray::JSArray(JSGlobalData& globalData, NonNullPassRefPtr<Structure> structure, const ArgList& list)
: JSNonFinalObject(structure)
{
ASSERT(inherits(&s_info));
unsigned initialCapacity = list.size();
unsigned initialStorage;
......
......@@ -61,6 +61,7 @@ JSFunction::JSFunction(NonNullPassRefPtr<Structure> structure)
, m_executable(adoptRef(new VPtrHackExecutable()))
, m_scopeChain(NoScopeChain())
{
ASSERT(inherits(&s_info));
}
JSFunction::JSFunction(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, int length, const Identifier& name, PassRefPtr<NativeExecutable> thunk)
......@@ -68,6 +69,7 @@ JSFunction::JSFunction(ExecState* exec, JSGlobalObject* globalObject, NonNullPas
, m_executable(thunk)
, m_scopeChain(globalObject->globalScopeChain())
{
ASSERT(inherits(&s_info));
putDirect(exec->globalData(), exec->globalData().propertyNames->name, jsString(exec, name.isNull() ? "" : name.ustring()), DontDelete | ReadOnly | DontEnum);
putDirect(exec->globalData(), exec->propertyNames().length, jsNumber(length), DontDelete | ReadOnly | DontEnum);
}
......@@ -77,6 +79,7 @@ JSFunction::JSFunction(ExecState* exec, JSGlobalObject* globalObject, NonNullPas
, m_executable(exec->globalData().getHostFunction(func))
, m_scopeChain(globalObject->globalScopeChain())
{
ASSERT(inherits(&s_info));
putDirect(exec->globalData(), exec->globalData().propertyNames->name, jsString(exec, name.isNull() ? "" : name.ustring()), DontDelete | ReadOnly | DontEnum);
putDirect(exec->globalData(), exec->propertyNames().length, jsNumber(length), DontDelete | ReadOnly | DontEnum);
}
......@@ -86,6 +89,7 @@ JSFunction::JSFunction(ExecState* exec, NonNullPassRefPtr<FunctionExecutable> ex
, m_executable(executable)
, m_scopeChain(scopeChainNode)
{
ASSERT(inherits(&s_info));
const Identifier& name = static_cast<FunctionExecutable*>(m_executable.get())->name();
putDirect(exec->globalData(), exec->globalData().propertyNames->name, jsString(exec, name.isNull() ? "" : name.ustring()), DontDelete | ReadOnly | DontEnum);
}
......
......@@ -54,6 +54,7 @@ namespace JSC {
JSONObject::JSONObject(JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure)
: JSObjectWithGlobalObject(globalObject, structure)
{
ASSERT(inherits(&s_info));
}
// PropertyNameForFunctionCall objects must be on the stack, since the JSValue that they create is not marked.
......
......@@ -388,6 +388,7 @@ inline JSObject::JSObject(NonNullPassRefPtr<Structure> structure, PropertyStorag
: JSCell(structure.releaseRef()) // ~JSObject balances this ref()
, m_propertyStorage(inlineStorage)
{
ASSERT(inherits(&s_info));
ASSERT(m_structure->propertyStorageCapacity() < baseExternalStorageCapacity);
ASSERT(m_structure->isEmpty());
ASSERT(prototype().isNull() || Heap::heap(this) == Heap::heap(prototype()));
......
......@@ -37,7 +37,9 @@ public:
: JSCell(structure)
, m_oldInfo(oldInfo)
{
ASSERT(inherits(&s_info));
}
virtual bool isZombie() const { return true; }
static Structure* leakedZombieStructure();
......
......@@ -89,6 +89,8 @@ const ClassInfo MathObject::s_info = { "Math", &JSObjectWithGlobalObject::s_info
MathObject::MathObject(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure)
: JSObjectWithGlobalObject(globalObject, structure)
{
ASSERT(inherits(&s_info));
putDirectWithoutTransition(exec->globalData(), Identifier(exec, "E"), jsNumber(exp(1.0)), DontDelete | DontEnum | ReadOnly);
putDirectWithoutTransition(exec->globalData(), Identifier(exec, "LN2"), jsNumber(log(2.0)), DontDelete | DontEnum | ReadOnly);
putDirectWithoutTransition(exec->globalData(), Identifier(exec, "LN10"), jsNumber(log(10.0)), DontDelete | DontEnum | ReadOnly);
......
......@@ -35,6 +35,8 @@ const ClassInfo NativeErrorConstructor::s_info = { "Function", &InternalFunction
NativeErrorConstructor::NativeErrorConstructor(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, NonNullPassRefPtr<Structure> prototypeStructure, const UString& nameAndMessage)
: InternalFunction(&exec->globalData(), globalObject, structure, Identifier(exec, nameAndMessage))
{
ASSERT(inherits(&s_info));
NativeErrorPrototype* prototype = new (exec) NativeErrorPrototype(exec, globalObject, prototypeStructure, nameAndMessage, this);
putDirect(exec->globalData(), exec->propertyNames().length, jsNumber(1), DontDelete | ReadOnly | DontEnum); // ECMA 15.11.7.5
......
......@@ -57,6 +57,8 @@ const ClassInfo NumberConstructor::s_info = { "Function", &InternalFunction::s_i
NumberConstructor::NumberConstructor(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, NumberPrototype* numberPrototype)
: InternalFunction(&exec->globalData(), globalObject, structure, Identifier(exec, numberPrototype->s_info.className))
{
ASSERT(inherits(&s_info));
// Number.Prototype
putDirectWithoutTransition(exec->globalData(), exec->propertyNames().prototype, numberPrototype, DontEnum | DontDelete | ReadOnly);
......
......@@ -34,6 +34,7 @@ const ClassInfo NumberObject::s_info = { "Number", &JSWrapperObject::s_info, 0,
NumberObject::NumberObject(JSGlobalData& globalData, NonNullPassRefPtr<Structure> structure)
: JSWrapperObject(globalData, structure)
{
ASSERT(inherits(&s_info));
}
JSValue NumberObject::getJSNumber()
......
......@@ -99,6 +99,8 @@ RegExpConstructor::RegExpConstructor(ExecState* exec, JSGlobalObject* globalObje
: InternalFunction(&exec->globalData(), globalObject, structure, Identifier(exec, "RegExp"))
, d(adoptPtr(new RegExpConstructorPrivate))
{
ASSERT(inherits(&s_info));
// ECMA 15.10.5.1 RegExp.prototype
putDirectWithoutTransition(exec->globalData(), exec->propertyNames().prototype, regExpPrototype, DontEnum | DontDelete | ReadOnly);
......
......@@ -65,6 +65,7 @@ RegExpObject::RegExpObject(JSGlobalObject* globalObject, NonNullPassRefPtr<Struc
: JSObjectWithGlobalObject(globalObject, structure)
, d(adoptPtr(new RegExpObjectData(regExp, 0)))
{
ASSERT(inherits(&s_info));
}
RegExpObject::~RegExpObject()
......
......@@ -32,18 +32,21 @@ const ClassInfo StringObject::s_info = { "String", &JSWrapperObject::s_info, 0,
StringObject::StringObject(ExecState* exec, NonNullPassRefPtr<Structure> structure)
: JSWrapperObject(exec->globalData(), structure)
{
ASSERT(inherits(&s_info));
setInternalValue(exec->globalData(), jsEmptyString(exec));
}
StringObject::StringObject(JSGlobalData& globalData, NonNullPassRefPtr<Structure> structure, JSString* string)
: JSWrapperObject(globalData, structure)
{
ASSERT(inherits(&s_info));
setInternalValue(globalData, string);
}
StringObject::StringObject(ExecState* exec, NonNullPassRefPtr<Structure> structure, const UString& string)
: JSWrapperObject(exec->globalData(), structure)
{
ASSERT(inherits(&s_info));
setInternalValue(exec->globalData(), jsString(exec, string));
}
......
......@@ -134,6 +134,8 @@ const ClassInfo StringPrototype::s_info = { "String", &StringObject::s_info, 0,
StringPrototype::StringPrototype(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure)
: StringObject(exec, structure)
{
ASSERT(inherits(&s_info));
putAnonymousValue(exec->globalData(), 0, globalObject);
// The constructor will be added later, after StringConstructor has been built
putDirectWithoutTransition(exec->globalData(), exec->propertyNames().length, jsNumber(0), DontDelete | ReadOnly | DontEnum);
......
2011-02-21 Gavin Barraclough <barraclough@apple.com>
Reviewed by Sam Weinig.
Bug 54894 - Make inheritance structure described by ClassInfo match C++ class hierarchy.
The ClassInfo objects describe an inheritance hierarchy, with each ClassInfo instance
containing a pointer to its parent class. These links should reflect the inheritance
hierarchy of C++ classes below JSObject. For the large part it does, but in some cases
entries in the C++ hierarchy are skipped over. This presently likely doesn't matter,
since intervening C++ classes may not have ClassInfo - but would be a potential bug
were ClassInfo were to be added.
* bindings/js/JSAudioConstructor.cpp:
* bindings/js/JSDOMGlobalObject.cpp:
* bindings/js/JSImageConstructor.cpp:
* bindings/js/JSOptionConstructor.cpp:
* bindings/scripts/CodeGeneratorJS.pm:
* bridge/objc/objc_runtime.mm:
* bridge/runtime_object.cpp:
2011-02-21 Pavel Feldman <pfeldman@chromium.org>
Reviewed by Yury Semikhatsky.
......
......@@ -37,7 +37,7 @@ using namespace JSC;
namespace WebCore {
const ClassInfo JSAudioConstructor::s_info = { "AudioConstructor", &JSC::JSObject::s_info, 0, 0 };
const ClassInfo JSAudioConstructor::s_info = { "AudioConstructor", &DOMConstructorWithDocument::s_info, 0, 0 };
JSAudioConstructor::JSAudioConstructor(ExecState* exec, JSDOMGlobalObject* globalObject)
: DOMConstructorWithDocument(JSAudioConstructor::createStructure(globalObject->objectPrototype()), globalObject)
......
......@@ -40,7 +40,7 @@ using namespace JSC;
namespace WebCore {
const ClassInfo JSDOMGlobalObject::s_info = { "DOMGlobalObject", &JSC::JSObject::s_info, 0, 0 };
const ClassInfo JSDOMGlobalObject::s_info = { "DOMGlobalObject", &JSGlobalObject::s_info, 0, 0 };
JSDOMGlobalObject::JSDOMGlobalObject(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject::JSDOMGlobalObjectData* data, JSObject* thisValue)
: JSGlobalObject(structure, data, thisValue)
......
......@@ -32,7 +32,7 @@ namespace WebCore {
ASSERT_CLASS_FITS_IN_CELL(JSImageConstructor);
const ClassInfo JSImageConstructor::s_info = { "ImageConstructor", &JSC::JSObject::s_info, 0, 0 };
const ClassInfo JSImageConstructor::s_info = { "ImageConstructor", &DOMConstructorWithDocument::s_info, 0, 0 };
JSImageConstructor::JSImageConstructor(ExecState* exec, JSDOMGlobalObject* globalObject)
: DOMConstructorWithDocument(JSImageConstructor::createStructure(globalObject->objectPrototype()), globalObject)
......
......@@ -33,7 +33,7 @@ namespace WebCore {
ASSERT_CLASS_FITS_IN_CELL(JSOptionConstructor);
const ClassInfo JSOptionConstructor::s_info = { "OptionConstructor", &JSC::JSObject::s_info, 0, 0 };
const ClassInfo JSOptionConstructor::s_info = { "OptionConstructor", &DOMConstructorWithDocument::s_info, 0, 0 };
JSOptionConstructor::JSOptionConstructor(ExecState* exec, JSDOMGlobalObject* globalObject)
: DOMConstructorWithDocument(JSOptionConstructor::createStructure(globalObject->objectPrototype()), globalObject)
......
......@@ -1308,9 +1308,9 @@ sub GenerateImplementation
push(@implContent, "{\n");
push(@implContent, " return getHashTableForGlobalData(exec->globalData(), &${className}PrototypeTable);\n");
push(@implContent, "}\n");
push(@implContent, "const ClassInfo ${className}Prototype::s_info = { \"${visibleClassName}Prototype\", &JSC::JSObject::s_info, 0, get${className}PrototypeTable };\n\n");
push(@implContent, "const ClassInfo ${className}Prototype::s_info = { \"${visibleClassName}Prototype\", &JSC::JSObjectWithGlobalObject::s_info, 0, get${className}PrototypeTable };\n\n");
} else {
push(@implContent, "const ClassInfo ${className}Prototype::s_info = { \"${visibleClassName}Prototype\", &JSC::JSObject::s_info, &${className}PrototypeTable, 0 };\n\n");
push(@implContent, "const ClassInfo ${className}Prototype::s_info = { \"${visibleClassName}Prototype\", &JSC::JSObjectWithGlobalObject::s_info, &${className}PrototypeTable, 0 };\n\n");
}
if ($interfaceName eq "DOMWindow") {
push(@implContent, "void* ${className}Prototype::operator new(size_t size)\n");
......@@ -1385,12 +1385,7 @@ sub GenerateImplementation
push(@implContent, "}\n");
}
push(@implContent, "const ClassInfo $className" . "::s_info = { \"${visibleClassName}\", ");
if ($hasParent) {
push(@implContent, "&" . $parentClassName . "::s_info, ");
} else {
push(@implContent, "&JSC::JSObject::s_info, ");
}
push(@implContent, "const ClassInfo $className" . "::s_info = { \"${visibleClassName}\", &" . $parentClassName . "::s_info, ");
if ($numAttributes > 0 && !$dataNode->extendedAttributes->{"NoStaticTables"}) {
push(@implContent, "&${className}Table");
......@@ -1431,6 +1426,7 @@ sub GenerateImplementation
}
}
push(@implContent, "{\n");
push(@implContent, " ASSERT(inherits(&s_info));\n");
if ($numCachedAttributes > 0) {
push(@implContent, " for (unsigned i = Base::AnonymousSlotCount; i < AnonymousSlotCount; i++)\n");
push(@implContent, " putAnonymousValue(globalObject->globalData(), i, JSValue());\n");
......@@ -2933,7 +2929,7 @@ sub GenerateConstructorDefinition
my $callWith = $dataNode->extendedAttributes->{"CallWith"};
my $numberOfconstructParameters = $dataNode->extendedAttributes->{"ConstructorParameters"};
push(@$outputArray, "const ClassInfo ${constructorClassName}::s_info = { \"${visibleClassName}Constructor\", &JSC::JSObject::s_info, &${constructorClassName}Table, 0 };\n\n");
push(@$outputArray, "const ClassInfo ${constructorClassName}::s_info = { \"${visibleClassName}Constructor\", &DOMConstructorObject::s_info, &${constructorClassName}Table, 0 };\n\n");
push(@$outputArray, "${constructorClassName}::${constructorClassName}(ExecState* exec, JSDOMGlobalObject* globalObject)\n");
push(@$outputArray, " : DOMConstructorObject(${constructorClassName}::createStructure(globalObject->objectPrototype()), globalObject)\n");
......
......@@ -187,7 +187,7 @@ unsigned int ObjcArray::getLength() const
return [_array.get() count];
}
const ClassInfo ObjcFallbackObjectImp::s_info = { "ObjcFallbackObject", &JSObject::s_info, 0, 0 };
const ClassInfo ObjcFallbackObjectImp::s_info = { "ObjcFallbackObject", &JSObjectWithGlobalObject::s_info, 0, 0 };
ObjcFallbackObjectImp::ObjcFallbackObjectImp(ExecState* exec, JSGlobalObject* globalObject, ObjcInstance* i, const Identifier& propertyName)
// FIXME: deprecatedGetDOMStructure uses the prototype off of the wrong global object
......
......@@ -36,7 +36,7 @@ using namespace WebCore;
namespace JSC {
namespace Bindings {
const ClassInfo RuntimeObject::s_info = { "RuntimeObject", &JSC::JSObject::s_info, 0, 0 };
const ClassInfo RuntimeObject::s_info = { "RuntimeObject", &JSObjectWithGlobalObject::s_info, 0, 0 };
RuntimeObject::RuntimeObject(ExecState*, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, PassRefPtr<Instance> instance)
: JSObjectWithGlobalObject(globalObject, structure)
......
2011-02-21 Gavin Barraclough <barraclough@apple.com>
Reviewed by Sam Weinig.
Bug 54894 - Make inheritance structure described by ClassInfo match C++ class hierarchy.
The ClassInfo objects describe an inheritance hierarchy, with each ClassInfo instance
containing a pointer to its parent class. These links should reflect the inheritance
hierarchy of C++ classes below JSObject. For the large part it does, but in some cases
entries in the C++ hierarchy are skipped over. This presently likely doesn't matter,
since intervening C++ classes may not have ClassInfo - but would be a potential bug
were ClassInfo were to be added.
* WebProcess/Plugins/Netscape/JSNPObject.cpp:
2011-02-21 Balazs Kelemen <kbalazs@webkit.org>
Reviewed by Kenneth Rohde Christiansen.
......
......@@ -47,7 +47,7 @@ static NPIdentifier npIdentifierFromIdentifier(const Identifier& identifier)
return static_cast<NPIdentifier>(IdentifierRep::get(identifier.ustring().utf8().data()));
}
const ClassInfo JSNPObject::s_info = { "NPObject", &JSObject::s_info, 0, 0 };
const ClassInfo JSNPObject::s_info = { "NPObject", &JSObjectWithGlobalObject::s_info, 0, 0 };
JSNPObject::JSNPObject(JSGlobalObject* globalObject, NPRuntimeObjectMap* objectMap, NPObject* npObject)
: JSObjectWithGlobalObject(globalObject, createStructure(globalObject->objectPrototype()))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment