Commit 23ce68f4 authored by oliver@apple.com's avatar oliver@apple.com

2011-04-25 Oliver Hunt <oliver@apple.com>

        Reviewed by Geoffrey Garen.

        Make ClassInfo required when creating a Structure
        https://bugs.webkit.org/show_bug.cgi?id=59340

        Add ClassInfo to all those types which currently don't
        have it, and add an assertion to Structure::create to
        ensure that the provided classInfo is not null.

        * runtime/Executable.h:
        (JSC::EvalExecutable::createStructure):
        (JSC::ProgramExecutable::createStructure):
        (JSC::FunctionExecutable::createStructure):
        * runtime/GetterSetter.cpp:
        * runtime/GetterSetter.h:
        (JSC::GetterSetter::createStructure):
        * runtime/JSAPIValueWrapper.cpp:
        * runtime/JSAPIValueWrapper.h:
        (JSC::JSAPIValueWrapper::createStructure):
        * runtime/JSCell.cpp:
        * runtime/JSCell.h:
        * runtime/JSString.cpp:
        * runtime/JSString.h:
        (JSC::RopeBuilder::createStructure):
        * runtime/Structure.h:
        (JSC::Structure::create):
        (JSC::JSCell::createDummyStructure):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@84800 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 2fd1c4cb
2011-04-25 Oliver Hunt <oliver@apple.com>
Reviewed by Geoffrey Garen.
Make ClassInfo required when creating a Structure
https://bugs.webkit.org/show_bug.cgi?id=59340
Add ClassInfo to all those types which currently don't
have it, and add an assertion to Structure::create to
ensure that the provided classInfo is not null.
* runtime/Executable.h:
(JSC::EvalExecutable::createStructure):
(JSC::ProgramExecutable::createStructure):
(JSC::FunctionExecutable::createStructure):
* runtime/GetterSetter.cpp:
* runtime/GetterSetter.h:
(JSC::GetterSetter::createStructure):
* runtime/JSAPIValueWrapper.cpp:
* runtime/JSAPIValueWrapper.h:
(JSC::JSAPIValueWrapper::createStructure):
* runtime/JSCell.cpp:
* runtime/JSCell.h:
* runtime/JSString.cpp:
* runtime/JSString.h:
(JSC::RopeBuilder::createStructure):
* runtime/Structure.h:
(JSC::Structure::create):
(JSC::JSCell::createDummyStructure):
2011-04-25 David Levin <levin@chromium.org>
Reviewed by Adam Barth.
......
......@@ -232,7 +232,10 @@ namespace JSC {
return generatedJITCodeForCall();
}
#endif
static Structure* createStructure(JSGlobalData& globalData, JSValue proto) { return Structure::create(globalData, proto, TypeInfo(CompoundType, StructureFlags), AnonymousSlotCount, 0); }
static Structure* createStructure(JSGlobalData& globalData, JSValue proto)
{
return Structure::create(globalData, proto, TypeInfo(CompoundType, StructureFlags), AnonymousSlotCount, &s_info);
}
private:
static const unsigned StructureFlags = OverridesVisitChildren | ScriptExecutable::StructureFlags;
......@@ -279,7 +282,10 @@ namespace JSC {
}
#endif
static Structure* createStructure(JSGlobalData& globalData, JSValue proto) { return Structure::create(globalData, proto, TypeInfo(CompoundType, StructureFlags), AnonymousSlotCount, 0); }
static Structure* createStructure(JSGlobalData& globalData, JSValue proto)
{
return Structure::create(globalData, proto, TypeInfo(CompoundType, StructureFlags), AnonymousSlotCount, &s_info);
}
private:
static const unsigned StructureFlags = OverridesVisitChildren | ScriptExecutable::StructureFlags;
......@@ -372,7 +378,10 @@ namespace JSC {
void discardCode();
void visitChildren(SlotVisitor&);
static FunctionExecutable* fromGlobalCode(const Identifier&, ExecState*, Debugger*, const SourceCode&, JSObject** exception);
static Structure* createStructure(JSGlobalData& globalData, JSValue proto) { return Structure::create(globalData, proto, TypeInfo(CompoundType, StructureFlags), AnonymousSlotCount, 0); }
static Structure* createStructure(JSGlobalData& globalData, JSValue proto)
{
return Structure::create(globalData, proto, TypeInfo(CompoundType, StructureFlags), AnonymousSlotCount, &s_info);
}
private:
FunctionExecutable(JSGlobalData*, const Identifier& name, const SourceCode&, bool forceUsesArguments, FunctionParameters*, bool, int firstLine, int lastLine);
......
......@@ -28,6 +28,8 @@
namespace JSC {
const ClassInfo GetterSetter::s_info = { "GetterSetter", 0, 0, 0 };
void GetterSetter::visitChildren(SlotVisitor& visitor)
{
JSCell::visitChildren(visitor);
......
......@@ -50,10 +50,11 @@ namespace JSC {
void setSetter(JSGlobalData& globalData, JSObject* setter) { m_setter.set(globalData, this, setter); }
static Structure* createStructure(JSGlobalData& globalData, JSValue prototype)
{
return Structure::create(globalData, prototype, TypeInfo(GetterSetterType, OverridesVisitChildren), AnonymousSlotCount, 0);
return Structure::create(globalData, prototype, TypeInfo(GetterSetterType, OverridesVisitChildren), AnonymousSlotCount, &s_info);
}
private:
virtual bool isGetterSetter() const;
static const ClassInfo s_info;
WriteBarrier<JSObject> m_getter;
WriteBarrier<JSObject> m_setter;
......
......@@ -28,4 +28,6 @@
namespace JSC {
const ClassInfo JSAPIValueWrapper::s_info = { "API Wrapper", 0, 0, 0 };
} // namespace JSC
......@@ -38,7 +38,7 @@ namespace JSC {
static Structure* createStructure(JSGlobalData& globalData, JSValue prototype)
{
return Structure::create(globalData, prototype, TypeInfo(CompoundType, OverridesVisitChildren | OverridesGetPropertyNames), AnonymousSlotCount, 0);
return Structure::create(globalData, prototype, TypeInfo(CompoundType, OverridesVisitChildren | OverridesGetPropertyNames), AnonymousSlotCount, &s_info);
}
......@@ -49,6 +49,7 @@ namespace JSC {
m_value.set(exec->globalData(), this, value);
ASSERT(!value.isCell());
}
static const ClassInfo s_info;
WriteBarrier<Unknown> m_value;
};
......
......@@ -76,6 +76,8 @@ extern const double Inf = NaNInf.doubles.Inf_Double;
#endif // !(defined NAN && defined INFINITY)
const ClassInfo JSCell::s_dummyCellInfo = { "DummyCell", 0, 0, 0 };
bool JSCell::getUInt32(uint32_t&) const
{
return false;
......
......@@ -78,6 +78,7 @@ namespace JSC {
explicit JSCell(VPtrStealingHackType) { }
JSCell(JSGlobalData&, Structure*);
virtual ~JSCell();
static const ClassInfo s_dummyCellInfo;
public:
static Structure* createDummyStructure(JSGlobalData&);
......
......@@ -34,6 +34,8 @@ namespace JSC {
static const unsigned substringFromRopeCutoff = 4;
const ClassInfo JSString::s_info = { "string", 0, 0, 0 };
void JSString::resolveRope(ExecState* exec) const
{
ASSERT(isRope());
......
......@@ -349,7 +349,10 @@ namespace JSC {
JSValue replaceCharacter(ExecState*, UChar, const UString& replacement);
static Structure* createStructure(JSGlobalData& globalData, JSValue proto) { return Structure::create(globalData, proto, TypeInfo(StringType, OverridesGetOwnPropertySlot | NeedsThisConversion), AnonymousSlotCount, 0); }
static Structure* createStructure(JSGlobalData& globalData, JSValue proto)
{
return Structure::create(globalData, proto, TypeInfo(StringType, OverridesGetOwnPropertySlot | NeedsThisConversion), AnonymousSlotCount, &s_info);
}
private:
JSString(VPtrStealingHackType)
......@@ -357,6 +360,7 @@ namespace JSC {
, m_fiberCount(0)
{
}
static const ClassInfo s_info;
void resolveRope(ExecState*) const;
void resolveRopeSlowCase(ExecState*, UChar*) const;
......
......@@ -62,6 +62,7 @@ namespace JSC {
static Structure* create(JSGlobalData& globalData, JSValue prototype, const TypeInfo& typeInfo, unsigned anonymousSlotCount, const ClassInfo* classInfo)
{
ASSERT(globalData.structureStructure);
ASSERT(classInfo);
return new (&globalData) Structure(globalData, prototype, typeInfo, anonymousSlotCount, classInfo);
}
......@@ -167,7 +168,7 @@ namespace JSC {
ASSERT(globalData.structureStructure);
return new (&globalData) Structure(globalData, structure);
}
static const ClassInfo s_info;
typedef enum {
......@@ -276,7 +277,7 @@ namespace JSC {
inline Structure* JSCell::createDummyStructure(JSGlobalData& globalData)
{
return Structure::create(globalData, jsNull(), TypeInfo(UnspecifiedType), AnonymousSlotCount, 0);
return Structure::create(globalData, jsNull(), TypeInfo(UnspecifiedType), AnonymousSlotCount, &s_dummyCellInfo);
}
inline bool JSValue::needsThisConversion() const
......
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