Commit e9eda786 authored by oliver@apple.com's avatar oliver@apple.com

structure typeinfo flags should be inherited.

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

Reviewed by Gavin Barraclough.

Add StructureFlag constant to the various JSC classes and use
it for the TypeInfo construction.  This allows us to simply
accumulate flags by basing each classes StructureInfo on its parents.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@49721 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 8267394c
......@@ -41,9 +41,12 @@ public:
static PassRefPtr<Structure> createStructure(JSValue proto)
{
return Structure::create(proto, TypeInfo(ObjectType, ImplementsHasInstance));
return Structure::create(proto, TypeInfo(ObjectType, StructureFlags));
}
protected:
static const unsigned StructureFlags = ImplementsHasInstance | JSObject::StructureFlags;
private:
virtual ConstructType getConstructData(ConstructData&);
virtual const ClassInfo* classInfo() const { return &info; }
......
......@@ -41,7 +41,7 @@ public:
// refactor the code so this override isn't necessary
static PassRefPtr<Structure> createStructure(JSValue proto)
{
return Structure::create(proto, TypeInfo(ObjectType));
return Structure::create(proto, TypeInfo(ObjectType, StructureFlags));
}
private:
......
......@@ -50,9 +50,12 @@ public:
static PassRefPtr<Structure> createStructure(JSValue proto)
{
return Structure::create(proto, TypeInfo(ObjectType, OverridesGetOwnPropertySlot | ImplementsHasInstance | OverridesHasInstance | OverridesMarkChildren | OverridesGetPropertyNames));
return Structure::create(proto, TypeInfo(ObjectType, StructureFlags));
}
protected:
static const unsigned StructureFlags = OverridesGetOwnPropertySlot | ImplementsHasInstance | OverridesHasInstance | OverridesMarkChildren | OverridesGetPropertyNames | Base::StructureFlags;
private:
virtual UString className() const;
......
2009-10-16 Oliver Hunt <oliver@apple.com>
Reviewed by Gavin Barraclough.
structure typeinfo flags should be inherited.
https://bugs.webkit.org/show_bug.cgi?id=30468
Add StructureFlag constant to the various JSC classes and use
it for the TypeInfo construction. This allows us to simply
accumulate flags by basing each classes StructureInfo on its parents.
* API/JSCallbackConstructor.h:
(JSC::JSCallbackConstructor::createStructure):
* API/JSCallbackFunction.h:
(JSC::JSCallbackFunction::createStructure):
* API/JSCallbackObject.h:
(JSC::JSCallbackObject::createStructure):
* debugger/DebuggerActivation.h:
(JSC::DebuggerActivation::createStructure):
* runtime/Arguments.h:
(JSC::Arguments::createStructure):
* runtime/BooleanObject.h:
(JSC::BooleanObject::createStructure):
* runtime/DatePrototype.h:
(JSC::DatePrototype::createStructure):
* runtime/FunctionPrototype.h:
(JSC::FunctionPrototype::createStructure):
* runtime/GlobalEvalFunction.h:
(JSC::GlobalEvalFunction::createStructure):
* runtime/InternalFunction.h:
(JSC::InternalFunction::createStructure):
* runtime/JSActivation.h:
(JSC::JSActivation::createStructure):
* runtime/JSArray.h:
(JSC::JSArray::createStructure):
* runtime/JSByteArray.cpp:
(JSC::JSByteArray::createStructure):
* runtime/JSByteArray.h:
* runtime/JSFunction.h:
(JSC::JSFunction::createStructure):
* runtime/JSGlobalObject.h:
(JSC::JSGlobalObject::createStructure):
* runtime/JSNotAnObject.h:
(JSC::JSNotAnObject::createStructure):
* runtime/JSONObject.h:
(JSC::JSONObject::createStructure):
* runtime/JSObject.h:
(JSC::JSObject::createStructure):
* runtime/JSStaticScopeObject.h:
(JSC::JSStaticScopeObject::createStructure):
* runtime/JSVariableObject.h:
(JSC::JSVariableObject::createStructure):
* runtime/JSWrapperObject.h:
(JSC::JSWrapperObject::createStructure):
* runtime/MathObject.h:
(JSC::MathObject::createStructure):
* runtime/NumberConstructor.h:
(JSC::NumberConstructor::createStructure):
* runtime/NumberObject.h:
(JSC::NumberObject::createStructure):
* runtime/RegExpConstructor.h:
(JSC::RegExpConstructor::createStructure):
* runtime/RegExpObject.h:
(JSC::RegExpObject::createStructure):
* runtime/StringObject.h:
(JSC::StringObject::createStructure):
* runtime/StringObjectThatMasqueradesAsUndefined.h:
(JSC::StringObjectThatMasqueradesAsUndefined::createStructure):
2009-10-16 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
......
......@@ -51,9 +51,12 @@ namespace JSC {
static PassRefPtr<Structure> createStructure(JSValue prototype)
{
return Structure::create(prototype, TypeInfo(ObjectType, OverridesGetOwnPropertySlot | OverridesMarkChildren));
return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags));
}
protected:
static const unsigned StructureFlags = OverridesGetOwnPropertySlot | OverridesMarkChildren | JSObject::StructureFlags;
private:
JSActivation* m_activation;
};
......
......@@ -85,9 +85,12 @@ namespace JSC {
static PassRefPtr<Structure> createStructure(JSValue prototype)
{
return Structure::create(prototype, TypeInfo(ObjectType, OverridesGetOwnPropertySlot | OverridesMarkChildren | OverridesGetPropertyNames));
return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags));
}
protected:
static const unsigned StructureFlags = OverridesGetOwnPropertySlot | OverridesMarkChildren | OverridesGetPropertyNames | JSObject::StructureFlags;
private:
void getArgumentsData(CallFrame*, JSFunction*&, ptrdiff_t& firstParameterIndex, Register*& argv, int& argc);
virtual bool getOwnPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&);
......
......@@ -34,7 +34,7 @@ namespace JSC {
static PassRefPtr<Structure> createStructure(JSValue prototype)
{
return Structure::create(prototype, TypeInfo(ObjectType));
return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags));
}
};
......
......@@ -39,8 +39,12 @@ namespace JSC {
static PassRefPtr<Structure> createStructure(JSValue prototype)
{
return Structure::create(prototype, TypeInfo(ObjectType, OverridesGetOwnPropertySlot | OverridesMarkChildren));
return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags));
}
protected:
static const unsigned StructureFlags = OverridesGetOwnPropertySlot | OverridesMarkChildren | DateInstance::StructureFlags;
};
} // namespace JSC
......
......@@ -34,7 +34,7 @@ namespace JSC {
static PassRefPtr<Structure> createStructure(JSValue proto)
{
return Structure::create(proto, TypeInfo(ObjectType));
return Structure::create(proto, TypeInfo(ObjectType, StructureFlags));
}
private:
......
......@@ -37,9 +37,12 @@ namespace JSC {
static PassRefPtr<Structure> createStructure(JSValue prototype)
{
return Structure::create(prototype, TypeInfo(ObjectType, ImplementsHasInstance | OverridesMarkChildren | OverridesGetPropertyNames));
return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags));
}
protected:
static const unsigned StructureFlags = ImplementsHasInstance | OverridesMarkChildren | OverridesGetPropertyNames | PrototypeFunction::StructureFlags;
private:
virtual void markChildren(MarkStack&);
......
......@@ -42,10 +42,12 @@ namespace JSC {
static PassRefPtr<Structure> createStructure(JSValue proto)
{
return Structure::create(proto, TypeInfo(ObjectType, ImplementsHasInstance));
return Structure::create(proto, TypeInfo(ObjectType, StructureFlags));
}
protected:
static const unsigned StructureFlags = ImplementsHasInstance | JSObject::StructureFlags;
InternalFunction(NonNullPassRefPtr<Structure> structure) : JSObject(structure) { }
InternalFunction(JSGlobalData*, NonNullPassRefPtr<Structure>, const Identifier&);
......
......@@ -66,7 +66,10 @@ namespace JSC {
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
static PassRefPtr<Structure> createStructure(JSValue proto) { return Structure::create(proto, TypeInfo(ObjectType, OverridesGetOwnPropertySlot | NeedsThisConversion | OverridesMarkChildren | OverridesGetPropertyNames)); }
static PassRefPtr<Structure> createStructure(JSValue proto) { return Structure::create(proto, TypeInfo(ObjectType, StructureFlags)); }
protected:
static const unsigned StructureFlags = OverridesGetOwnPropertySlot | NeedsThisConversion | OverridesMarkChildren | OverridesGetPropertyNames | JSVariableObject::StructureFlags;
private:
struct JSActivationData : public JSVariableObjectData {
......
......@@ -87,12 +87,13 @@ namespace JSC {
static PassRefPtr<Structure> createStructure(JSValue prototype)
{
return Structure::create(prototype, TypeInfo(ObjectType, OverridesGetOwnPropertySlot | OverridesMarkChildren | OverridesGetPropertyNames));
return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags));
}
inline void markChildrenDirect(MarkStack& markStack);
protected:
static const unsigned StructureFlags = OverridesGetOwnPropertySlot | OverridesMarkChildren | OverridesGetPropertyNames | JSObject::StructureFlags;
virtual void put(ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&);
virtual bool deleteProperty(ExecState*, const Identifier& propertyName);
virtual bool deleteProperty(ExecState*, unsigned propertyName);
......
......@@ -45,7 +45,7 @@ JSByteArray::JSByteArray(ExecState* exec, NonNullPassRefPtr<Structure> structure
PassRefPtr<Structure> JSByteArray::createStructure(JSValue prototype)
{
PassRefPtr<Structure> result = Structure::create(prototype, TypeInfo(ObjectType, OverridesGetOwnPropertySlot | OverridesGetPropertyNames));
PassRefPtr<Structure> result = Structure::create(prototype, TypeInfo(ObjectType, StructureFlags));
return result;
}
......
......@@ -91,6 +91,9 @@ namespace JSC {
WTF::ByteArray* storage() const { return m_storage.get(); }
protected:
static const unsigned StructureFlags = OverridesGetOwnPropertySlot | OverridesGetPropertyNames | JSObject::StructureFlags;
private:
enum VPtrStealingHackType { VPtrStealingHack };
JSByteArray(VPtrStealingHackType)
......
......@@ -61,7 +61,7 @@ namespace JSC {
static PassRefPtr<Structure> createStructure(JSValue prototype)
{
return Structure::create(prototype, TypeInfo(ObjectType, OverridesGetOwnPropertySlot | ImplementsHasInstance | OverridesMarkChildren | OverridesGetPropertyNames));
return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags));
}
NativeFunction nativeFunction()
......@@ -72,6 +72,9 @@ namespace JSC {
virtual ConstructType getConstructData(ConstructData&);
virtual CallType getCallData(CallData&);
protected:
const static unsigned StructureFlags = OverridesGetOwnPropertySlot | ImplementsHasInstance | OverridesMarkChildren | OverridesGetPropertyNames | InternalFunction::StructureFlags;
private:
JSFunction(NonNullPassRefPtr<Structure>);
......
......@@ -267,10 +267,13 @@ namespace JSC {
static PassRefPtr<Structure> createStructure(JSValue prototype)
{
return Structure::create(prototype, TypeInfo(ObjectType, OverridesGetOwnPropertySlot | OverridesMarkChildren | OverridesGetPropertyNames));
return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags));
}
protected:
static const unsigned StructureFlags = OverridesGetOwnPropertySlot | OverridesMarkChildren | OverridesGetPropertyNames | JSVariableObject::StructureFlags;
struct GlobalPropertyInfo {
GlobalPropertyInfo(const Identifier& i, JSValue v, unsigned a)
: identifier(i)
......
......@@ -62,10 +62,13 @@ namespace JSC {
static PassRefPtr<Structure> createStructure(JSValue prototype)
{
return Structure::create(prototype, TypeInfo(ObjectType, OverridesGetOwnPropertySlot | OverridesMarkChildren | OverridesGetPropertyNames));
return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags));
}
private:
static const unsigned StructureFlags = OverridesGetOwnPropertySlot | OverridesMarkChildren | OverridesGetPropertyNames | JSObject::StructureFlags;
// JSValue methods
virtual JSValue toPrimitive(ExecState*, PreferredPrimitiveType) const;
virtual bool getPrimitiveNumber(ExecState*, double& number, JSValue&);
......
......@@ -41,11 +41,14 @@ namespace JSC {
static PassRefPtr<Structure> createStructure(JSValue prototype)
{
return Structure::create(prototype, TypeInfo(ObjectType, OverridesGetOwnPropertySlot));
return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags));
}
static void markStringifiers(MarkStack&, Stringifier*);
protected:
static const unsigned StructureFlags = OverridesGetOwnPropertySlot | JSObject::StructureFlags;
private:
virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
......
......@@ -207,10 +207,12 @@ namespace JSC {
static PassRefPtr<Structure> createStructure(JSValue prototype)
{
return Structure::create(prototype, TypeInfo(ObjectType));
return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags));
}
protected:
static const unsigned StructureFlags = 0;
void addAnonymousSlots(unsigned count);
void putAnonymousValue(unsigned index, JSValue value)
{
......
......@@ -57,7 +57,10 @@ namespace JSC{
virtual void put(ExecState*, const Identifier&, JSValue, PutPropertySlot&);
void putWithAttributes(ExecState*, const Identifier&, JSValue, unsigned attributes);
static PassRefPtr<Structure> createStructure(JSValue proto) { return Structure::create(proto, TypeInfo(ObjectType, OverridesGetOwnPropertySlot | NeedsThisConversion | OverridesMarkChildren | OverridesGetPropertyNames)); }
static PassRefPtr<Structure> createStructure(JSValue proto) { return Structure::create(proto, TypeInfo(ObjectType, StructureFlags)); }
protected:
static const unsigned StructureFlags = OverridesGetOwnPropertySlot | NeedsThisConversion | OverridesMarkChildren | OverridesGetPropertyNames | JSVariableObject::StructureFlags;
private:
JSStaticScopeObjectData* d() { return static_cast<JSStaticScopeObjectData*>(JSVariableObject::d); }
......
......@@ -60,10 +60,11 @@ namespace JSC {
static PassRefPtr<Structure> createStructure(JSValue prototype)
{
return Structure::create(prototype, TypeInfo(ObjectType, OverridesGetPropertyNames));
return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags));
}
protected:
static const unsigned StructureFlags = OverridesGetPropertyNames | JSObject::StructureFlags;
// Subclasses of JSVariableObject can subclass this struct to add data
// without increasing their own size (since there's a hard limit on the
// size of a JSCell).
......
......@@ -38,7 +38,7 @@ namespace JSC {
static PassRefPtr<Structure> createStructure(JSValue prototype)
{
return Structure::create(prototype, TypeInfo(ObjectType));
return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags));
}
private:
......
......@@ -37,8 +37,11 @@ namespace JSC {
static PassRefPtr<Structure> createStructure(JSValue prototype)
{
return Structure::create(prototype, TypeInfo(ObjectType, OverridesGetOwnPropertySlot));
return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags));
}
protected:
static const unsigned StructureFlags = OverridesGetOwnPropertySlot | JSObject::StructureFlags;
};
} // namespace JSC
......
......@@ -39,11 +39,14 @@ namespace JSC {
static PassRefPtr<Structure> createStructure(JSValue proto)
{
return Structure::create(proto, TypeInfo(ObjectType, OverridesGetOwnPropertySlot | ImplementsHasInstance));
return Structure::create(proto, TypeInfo(ObjectType, StructureFlags));
}
enum { NaNValue, NegInfinity, PosInfinity, MaxValue, MinValue };
protected:
static const unsigned StructureFlags = OverridesGetOwnPropertySlot | ImplementsHasInstance | InternalFunction::StructureFlags;
private:
virtual ConstructType getConstructData(ConstructData&);
virtual CallType getCallData(CallData&);
......
......@@ -30,17 +30,19 @@ namespace JSC {
explicit NumberObject(NonNullPassRefPtr<Structure>);
static const ClassInfo info;
#if USE(JSVALUE32)
static PassRefPtr<Structure> createStructure(JSValue prototype)
{
return Structure::create(prototype, TypeInfo(ObjectType, OverridesMarkChildren));
return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags));
}
protected:
#if USE(JSVALUE32)
static const unsigned StructureFlags = OverridesMarkChildren | JSWrapperObject::StructureFlags;
#else
static PassRefPtr<Structure> createStructure(JSValue prototype)
{
return Structure::create(prototype, TypeInfo(ObjectType));
}
static const unsigned StructureFlags = JSWrapperObject::StructureFlags;
#endif
private:
virtual const ClassInfo* classInfo() const { return &info; }
......
......@@ -59,7 +59,7 @@ namespace JSC {
static PassRefPtr<Structure> createStructure(JSValue prototype)
{
return Structure::create(prototype, TypeInfo(ObjectType, OverridesGetOwnPropertySlot | ImplementsHasInstance));
return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags));
}
virtual void put(ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&);
......@@ -82,6 +82,9 @@ namespace JSC {
JSValue getLeftContext(ExecState*) const;
JSValue getRightContext(ExecState*) const;
protected:
static const unsigned StructureFlags = OverridesGetOwnPropertySlot | ImplementsHasInstance | InternalFunction::StructureFlags;
private:
virtual ConstructType getConstructData(ConstructData&);
virtual CallType getCallData(CallData&);
......
......@@ -49,9 +49,12 @@ namespace JSC {
static PassRefPtr<Structure> createStructure(JSValue prototype)
{
return Structure::create(prototype, TypeInfo(ObjectType, OverridesGetOwnPropertySlot));
return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags));
}
protected:
static const unsigned StructureFlags = OverridesGetOwnPropertySlot | JSObject::StructureFlags;
private:
bool match(ExecState*, const ArgList&);
......
......@@ -48,10 +48,11 @@ namespace JSC {
static PassRefPtr<Structure> createStructure(JSValue prototype)
{
return Structure::create(prototype, TypeInfo(ObjectType, OverridesGetOwnPropertySlot | OverridesMarkChildren | OverridesGetPropertyNames));
return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags));
}
protected:
static const unsigned StructureFlags = OverridesGetOwnPropertySlot | OverridesMarkChildren | OverridesGetPropertyNames | JSWrapperObject::StructureFlags;
StringObject(NonNullPassRefPtr<Structure>, JSString*);
};
......
......@@ -44,9 +44,11 @@ namespace JSC {
static PassRefPtr<Structure> createStructure(JSValue proto)
{
return Structure::create(proto, TypeInfo(ObjectType, OverridesGetOwnPropertySlot | MasqueradesAsUndefined | OverridesGetPropertyNames));
return Structure::create(proto, TypeInfo(ObjectType, StructureFlags));
}
static const unsigned StructureFlags = OverridesGetOwnPropertySlot | MasqueradesAsUndefined | OverridesGetPropertyNames | StringObject::StructureFlags;
virtual bool toBoolean(ExecState*) const { return false; }
};
......
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