Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (93834 => 93835)
--- trunk/Source/_javascript_Core/ChangeLog 2011-08-25 23:19:26 UTC (rev 93834)
+++ trunk/Source/_javascript_Core/ChangeLog 2011-08-25 23:30:14 UTC (rev 93835)
@@ -1,3 +1,49 @@
+2011-08-25 Mark Hahnenberg <[email protected]>
+
+ Unzip initialization lists and constructors in JSCell hierarchy (1/7)
+ https://bugs.webkit.org/show_bug.cgi?id=66827
+
+ Reviewed by Geoffrey Garen.
+
+ Added finishCreation() methods to all immediately subclasses of JSCell with
+ non-empty constructors. Part of a larger refactoring to "unzip" initialization
+ lists and constructor bodies. Also renamed JSCell's constructorBody() method
+ to finishCreation().
+
+ * runtime/Executable.h:
+ (JSC::ExecutableBase::ExecutableBase):
+ (JSC::ExecutableBase::constructorBody):
+ * runtime/GetterSetter.h:
+ (JSC::GetterSetter::GetterSetter):
+ * runtime/JSAPIValueWrapper.h:
+ (JSC::JSAPIValueWrapper::constructorBody):
+ (JSC::JSAPIValueWrapper::JSAPIValueWrapper):
+ * runtime/JSCell.h:
+ (JSC::JSCell::JSCell::JSCell):
+ (JSC::JSCell::JSCell::constructorBody):
+ * runtime/JSObject.h:
+ (JSC::JSObject::constructorBody):
+ (JSC::JSObject::JSObject):
+ * runtime/JSPropertyNameIterator.h:
+ (JSC::JSPropertyNameIterator::constructorBody):
+ * runtime/JSString.h:
+ (JSC::RopeBuilder::JSString):
+ (JSC::RopeBuilder::constructorBody):
+ * runtime/RegExp.cpp:
+ (JSC::RegExp::RegExp):
+ (JSC::RegExp::constructorBody):
+ * runtime/RegExp.h:
+ * runtime/ScopeChain.h:
+ (JSC::ScopeChainNode::ScopeChainNode):
+ (JSC::ScopeChainNode::constructorBody):
+ * runtime/Structure.cpp:
+ (JSC::Structure::Structure):
+ * runtime/StructureChain.cpp:
+ (JSC::StructureChain::StructureChain):
+ * runtime/StructureChain.h:
+ (JSC::StructureChain::create):
+ (JSC::StructureChain::constructorBody):
+
2011-08-25 Gabor Loki <[email protected]>
REGRESSION(r93755): It made 14 jsc test and ~500 layout test fail on Qt-ARM bot
Modified: trunk/Source/_javascript_Core/runtime/Executable.cpp (93834 => 93835)
--- trunk/Source/_javascript_Core/runtime/Executable.cpp 2011-08-25 23:19:26 UTC (rev 93834)
+++ trunk/Source/_javascript_Core/runtime/Executable.cpp 2011-08-25 23:30:14 UTC (rev 93835)
@@ -142,7 +142,7 @@
, m_name(name)
, m_symbolTable(0)
{
- constructorBody(globalData, name, firstLine, lastLine);
+ finishCreation(globalData, name, firstLine, lastLine);
}
FunctionExecutable::FunctionExecutable(ExecState* exec, const Identifier& name, const SourceCode& source, bool forceUsesArguments, FunctionParameters* parameters, bool inStrictContext, int firstLine, int lastLine)
@@ -155,7 +155,7 @@
{
m_firstLine = firstLine;
m_lastLine = lastLine;
- constructorBody(exec->globalData(), name, firstLine, lastLine);
+ finishCreation(exec->globalData(), name, firstLine, lastLine);
}
Modified: trunk/Source/_javascript_Core/runtime/Executable.h (93834 => 93835)
--- trunk/Source/_javascript_Core/runtime/Executable.h 2011-08-25 23:19:26 UTC (rev 93834)
+++ trunk/Source/_javascript_Core/runtime/Executable.h 2011-08-25 23:30:14 UTC (rev 93835)
@@ -58,6 +58,12 @@
, m_numParametersForCall(numParameters)
, m_numParametersForConstruct(numParameters)
{
+ finishCreation(globalData);
+ }
+
+ void finishCreation(JSGlobalData& globalData)
+ {
+ Base::finishCreation(globalData);
#if ENABLE(JIT)
Weak<ExecutableBase> finalizer(globalData, this, executableFinalizer());
finalizer.leakHandle();
@@ -505,7 +511,7 @@
static const ClassInfo s_info;
protected:
- void constructorBody(JSGlobalData& globalData, const Identifier& name, int firstLine, int lastLine)
+ void finishCreation(JSGlobalData& globalData, const Identifier& name, int firstLine, int lastLine)
{
m_firstLine = firstLine;
m_lastLine = lastLine;
Modified: trunk/Source/_javascript_Core/runtime/GetterSetter.h (93834 => 93835)
--- trunk/Source/_javascript_Core/runtime/GetterSetter.h 2011-08-25 23:19:26 UTC (rev 93834)
+++ trunk/Source/_javascript_Core/runtime/GetterSetter.h 2011-08-25 23:30:14 UTC (rev 93835)
@@ -41,6 +41,7 @@
GetterSetter(ExecState* exec)
: JSCell(exec->globalData(), exec->globalData().getterSetterStructure.get())
{
+ finishCreation(exec->globalData());
}
public:
Modified: trunk/Source/_javascript_Core/runtime/JSAPIValueWrapper.h (93834 => 93835)
--- trunk/Source/_javascript_Core/runtime/JSAPIValueWrapper.h 2011-08-25 23:19:26 UTC (rev 93834)
+++ trunk/Source/_javascript_Core/runtime/JSAPIValueWrapper.h 2011-08-25 23:30:14 UTC (rev 93835)
@@ -24,6 +24,7 @@
#define JSAPIValueWrapper_h
#include "JSCell.h"
+#include "JSValue.h"
#include "CallFrame.h"
#include "Structure.h"
@@ -50,12 +51,19 @@
return new (allocateCell<JSAPIValueWrapper>(*exec->heap())) JSAPIValueWrapper(exec, value);
}
+ protected:
+ void finishCreation(ExecState* exec, JSValue value)
+ {
+ Base::finishCreation(exec->globalData());
+ m_value.set(exec->globalData(), this, value);
+ ASSERT(!value.isCell());
+ }
+
private:
JSAPIValueWrapper(ExecState* exec, JSValue value)
: JSCell(exec->globalData(), exec->globalData().apiWrapperStructure.get())
{
- m_value.set(exec->globalData(), this, value);
- ASSERT(!value.isCell());
+ finishCreation(exec, value);
}
WriteBarrier<Unknown> m_value;
Modified: trunk/Source/_javascript_Core/runtime/JSCell.h (93834 => 93835)
--- trunk/Source/_javascript_Core/runtime/JSCell.h 2011-08-25 23:19:26 UTC (rev 93834)
+++ trunk/Source/_javascript_Core/runtime/JSCell.h 2011-08-25 23:30:14 UTC (rev 93835)
@@ -80,7 +80,7 @@
private:
explicit JSCell(VPtrStealingHackType) { }
JSCell(JSGlobalData&, Structure*);
- JSCell(JSGlobalData&, Structure*, CreatingEarlyCellTag);
+ JSCell(CreatingEarlyCellTag);
virtual ~JSCell();
public:
@@ -151,8 +151,8 @@
protected:
static const unsigned AnonymousSlotCount = 0;
- void constructorBody(JSGlobalData&);
- void constructorBody(JSGlobalData&, Structure*, CreatingEarlyCellTag);
+ void finishCreation(JSGlobalData&);
+ void finishCreation(JSGlobalData&, Structure*, CreatingEarlyCellTag);
private:
// Base implementation; for non-object classes implements getPropertySlot.
@@ -170,15 +170,13 @@
inline JSCell::JSCell(JSGlobalData& globalData, Structure* structure)
: m_structure(globalData, this, structure)
{
- constructorBody(globalData);
}
- inline JSCell::JSCell(JSGlobalData& globalData, Structure* structure, CreatingEarlyCellTag)
+ inline JSCell::JSCell(CreatingEarlyCellTag)
{
- constructorBody(globalData, structure, CreatingEarlyCell);
}
- inline void JSCell::constructorBody(JSGlobalData& globalData)
+ inline void JSCell::finishCreation(JSGlobalData& globalData)
{
#if ENABLE(GC_VALIDATION)
ASSERT(globalData.isInitializingObject());
@@ -189,9 +187,10 @@
ASSERT(m_structure);
}
- inline void JSCell::constructorBody(JSGlobalData& globalData, Structure* structure, CreatingEarlyCellTag)
+ inline void JSCell::finishCreation(JSGlobalData& globalData, Structure* structure, CreatingEarlyCellTag)
{
#if ENABLE(GC_VALIDATION)
+ ASSERT(globalData.isInitializingObject());
globalData.setInitializingObject(false);
if (structure)
#endif
Modified: trunk/Source/_javascript_Core/runtime/JSObject.h (93834 => 93835)
--- trunk/Source/_javascript_Core/runtime/JSObject.h 2011-08-25 23:19:26 UTC (rev 93834)
+++ trunk/Source/_javascript_Core/runtime/JSObject.h 2011-08-25 23:30:14 UTC (rev 93835)
@@ -259,6 +259,17 @@
static JS_EXPORTDATA const ClassInfo s_info;
protected:
+ void finishCreation(JSGlobalData& globalData, PropertyStorage inlineStorage)
+ {
+ Base::finishCreation(globalData);
+ ASSERT(inherits(&s_info));
+ ASSERT(m_structure->propertyStorageCapacity() < baseExternalStorageCapacity);
+ ASSERT(m_structure->isEmpty());
+ ASSERT(prototype().isNull() || Heap::heap(this) == Heap::heap(prototype()));
+ ASSERT(static_cast<void*>(inlineStorage) == static_cast<void*>(this + 1));
+ ASSERT(m_structure->typeInfo().type() == ObjectType);
+ }
+
static Structure* createStructure(JSGlobalData& globalData, JSValue prototype)
{
return Structure::create(globalData, prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
@@ -435,12 +446,7 @@
: JSCell(globalData, structure)
, 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()));
- ASSERT(static_cast<void*>(inlineStorage) == static_cast<void*>(this + 1));
- ASSERT(m_structure->typeInfo().type() == ObjectType);
+ finishCreation(globalData, inlineStorage);
}
inline JSObject::~JSObject()
Modified: trunk/Source/_javascript_Core/runtime/JSPropertyNameIterator.cpp (93834 => 93835)
--- trunk/Source/_javascript_Core/runtime/JSPropertyNameIterator.cpp 2011-08-25 23:19:26 UTC (rev 93834)
+++ trunk/Source/_javascript_Core/runtime/JSPropertyNameIterator.cpp 2011-08-25 23:30:14 UTC (rev 93835)
@@ -43,7 +43,7 @@
, m_jsStringsSize(propertyNameArrayData->propertyNameVector().size())
, m_jsStrings(adoptArrayPtr(new WriteBarrier<Unknown>[m_jsStringsSize]))
{
- constructorBody(exec, propertyNameArrayData);
+ finishCreation(exec, propertyNameArrayData);
}
JSPropertyNameIterator* JSPropertyNameIterator::create(ExecState* exec, JSObject* o)
Modified: trunk/Source/_javascript_Core/runtime/JSPropertyNameIterator.h (93834 => 93835)
--- trunk/Source/_javascript_Core/runtime/JSPropertyNameIterator.h 2011-08-25 23:19:26 UTC (rev 93834)
+++ trunk/Source/_javascript_Core/runtime/JSPropertyNameIterator.h 2011-08-25 23:30:14 UTC (rev 93835)
@@ -85,8 +85,9 @@
static const ClassInfo s_info;
protected:
- void constructorBody(ExecState* exec, PropertyNameArrayData* propertyNameArrayData)
+ void finishCreation(ExecState* exec, PropertyNameArrayData* propertyNameArrayData)
{
+ Base::finishCreation(exec->globalData());
PropertyNameArrayData::PropertyNameVector& propertyNameVector = propertyNameArrayData->propertyNameVector();
for (size_t i = 0; i < m_jsStringsSize; ++i)
m_jsStrings[i].set(exec->globalData(), this, jsOwnedString(exec, propertyNameVector[i].ustring()));
Modified: trunk/Source/_javascript_Core/runtime/JSString.h (93834 => 93835)
--- trunk/Source/_javascript_Core/runtime/JSString.h 2011-08-25 23:19:26 UTC (rev 93834)
+++ trunk/Source/_javascript_Core/runtime/JSString.h 2011-08-25 23:30:14 UTC (rev 93835)
@@ -190,8 +190,6 @@
, m_value(value)
, m_fiberCount(0)
{
- ASSERT(!m_value.isNull());
- Heap::heap(this)->reportExtraMemoryCost(value.impl()->cost());
}
enum HasOtherOwnerType { HasOtherOwner };
@@ -201,8 +199,6 @@
, m_value(value)
, m_fiberCount(0)
{
- ASSERT(!m_value.isNull());
- Heap::heap(this)->reportExtraMemoryCost(value.impl()->cost());
}
JSString(JSGlobalData& globalData, PassRefPtr<StringImpl> value, HasOtherOwnerType)
: JSCell(globalData, globalData.stringStructure.get())
@@ -210,14 +206,12 @@
, m_value(value)
, m_fiberCount(0)
{
- ASSERT(!m_value.isNull());
}
JSString(JSGlobalData& globalData, PassRefPtr<RopeImpl> rope)
: JSCell(globalData, globalData.stringStructure.get())
, m_length(rope->length())
, m_fiberCount(1)
{
- m_fibers[0] = rope.leakRef();
}
// This constructor constructs a new string by concatenating s1 & s2.
// This should only be called with fiberCount <= 3.
@@ -226,11 +220,6 @@
, m_length(s1->length() + s2->length())
, m_fiberCount(fiberCount)
{
- ASSERT(fiberCount <= s_maxInternalRopeLength);
- unsigned index = 0;
- appendStringInConstruct(index, s1);
- appendStringInConstruct(index, s2);
- ASSERT(fiberCount == index);
}
// This constructor constructs a new string by concatenating s1 & s2.
// This should only be called with fiberCount <= 3.
@@ -239,11 +228,6 @@
, m_length(s1->length() + u2.length())
, m_fiberCount(fiberCount)
{
- ASSERT(fiberCount <= s_maxInternalRopeLength);
- unsigned index = 0;
- appendStringInConstruct(index, s1);
- appendStringInConstruct(index, u2);
- ASSERT(fiberCount == index);
}
// This constructor constructs a new string by concatenating s1 & s2.
// This should only be called with fiberCount <= 3.
@@ -252,22 +236,12 @@
, m_length(u1.length() + s2->length())
, m_fiberCount(fiberCount)
{
- ASSERT(fiberCount <= s_maxInternalRopeLength);
- unsigned index = 0;
- appendStringInConstruct(index, u1);
- appendStringInConstruct(index, s2);
- ASSERT(fiberCount == index);
}
- // This constructor constructs a new string by concatenating v1, v2 & v3.
- // This should only be called with fiberCount <= 3 ... which since every
- // value must require a fiberCount of at least one implies that the length
- // for each value must be exactly 1!
- JSString(ExecState* exec, JSValue v1, JSValue v2, JSValue v3)
+ JSString(ExecState* exec)
: JSCell(exec->globalData(), exec->globalData().stringStructure.get())
, m_length(0)
, m_fiberCount(s_maxInternalRopeLength)
{
- constructorBody(exec, v1, v2, v3);
}
// This constructor constructs a new string by concatenating u1 & u2.
@@ -276,10 +250,6 @@
, m_length(u1.length() + u2.length())
, m_fiberCount(2)
{
- unsigned index = 0;
- appendStringInConstruct(index, u1);
- appendStringInConstruct(index, u2);
- ASSERT(index <= s_maxInternalRopeLength);
}
// This constructor constructs a new string by concatenating u1, u2 & u3.
@@ -288,63 +258,151 @@
, m_length(u1.length() + u2.length() + u3.length())
, m_fiberCount(s_maxInternalRopeLength)
{
+ }
+
+ void finishCreation(JSGlobalData& globalData, const UString& value)
+ {
+ Base::finishCreation(globalData);
+ ASSERT(!m_value.isNull());
+ Heap::heap(this)->reportExtraMemoryCost(value.impl()->cost());
+ }
+
+ void finishCreation(JSGlobalData& globalData)
+ {
+ Base::finishCreation(globalData);
+ ASSERT(!m_value.isNull());
+ }
+
+ void finishCreation(JSGlobalData& globalData, PassRefPtr<RopeImpl> rope)
+ {
+ Base::finishCreation(globalData);
+ m_fibers[0] = rope.leakRef();
+ }
+
+ void finishCreation(JSGlobalData& globalData, unsigned fiberCount, JSString* s1, JSString* s2)
+ {
+ Base::finishCreation(globalData);
+ ASSERT(fiberCount <= s_maxInternalRopeLength);
unsigned index = 0;
- appendStringInConstruct(index, u1);
- appendStringInConstruct(index, u2);
- appendStringInConstruct(index, u3);
- ASSERT(index <= s_maxInternalRopeLength);
+ appendStringInCreate(index, s1);
+ appendStringInCreate(index, s2);
+ ASSERT(fiberCount == index);
}
- protected:
- void constructorBody(ExecState* exec, JSValue v1, JSValue v2, JSValue v3)
+ void finishCreation(JSGlobalData& globalData, unsigned fiberCount, JSString* s1, const UString& u2)
{
+ Base::finishCreation(globalData);
+ ASSERT(fiberCount <= s_maxInternalRopeLength);
unsigned index = 0;
- appendValueInConstructAndIncrementLength(exec, index, v1);
- appendValueInConstructAndIncrementLength(exec, index, v2);
- appendValueInConstructAndIncrementLength(exec, index, v3);
+ appendStringInCreate(index, s1);
+ appendStringInCreate(index, u2);
+ ASSERT(fiberCount == index);
+ }
+
+ void finishCreation(JSGlobalData& globalData, unsigned fiberCount, const UString& u1, JSString* s2)
+ {
+ Base::finishCreation(globalData);
+ ASSERT(fiberCount <= s_maxInternalRopeLength);
+ unsigned index = 0;
+ appendStringInCreate(index, u1);
+ appendStringInCreate(index, s2);
+ ASSERT(fiberCount == index);
+ }
+
+ // Fills in the new string by concatenating v1, v2 & v3.
+ // This should only be called with fiberCount <= 3 ... which since every
+ // value must require a fiberCount of at least one implies that the length
+ // for each value must be exactly 1!
+ void finishCreation(ExecState* exec, JSValue v1, JSValue v2, JSValue v3)
+ {
+ Base::finishCreation(exec->globalData());
+ unsigned index = 0;
+ appendValueInCreateAndIncrementLength(exec, index, v1);
+ appendValueInCreateAndIncrementLength(exec, index, v2);
+ appendValueInCreateAndIncrementLength(exec, index, v3);
ASSERT(index == s_maxInternalRopeLength);
}
+ void finishCreation(JSGlobalData& globalData, const UString& u1, const UString& u2)
+ {
+ Base::finishCreation(globalData);
+ unsigned index = 0;
+ appendStringInCreate(index, u1);
+ appendStringInCreate(index, u2);
+ ASSERT(index <= s_maxInternalRopeLength);
+ }
+
+ void finishCreation(JSGlobalData& globalData, const UString& u1, const UString& u2, const UString& u3)
+ {
+ Base::finishCreation(globalData);
+ unsigned index = 0;
+ appendStringInCreate(index, u1);
+ appendStringInCreate(index, u2);
+ appendStringInCreate(index, u3);
+ ASSERT(index <= s_maxInternalRopeLength);
+ }
+
public:
static JSString* create(JSGlobalData& globalData, const UString& value)
{
- return new (allocateCell<JSString>(globalData.heap)) JSString(globalData, value);
+ JSString* newString = new (allocateCell<JSString>(globalData.heap)) JSString(globalData, value);
+ newString->finishCreation(globalData, value);
+ return newString;
}
static JSString* createHasOtherOwner(JSGlobalData& globalData, const UString& value)
{
- return new (allocateCell<JSString>(globalData.heap)) JSString(globalData, value, HasOtherOwner);
+ JSString* newString = new (allocateCell<JSString>(globalData.heap)) JSString(globalData, value, HasOtherOwner);
+ newString->finishCreation(globalData, value);
+ return newString;
}
static JSString* createHasOtherOwner(JSGlobalData& globalData, PassRefPtr<StringImpl> value)
{
- return new (allocateCell<JSString>(globalData.heap)) JSString(globalData, value, HasOtherOwner);
+ JSString* newString = new (allocateCell<JSString>(globalData.heap)) JSString(globalData, value, HasOtherOwner);
+ newString->finishCreation(globalData);
+ return newString;
}
static JSString* create(JSGlobalData& globalData, PassRefPtr<RopeImpl> rope)
{
- return new (allocateCell<JSString>(globalData.heap)) JSString(globalData, rope);
+ RefPtr<RopeImpl> tempRope = rope;
+ JSString* newString = new (allocateCell<JSString>(globalData.heap)) JSString(globalData, tempRope);
+ newString->finishCreation(globalData, tempRope);
+ return newString;
}
static JSString* create(JSGlobalData& globalData, unsigned fiberCount, JSString* s1, JSString* s2)
{
- return new (allocateCell<JSString>(globalData.heap)) JSString(globalData, fiberCount, s1, s2);
+ JSString* newString = new (allocateCell<JSString>(globalData.heap)) JSString(globalData, fiberCount, s1, s2);
+ newString->finishCreation(globalData, fiberCount, s1, s2);
+ return newString;
}
static JSString* create(JSGlobalData& globalData, unsigned fiberCount, JSString* s1, const UString& u2)
{
- return new (allocateCell<JSString>(globalData.heap)) JSString(globalData, fiberCount, s1, u2);
+ JSString* newString = new (allocateCell<JSString>(globalData.heap)) JSString(globalData, fiberCount, s1, u2);
+ newString->finishCreation(globalData, fiberCount, s1, u2);
+ return newString;
}
static JSString* create(JSGlobalData& globalData, unsigned fiberCount, const UString& u1, JSString* s2)
{
- return new (allocateCell<JSString>(globalData.heap)) JSString(globalData, fiberCount, u1, s2);
+ JSString* newString = new (allocateCell<JSString>(globalData.heap)) JSString(globalData, fiberCount, u1, s2);
+ newString->finishCreation(globalData, fiberCount, u1, s2);
+ return newString;
}
static JSString* create(ExecState* exec, JSValue v1, JSValue v2, JSValue v3)
{
- return new (allocateCell<JSString>(*exec->heap())) JSString(exec, v1, v2, v3);
+ JSString* newString = new (allocateCell<JSString>(*exec->heap())) JSString(exec);
+ newString->finishCreation(exec, v1, v2, v3);
+ return newString;
}
static JSString* create(JSGlobalData& globalData, const UString& u1, const UString& u2)
{
- return new (allocateCell<JSString>(globalData.heap)) JSString(globalData, u1, u2);
+ JSString* newString = new (allocateCell<JSString>(globalData.heap)) JSString(globalData, u1, u2);
+ newString->finishCreation(globalData, u1, u2);
+ return newString;
}
static JSString* create(JSGlobalData& globalData, const UString& u1, const UString& u2, const UString& u3)
{
- return new (allocateCell<JSString>(globalData.heap)) JSString(globalData, u1, u2, u3);
+ JSString* newString = new (allocateCell<JSString>(globalData.heap)) JSString(globalData, u1, u2, u3);
+ newString->finishCreation(globalData, u1, u2, u3);
+ return newString;
}
~JSString()
@@ -397,7 +455,7 @@
void outOfMemory(ExecState*) const;
JSString* substringFromRope(ExecState*, unsigned offset, unsigned length);
- void appendStringInConstruct(unsigned& index, const UString& string)
+ void appendStringInCreate(unsigned& index, const UString& string)
{
StringImpl* impl = string.impl();
impl->ref();
@@ -405,7 +463,7 @@
Heap::heap(this)->reportExtraMemoryCost(string.impl()->cost());
}
- void appendStringInConstruct(unsigned& index, JSString* jsString)
+ void appendStringInCreate(unsigned& index, JSString* jsString)
{
if (jsString->isRope()) {
for (unsigned i = 0; i < jsString->m_fiberCount; ++i) {
@@ -414,16 +472,16 @@
m_fibers[index++] = fiber;
}
} else
- appendStringInConstruct(index, jsString->string());
+ appendStringInCreate(index, jsString->string());
}
- void appendValueInConstructAndIncrementLength(ExecState* exec, unsigned& index, JSValue v)
+ void appendValueInCreateAndIncrementLength(ExecState* exec, unsigned& index, JSValue v)
{
if (v.isString()) {
ASSERT(v.asCell()->isString());
JSString* s = static_cast<JSString*>(v.asCell());
ASSERT(s->fiberCount() == 1);
- appendStringInConstruct(index, s);
+ appendStringInCreate(index, s);
m_length += s->length();
} else {
UString u(v.toString(exec));
Modified: trunk/Source/_javascript_Core/runtime/RegExp.cpp (93834 => 93835)
--- trunk/Source/_javascript_Core/runtime/RegExp.cpp 2011-08-25 23:19:26 UTC (rev 93834)
+++ trunk/Source/_javascript_Core/runtime/RegExp.cpp 2011-08-25 23:30:14 UTC (rev 93835)
@@ -88,6 +88,12 @@
, m_rtMatchFoundCount(0)
#endif
{
+ finishCreation(globalData);
+}
+
+void RegExp::finishCreation(JSGlobalData& globalData)
+{
+ Base::finishCreation(globalData);
Yarr::YarrPattern pattern(m_patternString, ignoreCase(), multiline(), &m_constructionError);
if (m_constructionError)
m_state = ParseError;
Modified: trunk/Source/_javascript_Core/runtime/RegExp.h (93834 => 93835)
--- trunk/Source/_javascript_Core/runtime/RegExp.h 2011-08-25 23:19:26 UTC (rev 93834)
+++ trunk/Source/_javascript_Core/runtime/RegExp.h 2011-08-25 23:30:14 UTC (rev 93835)
@@ -75,6 +75,9 @@
RegExpKey key() { return RegExpKey(m_flags, m_patternString); }
+ protected:
+ void finishCreation(JSGlobalData&);
+
private:
friend class RegExpCache;
RegExp(JSGlobalData&, const UString&, RegExpFlags);
Modified: trunk/Source/_javascript_Core/runtime/ScopeChain.h (93834 => 93835)
--- trunk/Source/_javascript_Core/runtime/ScopeChain.h 2011-08-25 23:19:26 UTC (rev 93834)
+++ trunk/Source/_javascript_Core/runtime/ScopeChain.h 2011-08-25 23:30:14 UTC (rev 93835)
@@ -43,6 +43,13 @@
, globalObject(*globalData, this, globalObject)
, globalThis(*globalData, this, globalThis)
{
+ finishCreation(globalData, globalObject);
+ }
+
+ protected:
+ void finishCreation(JSGlobalData* globalData, JSGlobalObject* globalObject)
+ {
+ Base::finishCreation(*globalData);
ASSERT(globalData);
ASSERT(globalObject);
}
Modified: trunk/Source/_javascript_Core/runtime/Structure.cpp (93834 => 93835)
--- trunk/Source/_javascript_Core/runtime/Structure.cpp 2011-08-25 23:19:26 UTC (rev 93834)
+++ trunk/Source/_javascript_Core/runtime/Structure.cpp 2011-08-25 23:30:14 UTC (rev 93835)
@@ -176,6 +176,7 @@
, m_preventExtensions(false)
, m_didTransition(false)
{
+ finishCreation(globalData);
ASSERT(m_prototype);
ASSERT(m_prototype.isObject() || m_prototype.isNull());
}
@@ -183,7 +184,7 @@
const ClassInfo Structure::s_info = { "Structure", 0, 0, 0 };
Structure::Structure(JSGlobalData& globalData)
- : JSCell(globalData, this, CreatingEarlyCell)
+ : JSCell(CreatingEarlyCell)
, m_typeInfo(CompoundType, OverridesVisitChildren)
, m_prototype(globalData, this, jsNull())
, m_classInfo(&s_info)
@@ -199,6 +200,7 @@
, m_preventExtensions(false)
, m_didTransition(false)
{
+ finishCreation(globalData, this, CreatingEarlyCell);
ASSERT(m_prototype);
ASSERT(m_prototype.isNull());
ASSERT(!globalData.structureStructure);
@@ -221,6 +223,7 @@
, m_preventExtensions(previous->m_preventExtensions)
, m_didTransition(true)
{
+ finishCreation(globalData);
ASSERT(m_prototype);
ASSERT(m_prototype.isObject() || m_prototype.isNull());
}
Modified: trunk/Source/_javascript_Core/runtime/StructureChain.cpp (93834 => 93835)
--- trunk/Source/_javascript_Core/runtime/StructureChain.cpp 2011-08-25 23:19:26 UTC (rev 93834)
+++ trunk/Source/_javascript_Core/runtime/StructureChain.cpp 2011-08-25 23:30:14 UTC (rev 93835)
@@ -37,16 +37,7 @@
StructureChain::StructureChain(JSGlobalData& globalData, Structure* structure, Structure* head)
: JSCell(globalData, structure)
{
- size_t size = 0;
- for (Structure* current = head; current; current = current->storedPrototype().isNull() ? 0 : asObject(current->storedPrototype())->structure())
- ++size;
-
- m_vector = adoptArrayPtr(new WriteBarrier<Structure>[size + 1]);
-
- size_t i = 0;
- for (Structure* current = head; current; current = current->storedPrototype().isNull() ? 0 : asObject(current->storedPrototype())->structure())
- m_vector[i++].set(globalData, this, current);
- m_vector[i].clear();
+ finishCreation(globalData, head);
}
StructureChain::~StructureChain()
Modified: trunk/Source/_javascript_Core/runtime/StructureChain.h (93834 => 93835)
--- trunk/Source/_javascript_Core/runtime/StructureChain.h 2011-08-25 23:19:26 UTC (rev 93834)
+++ trunk/Source/_javascript_Core/runtime/StructureChain.h 2011-08-25 23:30:14 UTC (rev 93835)
@@ -27,6 +27,7 @@
#define StructureChain_h
#include "JSCell.h"
+#include "JSObject.h"
#include "Structure.h"
#include <wtf/OwnArrayPtr.h>
@@ -44,7 +45,10 @@
public:
typedef JSCell Base;
- static StructureChain* create(JSGlobalData& globalData, Structure* head) { return new (allocateCell<StructureChain>(globalData.heap)) StructureChain(globalData, globalData.structureChainStructure.get(), head); }
+ static StructureChain* create(JSGlobalData& globalData, Structure* head)
+ {
+ return new (allocateCell<StructureChain>(globalData.heap)) StructureChain(globalData, globalData.structureChainStructure.get(), head);
+ }
WriteBarrier<Structure>* head() { return m_vector.get(); }
void visitChildren(SlotVisitor&);
@@ -52,6 +56,21 @@
static ClassInfo s_info;
+ protected:
+ void finishCreation(JSGlobalData& globalData, Structure* head)
+ {
+ Base::finishCreation(globalData);
+ size_t size = 0;
+ for (Structure* current = head; current; current = current->storedPrototype().isNull() ? 0 : asObject(current->storedPrototype())->structure())
+ ++size;
+
+ m_vector = adoptArrayPtr(new WriteBarrier<Structure>[size + 1]);
+
+ size_t i = 0;
+ for (Structure* current = head; current; current = current->storedPrototype().isNull() ? 0 : asObject(current->storedPrototype())->structure())
+ m_vector[i++].set(globalData, this, current);
+ }
+
private:
StructureChain(JSGlobalData&, Structure*, Structure* head);
~StructureChain();