Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (94034 => 94035)
--- trunk/Source/_javascript_Core/ChangeLog 2011-08-30 01:29:59 UTC (rev 94034)
+++ trunk/Source/_javascript_Core/ChangeLog 2011-08-30 01:43:46 UTC (rev 94035)
@@ -1,3 +1,79 @@
+2011-08-29 Mark Hahnenberg <[email protected]>
+
+ Unzip initialization lists and constructors in JSCell hierarchy (3/7)
+ https://bugs.webkit.org/show_bug.cgi?id=67064
+
+ Reviewed by Darin Adler.
+
+ Completed the third level of the refactoring to add finishCreation()
+ methods to all classes within the JSCell hierarchy with non-trivial
+ constructor bodies.
+
+ This primarily consists of pushing the calls to finishCreation() down
+ into the constructors of the subclasses of the second level of the hierarchy
+ as well as pulling the finishCreation() calls out into the class's corresponding
+ create() method if it has one. Doing both simultaneously allows us to
+ maintain the invariant that the finishCreation() method chain is called exactly
+ once during the creation of an object, since calling it any other number of
+ times (0, 2, or more) will cause an assertion failure.
+
+ * debugger/DebuggerActivation.cpp:
+ (JSC::DebuggerActivation::DebuggerActivation):
+ (JSC::DebuggerActivation::finishCreation):
+ * debugger/DebuggerActivation.h:
+ (JSC::DebuggerActivation::create):
+ * runtime/Arguments.h:
+ (JSC::Arguments::create):
+ (JSC::Arguments::createNoParameters):
+ (JSC::Arguments::Arguments):
+ (JSC::Arguments::finishCreation):
+ * runtime/ErrorInstance.cpp:
+ (JSC::ErrorInstance::ErrorInstance):
+ * runtime/ErrorInstance.h:
+ (JSC::ErrorInstance::finishCreation):
+ * runtime/ExceptionHelpers.cpp:
+ (JSC::InterruptedExecutionError::InterruptedExecutionError):
+ (JSC::TerminatedExecutionError::TerminatedExecutionError):
+ * runtime/Executable.cpp:
+ (JSC::EvalExecutable::EvalExecutable):
+ (JSC::ProgramExecutable::ProgramExecutable):
+ (JSC::FunctionExecutable::FunctionExecutable):
+ Moved the assignment of m_firstLine and m_lastLine into the
+ FunctionExecutable::finishCreation() method in Executable.h
+ * runtime/Executable.h:
+ (JSC::ScriptExecutable::ScriptExecutable):
+ (JSC::EvalExecutable::create):
+ (JSC::ProgramExecutable::create):
+ (JSC::FunctionExecutable::create):
+ (JSC::FunctionExecutable::finishCreation):
+ * runtime/JSArray.cpp:
+ (JSC::JSArray::JSArray):
+ (JSC::JSArray::finishCreation):
+ * runtime/JSArray.h:
+ * runtime/JSByteArray.cpp:
+ (JSC::JSByteArray::JSByteArray):
+ * runtime/JSByteArray.h:
+ (JSC::JSByteArray::finishCreation):
+ * runtime/JSNotAnObject.h:
+ (JSC::JSNotAnObject::JSNotAnObject):
+ * runtime/JSObject.h:
+ (JSC::JSNonFinalObject::JSNonFinalObject):
+ * runtime/JSObjectWithGlobalObject.cpp:
+ (JSC::JSObjectWithGlobalObject::JSObjectWithGlobalObject):
+ (JSC::JSObjectWithGlobalObject::finishCreation):
+ * runtime/JSObjectWithGlobalObject.h:
+ * runtime/JSVariableObject.h:
+ (JSC::JSVariableObject::JSVariableObject):
+ (JSC::JSVariableObject::finishCreation):
+ * runtime/JSWrapperObject.h:
+ (JSC::JSWrapperObject::JSWrapperObject):
+ * runtime/ObjectPrototype.cpp:
+ (JSC::ObjectPrototype::ObjectPrototype):
+ (JSC::ObjectPrototype::finishCreation):
+ * runtime/ObjectPrototype.h:
+ * runtime/StrictEvalActivation.cpp:
+ (JSC::StrictEvalActivation::StrictEvalActivation):
+
2011-08-29 Andreas Kling <[email protected]>
Unreviewed build fix after r93990.
Modified: trunk/Source/_javascript_Core/debugger/DebuggerActivation.cpp (94034 => 94035)
--- trunk/Source/_javascript_Core/debugger/DebuggerActivation.cpp 2011-08-30 01:29:59 UTC (rev 94034)
+++ trunk/Source/_javascript_Core/debugger/DebuggerActivation.cpp 2011-08-30 01:43:46 UTC (rev 94035)
@@ -33,6 +33,12 @@
DebuggerActivation::DebuggerActivation(JSGlobalData& globalData, JSObject* activation)
: JSNonFinalObject(globalData, globalData.debuggerActivationStructure.get())
{
+ finishCreation(globalData, activation);
+}
+
+void DebuggerActivation::finishCreation(JSGlobalData& globalData, JSObject* activation)
+{
+ Base::finishCreation(globalData);
ASSERT(activation);
ASSERT(activation->isActivationObject());
m_activation.set(globalData, this, static_cast<JSActivation*>(activation));
Modified: trunk/Source/_javascript_Core/debugger/DebuggerActivation.h (94034 => 94035)
--- trunk/Source/_javascript_Core/debugger/DebuggerActivation.h 2011-08-30 01:29:59 UTC (rev 94034)
+++ trunk/Source/_javascript_Core/debugger/DebuggerActivation.h 2011-08-30 01:43:46 UTC (rev 94035)
@@ -30,15 +30,14 @@
namespace JSC {
- class JSActivation;
-
class DebuggerActivation : public JSNonFinalObject {
public:
typedef JSNonFinalObject Base;
static DebuggerActivation* create(JSGlobalData& globalData, JSObject* object)
{
- return new (allocateCell<DebuggerActivation>(globalData.heap)) DebuggerActivation(globalData, object);
+ DebuggerActivation* activation = new (allocateCell<DebuggerActivation>(globalData.heap)) DebuggerActivation(globalData, object);
+ return activation;
}
virtual void visitChildren(SlotVisitor&);
@@ -62,6 +61,8 @@
protected:
static const unsigned StructureFlags = OverridesGetOwnPropertySlot | OverridesVisitChildren | JSObject::StructureFlags;
+ void finishCreation(JSGlobalData&, JSObject* activation);
+
private:
DebuggerActivation(JSGlobalData&, JSObject*);
WriteBarrier<JSActivation> m_activation;
Modified: trunk/Source/_javascript_Core/runtime/Arguments.h (94034 => 94035)
--- trunk/Source/_javascript_Core/runtime/Arguments.h 2011-08-30 01:29:59 UTC (rev 94034)
+++ trunk/Source/_javascript_Core/runtime/Arguments.h 2011-08-30 01:43:46 UTC (rev 94035)
@@ -63,12 +63,14 @@
static Arguments* create(JSGlobalData& globalData, CallFrame* callFrame)
{
- return new (allocateCell<Arguments>(globalData.heap)) Arguments(callFrame);
+ Arguments* arguments = new (allocateCell<Arguments>(globalData.heap)) Arguments(callFrame);
+ return arguments;
}
static Arguments* createNoParameters(JSGlobalData& globalData, CallFrame* callFrame)
{
- return new (allocateCell<Arguments>(globalData.heap)) Arguments(callFrame, NoParameters);
+ Arguments* arguments = new (allocateCell<Arguments>(globalData.heap)) Arguments(callFrame, NoParameters);
+ return arguments;
}
// Use an enum because otherwise gcc insists on doing a memory
@@ -115,6 +117,9 @@
protected:
static const unsigned StructureFlags = OverridesGetOwnPropertySlot | OverridesVisitChildren | OverridesGetPropertyNames | JSObject::StructureFlags;
+ void finishCreation(CallFrame*);
+ void finishCreation(CallFrame*, NoParametersType);
+
private:
void getArgumentsData(CallFrame*, JSFunction*&, ptrdiff_t& firstParameterIndex, Register*& argv, int& argc);
virtual bool getOwnPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&);
@@ -161,6 +166,19 @@
: JSNonFinalObject(callFrame->globalData(), callFrame->lexicalGlobalObject()->argumentsStructure())
, d(adoptPtr(new ArgumentsData))
{
+ finishCreation(callFrame);
+ }
+
+ inline Arguments::Arguments(CallFrame* callFrame, NoParametersType)
+ : JSNonFinalObject(callFrame->globalData(), callFrame->lexicalGlobalObject()->argumentsStructure())
+ , d(adoptPtr(new ArgumentsData))
+ {
+ finishCreation(callFrame, NoParameters);
+ }
+
+ inline void Arguments::finishCreation(CallFrame* callFrame)
+ {
+ Base::finishCreation(callFrame->globalData());
ASSERT(inherits(&s_info));
JSFunction* callee;
@@ -199,10 +217,9 @@
copyRegisters(callFrame->globalData());
}
- inline Arguments::Arguments(CallFrame* callFrame, NoParametersType)
- : JSNonFinalObject(callFrame->globalData(), callFrame->lexicalGlobalObject()->argumentsStructure())
- , d(adoptPtr(new ArgumentsData))
+ inline void Arguments::finishCreation(CallFrame* callFrame, NoParametersType)
{
+ Base::finishCreation(callFrame->globalData());
ASSERT(inherits(&s_info));
ASSERT(!asFunction(callFrame->callee())->jsExecutable()->parameterCount());
Modified: trunk/Source/_javascript_Core/runtime/ErrorInstance.cpp (94034 => 94035)
--- trunk/Source/_javascript_Core/runtime/ErrorInstance.cpp 2011-08-30 01:29:59 UTC (rev 94034)
+++ trunk/Source/_javascript_Core/runtime/ErrorInstance.cpp 2011-08-30 01:43:46 UTC (rev 94035)
@@ -29,15 +29,14 @@
: JSNonFinalObject(globalData, structure)
, m_appendSourceToMessage(false)
{
- constructorBody(globalData);
+ finishCreation(globalData, UString("", 0));
}
ErrorInstance::ErrorInstance(JSGlobalData& globalData, Structure* structure, const UString& message)
: JSNonFinalObject(globalData, structure)
, m_appendSourceToMessage(false)
{
- ASSERT(inherits(&s_info));
- putDirect(globalData, globalData.propertyNames->message, jsString(&globalData, message), DontEnum);
+ finishCreation(globalData, message);
}
ErrorInstance* ErrorInstance::create(JSGlobalData& globalData, Structure* structure, const UString& message)
Modified: trunk/Source/_javascript_Core/runtime/ErrorInstance.h (94034 => 94035)
--- trunk/Source/_javascript_Core/runtime/ErrorInstance.h 2011-08-30 01:29:59 UTC (rev 94034)
+++ trunk/Source/_javascript_Core/runtime/ErrorInstance.h 2011-08-30 01:43:46 UTC (rev 94035)
@@ -50,10 +50,11 @@
explicit ErrorInstance(JSGlobalData&, Structure*);
explicit ErrorInstance(JSGlobalData&, Structure*, const UString&);
- void constructorBody(JSGlobalData& globalData)
+ void finishCreation(JSGlobalData& globalData, const UString& message)
{
+ Base::finishCreation(globalData);
ASSERT(inherits(&s_info));
- putDirect(globalData, globalData.propertyNames->message, jsString(&globalData, ""), DontEnum);
+ putDirect(globalData, globalData.propertyNames->message, jsString(&globalData, message), DontEnum);
}
bool m_appendSourceToMessage;
Modified: trunk/Source/_javascript_Core/runtime/ExceptionHelpers.cpp (94034 => 94035)
--- trunk/Source/_javascript_Core/runtime/ExceptionHelpers.cpp 2011-08-30 01:29:59 UTC (rev 94034)
+++ trunk/Source/_javascript_Core/runtime/ExceptionHelpers.cpp 2011-08-30 01:43:46 UTC (rev 94035)
@@ -46,6 +46,7 @@
InterruptedExecutionError(JSGlobalData& globalData)
: JSNonFinalObject(globalData, globalData.interruptedExecutionErrorStructure.get())
{
+ finishCreation(globalData);
}
public:
@@ -71,6 +72,7 @@
TerminatedExecutionError(JSGlobalData& globalData)
: JSNonFinalObject(globalData, globalData.terminatedExecutionErrorStructure.get())
{
+ finishCreation(globalData);
}
public:
Modified: trunk/Source/_javascript_Core/runtime/Executable.cpp (94034 => 94035)
--- trunk/Source/_javascript_Core/runtime/Executable.cpp 2011-08-30 01:29:59 UTC (rev 94034)
+++ trunk/Source/_javascript_Core/runtime/Executable.cpp 2011-08-30 01:43:46 UTC (rev 94035)
@@ -127,6 +127,7 @@
EvalExecutable::EvalExecutable(ExecState* exec, const SourceCode& source, bool inStrictContext)
: ScriptExecutable(exec->globalData().evalExecutableStructure.get(), exec, source, inStrictContext)
{
+ finishCreation(exec->globalData());
}
EvalExecutable::~EvalExecutable()
@@ -138,6 +139,7 @@
ProgramExecutable::ProgramExecutable(ExecState* exec, const SourceCode& source)
: ScriptExecutable(exec->globalData().programExecutableStructure.get(), exec, source, false)
{
+ finishCreation(exec->globalData());
}
ProgramExecutable::~ProgramExecutable()
@@ -165,8 +167,6 @@
, m_name(name)
, m_symbolTable(0)
{
- m_firstLine = firstLine;
- m_lastLine = lastLine;
finishCreation(exec->globalData(), name, firstLine, lastLine);
}
Modified: trunk/Source/_javascript_Core/runtime/Executable.h (94034 => 94035)
--- trunk/Source/_javascript_Core/runtime/Executable.h 2011-08-30 01:29:59 UTC (rev 94034)
+++ trunk/Source/_javascript_Core/runtime/Executable.h 2011-08-30 01:43:46 UTC (rev 94035)
@@ -243,7 +243,6 @@
, m_source(source)
, m_features(isInStrictContext ? StrictModeFeature : 0)
{
- finishCreation(globalData);
}
ScriptExecutable(Structure* structure, ExecState* exec, const SourceCode& source, bool isInStrictContext)
@@ -251,7 +250,6 @@
, m_source(source)
, m_features(isInStrictContext ? StrictModeFeature : 0)
{
- finishCreation(exec->globalData());
}
const SourceCode& source() { return m_source; }
@@ -318,7 +316,8 @@
static EvalExecutable* create(ExecState* exec, const SourceCode& source, bool isInStrictContext)
{
- return new (allocateCell<EvalExecutable>(*exec->heap())) EvalExecutable(exec, source, isInStrictContext);
+ EvalExecutable* executable = new (allocateCell<EvalExecutable>(*exec->heap())) EvalExecutable(exec, source, isInStrictContext);
+ return executable;
}
#if ENABLE(JIT)
@@ -354,7 +353,8 @@
static ProgramExecutable* create(ExecState* exec, const SourceCode& source)
{
- return new (allocateCell<ProgramExecutable>(*exec->heap())) ProgramExecutable(exec, source);
+ ProgramExecutable* executable = new (allocateCell<ProgramExecutable>(*exec->heap())) ProgramExecutable(exec, source);
+ return executable;
}
~ProgramExecutable();
@@ -412,12 +412,14 @@
static FunctionExecutable* create(ExecState* exec, const Identifier& name, const SourceCode& source, bool forceUsesArguments, FunctionParameters* parameters, bool isInStrictContext, int firstLine, int lastLine)
{
- return new (allocateCell<FunctionExecutable>(*exec->heap())) FunctionExecutable(exec, name, source, forceUsesArguments, parameters, isInStrictContext, firstLine, lastLine);
+ FunctionExecutable* executable = new (allocateCell<FunctionExecutable>(*exec->heap())) FunctionExecutable(exec, name, source, forceUsesArguments, parameters, isInStrictContext, firstLine, lastLine);
+ return executable;
}
static FunctionExecutable* create(JSGlobalData& globalData, const Identifier& name, const SourceCode& source, bool forceUsesArguments, FunctionParameters* parameters, bool isInStrictContext, int firstLine, int lastLine)
{
- return new (allocateCell<FunctionExecutable>(globalData.heap)) FunctionExecutable(globalData, name, source, forceUsesArguments, parameters, isInStrictContext, firstLine, lastLine);
+ FunctionExecutable* executable = new (allocateCell<FunctionExecutable>(globalData.heap)) FunctionExecutable(globalData, name, source, forceUsesArguments, parameters, isInStrictContext, firstLine, lastLine);
+ return executable;
}
JSFunction* make(ExecState* exec, ScopeChainNode* scopeChain)
@@ -530,6 +532,7 @@
void finishCreation(JSGlobalData& globalData, const Identifier& name, int firstLine, int lastLine)
{
+ Base::finishCreation(globalData);
m_firstLine = firstLine;
m_lastLine = lastLine;
m_nameValue.set(globalData, this, jsString(&globalData, name.ustring()));
Modified: trunk/Source/_javascript_Core/runtime/JSArray.cpp (94034 => 94035)
--- trunk/Source/_javascript_Core/runtime/JSArray.cpp 2011-08-30 01:29:59 UTC (rev 94034)
+++ trunk/Source/_javascript_Core/runtime/JSArray.cpp 2011-08-30 01:43:46 UTC (rev 94035)
@@ -134,6 +134,24 @@
JSArray::JSArray(JSGlobalData& globalData, Structure* structure)
: JSNonFinalObject(globalData, structure)
{
+ finishCreation(globalData);
+}
+
+JSArray::JSArray(JSGlobalData& globalData, Structure* structure, unsigned initialLength, ArrayCreationMode creationMode)
+ : JSNonFinalObject(globalData, structure)
+{
+ finishCreation(globalData, initialLength, creationMode);
+}
+
+JSArray::JSArray(JSGlobalData& globalData, Structure* structure, const ArgList& list)
+ : JSNonFinalObject(globalData, structure)
+{
+ finishCreation(globalData, list);
+}
+
+void JSArray::finishCreation(JSGlobalData& globalData)
+{
+ Base::finishCreation(globalData);
ASSERT(inherits(&s_info));
unsigned initialCapacity = 0;
@@ -148,9 +166,9 @@
Heap::heap(this)->reportExtraMemoryCost(storageSize(0));
}
-JSArray::JSArray(JSGlobalData& globalData, Structure* structure, unsigned initialLength, ArrayCreationMode creationMode)
- : JSNonFinalObject(globalData, structure)
+void JSArray::finishCreation(JSGlobalData& globalData, unsigned initialLength, ArrayCreationMode creationMode)
{
+ Base::finishCreation(globalData);
ASSERT(inherits(&s_info));
unsigned initialCapacity;
@@ -190,9 +208,9 @@
Heap::heap(this)->reportExtraMemoryCost(storageSize(initialCapacity));
}
-JSArray::JSArray(JSGlobalData& globalData, Structure* structure, const ArgList& list)
- : JSNonFinalObject(globalData, structure)
+void JSArray::finishCreation(JSGlobalData& globalData, const ArgList& list)
{
+ Base::finishCreation(globalData);
ASSERT(inherits(&s_info));
unsigned initialCapacity = list.size();
Modified: trunk/Source/_javascript_Core/runtime/JSArray.h (94034 => 94035)
--- trunk/Source/_javascript_Core/runtime/JSArray.h 2011-08-30 01:29:59 UTC (rev 94034)
+++ trunk/Source/_javascript_Core/runtime/JSArray.h 2011-08-30 01:43:46 UTC (rev 94035)
@@ -64,7 +64,11 @@
explicit JSArray(JSGlobalData&, Structure*);
JSArray(JSGlobalData&, Structure*, unsigned initialLength, ArrayCreationMode);
JSArray(JSGlobalData&, Structure*, const ArgList& initialValues);
-
+
+ void finishCreation(JSGlobalData&);
+ void finishCreation(JSGlobalData&, unsigned initialLength, ArrayCreationMode);
+ void finishCreation(JSGlobalData&, const ArgList&);
+
public:
typedef JSNonFinalObject Base;
Modified: trunk/Source/_javascript_Core/runtime/JSByteArray.cpp (94034 => 94035)
--- trunk/Source/_javascript_Core/runtime/JSByteArray.cpp 2011-08-30 01:29:59 UTC (rev 94034)
+++ trunk/Source/_javascript_Core/runtime/JSByteArray.cpp 2011-08-30 01:43:46 UTC (rev 94035)
@@ -39,7 +39,7 @@
: JSNonFinalObject(exec->globalData(), structure)
, m_storage(storage)
{
- constructorBody(exec);
+ finishCreation(exec);
}
JSByteArray* JSByteArray::create(ExecState* exec, Structure* structure, ByteArray* storage)
Modified: trunk/Source/_javascript_Core/runtime/JSByteArray.h (94034 => 94035)
--- trunk/Source/_javascript_Core/runtime/JSByteArray.h 2011-08-30 01:29:59 UTC (rev 94034)
+++ trunk/Source/_javascript_Core/runtime/JSByteArray.h 2011-08-30 01:43:46 UTC (rev 94035)
@@ -104,8 +104,9 @@
protected:
static const unsigned StructureFlags = OverridesGetOwnPropertySlot | OverridesGetPropertyNames | JSObject::StructureFlags;
- void constructorBody(ExecState* exec)
+ void finishCreation(ExecState* exec)
{
+ Base::finishCreation(exec->globalData());
putDirect(exec->globalData(), exec->globalData().propertyNames->length, jsNumber(m_storage->length()), ReadOnly | DontDelete);
}
Modified: trunk/Source/_javascript_Core/runtime/JSNotAnObject.h (94034 => 94035)
--- trunk/Source/_javascript_Core/runtime/JSNotAnObject.h 2011-08-30 01:29:59 UTC (rev 94034)
+++ trunk/Source/_javascript_Core/runtime/JSNotAnObject.h 2011-08-30 01:43:46 UTC (rev 94035)
@@ -41,6 +41,7 @@
JSNotAnObject(ExecState* exec)
: JSNonFinalObject(exec->globalData(), exec->globalData().notAnObjectStructure.get())
{
+ finishCreation(exec->globalData());
}
public:
Modified: trunk/Source/_javascript_Core/runtime/JSObject.h (94034 => 94035)
--- trunk/Source/_javascript_Core/runtime/JSObject.h 2011-08-30 01:29:59 UTC (rev 94034)
+++ trunk/Source/_javascript_Core/runtime/JSObject.h 2011-08-30 01:43:46 UTC (rev 94035)
@@ -361,7 +361,6 @@
explicit JSNonFinalObject(JSGlobalData& globalData, Structure* structure)
: JSObject(globalData, structure, m_inlineStorage)
{
- finishCreation(globalData);
}
void finishCreation(JSGlobalData& globalData)
Modified: trunk/Source/_javascript_Core/runtime/JSObjectWithGlobalObject.cpp (94034 => 94035)
--- trunk/Source/_javascript_Core/runtime/JSObjectWithGlobalObject.cpp 2011-08-30 01:29:59 UTC (rev 94034)
+++ trunk/Source/_javascript_Core/runtime/JSObjectWithGlobalObject.cpp 2011-08-30 01:43:46 UTC (rev 94035)
@@ -33,17 +33,18 @@
JSObjectWithGlobalObject::JSObjectWithGlobalObject(JSGlobalObject* globalObject, Structure* structure)
: JSNonFinalObject(globalObject->globalData(), structure)
{
- COMPILE_ASSERT(AnonymousSlotCount == 1, AnonymousSlotCount_must_be_one);
- ASSERT(!globalObject || globalObject->isGlobalObject());
- if (!globalObject)
- clearAnonymousValue(GlobalObjectSlot);
- else
- putAnonymousValue(globalObject->globalData(), GlobalObjectSlot, globalObject);
+ finishCreation(globalObject->globalData(), globalObject);
}
JSObjectWithGlobalObject::JSObjectWithGlobalObject(JSGlobalData& globalData, JSGlobalObject* globalObject, Structure* structure)
: JSNonFinalObject(globalData, structure)
{
+ finishCreation(globalData, globalObject);
+}
+
+void JSObjectWithGlobalObject::finishCreation(JSGlobalData& globalData, JSGlobalObject* globalObject)
+{
+ Base::finishCreation(globalData);
COMPILE_ASSERT(AnonymousSlotCount == 1, AnonymousSlotCount_must_be_one);
ASSERT(!globalObject || globalObject->isGlobalObject());
if (!globalObject)
Modified: trunk/Source/_javascript_Core/runtime/JSObjectWithGlobalObject.h (94034 => 94035)
--- trunk/Source/_javascript_Core/runtime/JSObjectWithGlobalObject.h 2011-08-30 01:29:59 UTC (rev 94034)
+++ trunk/Source/_javascript_Core/runtime/JSObjectWithGlobalObject.h 2011-08-30 01:43:46 UTC (rev 94035)
@@ -34,6 +34,8 @@
class JSObjectWithGlobalObject : public JSNonFinalObject {
public:
+ typedef JSNonFinalObject Base;
+
static Structure* createStructure(JSGlobalData& globalData, JSValue proto)
{
return Structure::create(globalData, proto, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
@@ -53,6 +55,9 @@
{
// Should only be used by JSFunction when we aquire the JSFunction vptr.
}
+
+ void finishCreation(JSGlobalData&, JSGlobalObject*);
+
static const unsigned AnonymousSlotCount = JSObject::AnonymousSlotCount + 1;
static const unsigned GlobalObjectSlot = 0;
};
Modified: trunk/Source/_javascript_Core/runtime/JSVariableObject.h (94034 => 94035)
--- trunk/Source/_javascript_Core/runtime/JSVariableObject.h 2011-08-30 01:29:59 UTC (rev 94034)
+++ trunk/Source/_javascript_Core/runtime/JSVariableObject.h 2011-08-30 01:43:46 UTC (rev 94035)
@@ -74,6 +74,12 @@
, m_symbolTable(symbolTable)
, m_registers(reinterpret_cast<WriteBarrier<Unknown>*>(registers))
{
+ finishCreation(globalData);
+ }
+
+ void finishCreation(JSGlobalData& globalData)
+ {
+ Base::finishCreation(globalData);
ASSERT(m_symbolTable);
COMPILE_ASSERT(sizeof(WriteBarrier<Unknown>) == sizeof(Register), Register_should_be_same_size_as_WriteBarrier);
}
Modified: trunk/Source/_javascript_Core/runtime/JSWrapperObject.h (94034 => 94035)
--- trunk/Source/_javascript_Core/runtime/JSWrapperObject.h 2011-08-30 01:29:59 UTC (rev 94034)
+++ trunk/Source/_javascript_Core/runtime/JSWrapperObject.h 2011-08-30 01:43:46 UTC (rev 94035)
@@ -53,6 +53,7 @@
inline JSWrapperObject::JSWrapperObject(JSGlobalData& globalData, Structure* structure)
: JSNonFinalObject(globalData, structure)
{
+ finishCreation(globalData);
}
inline JSValue JSWrapperObject::internalValue() const
Modified: trunk/Source/_javascript_Core/runtime/ObjectPrototype.cpp (94034 => 94035)
--- trunk/Source/_javascript_Core/runtime/ObjectPrototype.cpp 2011-08-30 01:29:59 UTC (rev 94034)
+++ trunk/Source/_javascript_Core/runtime/ObjectPrototype.cpp 2011-08-30 01:43:46 UTC (rev 94035)
@@ -67,6 +67,12 @@
: JSNonFinalObject(exec->globalData(), stucture)
, m_hasNoPropertiesWithUInt32Names(true)
{
+ finishCreation(exec->globalData(), globalObject);
+}
+
+void ObjectPrototype::finishCreation(JSGlobalData& globalData, JSGlobalObject* globalObject)
+{
+ Base::finishCreation(globalData);
ASSERT(inherits(&s_info));
putAnonymousValue(globalObject->globalData(), 0, globalObject);
}
Modified: trunk/Source/_javascript_Core/runtime/ObjectPrototype.h (94034 => 94035)
--- trunk/Source/_javascript_Core/runtime/ObjectPrototype.h 2011-08-30 01:29:59 UTC (rev 94034)
+++ trunk/Source/_javascript_Core/runtime/ObjectPrototype.h 2011-08-30 01:43:46 UTC (rev 94035)
@@ -45,6 +45,8 @@
static const unsigned StructureFlags = OverridesGetOwnPropertySlot | JSNonFinalObject::StructureFlags;
static const unsigned AnonymousSlotCount = JSNonFinalObject::AnonymousSlotCount + 1;
+ void finishCreation(JSGlobalData&, JSGlobalObject*);
+
private:
ObjectPrototype(ExecState*, JSGlobalObject*, Structure*);
virtual void put(ExecState*, const Identifier&, JSValue, PutPropertySlot&);
Modified: trunk/Source/_javascript_Core/runtime/StrictEvalActivation.cpp (94034 => 94035)
--- trunk/Source/_javascript_Core/runtime/StrictEvalActivation.cpp 2011-08-30 01:29:59 UTC (rev 94034)
+++ trunk/Source/_javascript_Core/runtime/StrictEvalActivation.cpp 2011-08-30 01:43:46 UTC (rev 94035)
@@ -31,6 +31,7 @@
StrictEvalActivation::StrictEvalActivation(ExecState* exec)
: JSNonFinalObject(exec->globalData(), exec->globalData().strictEvalActivationStructure.get())
{
+ finishCreation(exec->globalData());
}
bool StrictEvalActivation::deleteProperty(ExecState*, const Identifier&)
Modified: trunk/Source/_javascript_Glue/ChangeLog (94034 => 94035)
--- trunk/Source/_javascript_Glue/ChangeLog 2011-08-30 01:29:59 UTC (rev 94034)
+++ trunk/Source/_javascript_Glue/ChangeLog 2011-08-30 01:43:46 UTC (rev 94035)
@@ -1,3 +1,25 @@
+2011-08-29 Mark Hahnenberg <[email protected]>
+
+ Unzip initialization lists and constructors in JSCell hierarchy (3/7)
+ https://bugs.webkit.org/show_bug.cgi?id=67064
+
+ Reviewed by Darin Adler.
+
+ Completed the third level of the refactoring to add finishCreation()
+ methods to all classes within the JSCell hierarchy with non-trivial
+ constructor bodies.
+
+ This primarily consists of pushing the calls to finishCreation() down
+ into the constructors of the subclasses of the second level of the hierarchy
+ as well as pulling the finishCreation() calls out into the class's corresponding
+ create() method if it has one. Doing both simultaneously allows us to
+ maintain the invariant that the finishCreation() method chain is called exactly
+ once during the creation of an object, since calling it any other number of
+ times (0, 2, or more) will cause an assertion failure.
+
+ * UserObjectImp.cpp:
+ (UserObjectImp::UserObjectImp):
+
2011-08-15 Mark Hahnenberg <[email protected]>
Refactor JS objects to allocate in static create methods rather than constructors
Modified: trunk/Source/_javascript_Glue/UserObjectImp.cpp (94034 => 94035)
--- trunk/Source/_javascript_Glue/UserObjectImp.cpp 2011-08-30 01:29:59 UTC (rev 94034)
+++ trunk/Source/_javascript_Glue/UserObjectImp.cpp 2011-08-30 01:43:46 UTC (rev 94035)
@@ -38,6 +38,7 @@
: JSNonFinalObject(globalData, structure)
, fJSUserObject((JSUserObject*)userObject->Retain())
{
+ finishCreation(globalData);
}
UserObjectImp::~UserObjectImp()
Modified: trunk/Source/WebCore/ChangeLog (94034 => 94035)
--- trunk/Source/WebCore/ChangeLog 2011-08-30 01:29:59 UTC (rev 94034)
+++ trunk/Source/WebCore/ChangeLog 2011-08-30 01:43:46 UTC (rev 94035)
@@ -1,3 +1,29 @@
+2011-08-29 Mark Hahnenberg <[email protected]>
+
+ Unzip initialization lists and constructors in JSCell hierarchy (3/7)
+ https://bugs.webkit.org/show_bug.cgi?id=67064
+
+ Reviewed by Darin Adler.
+
+ No new tests.
+
+ Completed the third level of the refactoring to add finishCreation()
+ methods to all classes within the JSCell hierarchy with non-trivial
+ constructor bodies.
+
+ This primarily consists of pushing the calls to finishCreation() down
+ into the constructors of the subclasses of the second level of the hierarchy
+ as well as pulling the finishCreation() calls out into the class's corresponding
+ create() method if it has one. Doing both simultaneously allows us to
+ maintain the invariant that the finishCreation() method chain is called exactly
+ once during the creation of an object, since calling it any other number of
+ times (0, 2, or more) will cause an assertion failure.
+
+ * bindings/js/JSDOMWindowShell.cpp:
+ (WebCore::JSDOMWindowShell::JSDOMWindowShell):
+ (WebCore::JSDOMWindowShell::finishCreation):
+ * bindings/js/JSDOMWindowShell.h:
+
2011-08-29 John Bauman <[email protected]>
Speed up texImage from BGRA
Modified: trunk/Source/WebCore/bindings/js/JSDOMWindowShell.cpp (94034 => 94035)
--- trunk/Source/WebCore/bindings/js/JSDOMWindowShell.cpp 2011-08-30 01:29:59 UTC (rev 94034)
+++ trunk/Source/WebCore/bindings/js/JSDOMWindowShell.cpp 2011-08-30 01:43:46 UTC (rev 94035)
@@ -47,6 +47,12 @@
: Base(*world->globalData(), structure)
, m_world(world)
{
+ finishCreation(*world->globalData(), window);
+}
+
+void JSDOMWindowShell::finishCreation(JSGlobalData& globalData, PassRefPtr<DOMWindow> window)
+{
+ Base::finishCreation(globalData);
ASSERT(inherits(&s_info));
setWindow(window);
}
Modified: trunk/Source/WebCore/bindings/js/JSDOMWindowShell.h (94034 => 94035)
--- trunk/Source/WebCore/bindings/js/JSDOMWindowShell.h 2011-08-30 01:29:59 UTC (rev 94034)
+++ trunk/Source/WebCore/bindings/js/JSDOMWindowShell.h 2011-08-30 01:43:46 UTC (rev 94035)
@@ -64,6 +64,9 @@
DOMWrapperWorld* world() { return m_world.get(); }
+ protected:
+ void finishCreation(JSC::JSGlobalData&, PassRefPtr<DOMWindow>);
+
private:
static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::OverridesVisitChildren | JSC::OverridesGetPropertyNames | Base::StructureFlags;