Unzip initialization lists and constructors in JSCell hierarchy (1/7)

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

Patch by Mark Hahnenberg <mhahnenberg@apple.com> on 2011-08-25
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):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@93835 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent e6d0bbb1
2011-08-25 Mark Hahnenberg <mhahnenberg@apple.com>
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 <loki@webkit.org>
REGRESSION(r93755): It made 14 jsc test and ~500 layout test fail on Qt-ARM bot
......
......@@ -142,7 +142,7 @@ FunctionExecutable::FunctionExecutable(JSGlobalData& globalData, const Identifie
, 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 @@ FunctionExecutable::FunctionExecutable(ExecState* exec, const Identifier& name,
{
m_firstLine = firstLine;
m_lastLine = lastLine;
constructorBody(exec->globalData(), name, firstLine, lastLine);
finishCreation(exec->globalData(), name, firstLine, lastLine);
}
......
......@@ -58,6 +58,12 @@ namespace JSC {
, 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 @@ namespace JSC {
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;
......
......@@ -41,6 +41,7 @@ namespace JSC {
GetterSetter(ExecState* exec)
: JSCell(exec->globalData(), exec->globalData().getterSetterStructure.get())
{
finishCreation(exec->globalData());
}
public:
......
......@@ -24,6 +24,7 @@
#define JSAPIValueWrapper_h
#include "JSCell.h"
#include "JSValue.h"
#include "CallFrame.h"
#include "Structure.h"
......@@ -50,12 +51,19 @@ namespace JSC {
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;
......
......@@ -80,7 +80,7 @@ namespace JSC {
private:
explicit JSCell(VPtrStealingHackType) { }
JSCell(JSGlobalData&, Structure*);
JSCell(JSGlobalData&, Structure*, CreatingEarlyCellTag);
JSCell(CreatingEarlyCellTag);
virtual ~JSCell();
public:
......@@ -151,8 +151,8 @@ namespace JSC {
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 @@ namespace JSC {
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 @@ namespace JSC {
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
......
......@@ -259,6 +259,17 @@ namespace JSC {
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 @@ inline JSObject::JSObject(JSGlobalData& globalData, Structure* structure, Proper
: 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()
......
......@@ -43,7 +43,7 @@ inline JSPropertyNameIterator::JSPropertyNameIterator(ExecState* exec, PropertyN
, 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)
......
......@@ -85,8 +85,9 @@ namespace JSC {
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()));
......
......@@ -190,8 +190,6 @@ namespace JSC {
, m_value(value)
, m_fiberCount(0)
{
ASSERT(!m_value.isNull());
Heap::heap(this)->reportExtraMemoryCost(value.impl()->cost());
}
enum HasOtherOwnerType { HasOtherOwner };
......@@ -201,8 +199,6 @@ namespace JSC {
, 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 @@ namespace JSC {
, 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 @@ namespace JSC {
, 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 @@ namespace JSC {
, 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 @@ namespace JSC {
, 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 @@ namespace JSC {
, 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 @@ namespace JSC {
, 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);
}
void finishCreation(JSGlobalData& globalData, unsigned fiberCount, JSString* s1, const UString& u2)
{
Base::finishCreation(globalData);
ASSERT(fiberCount <= s_maxInternalRopeLength);
unsigned index = 0;
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);
}
protected:
void constructorBody(ExecState* exec, JSValue v1, JSValue v2, JSValue v3)
// 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;
appendValueInConstructAndIncrementLength(exec, index, v1);
appendValueInConstructAndIncrementLength(exec, index, v2);
appendValueInConstructAndIncrementLength(exec, index, v3);
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 @@ namespace JSC {
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 @@ namespace JSC {
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 @@ namespace JSC {
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));
......
......@@ -88,6 +88,12 @@ RegExp::RegExp(JSGlobalData& globalData, const UString& patternString, RegExpFla
, 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;
......
......@@ -75,6 +75,9 @@ namespace JSC {
RegExpKey key() { return RegExpKey(m_flags, m_patternString); }
protected:
void finishCreation(JSGlobalData&);
private:
friend class RegExpCache;
RegExp(JSGlobalData&, const UString&, RegExpFlags);
......
......@@ -43,6 +43,13 @@ namespace JSC {
, 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);
}
......
......@@ -176,6 +176,7 @@ Structure::Structure(JSGlobalData& globalData, JSValue prototype, const TypeInfo
, m_preventExtensions(false)
, m_didTransition(false)
{
finishCreation(globalData);
ASSERT(m_prototype);
ASSERT(m_prototype.isObject() || m_prototype.isNull());
}
......@@ -183,7 +184,7 @@ Structure::Structure(JSGlobalData& globalData, JSValue prototype, const TypeInfo
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 @@ Structure::Structure(JSGlobalData& globalData)
, m_preventExtensions(false)
, m_didTransition(false)
{
finishCreation(globalData, this, CreatingEarlyCell);
ASSERT(m_prototype);
ASSERT(m_prototype.isNull());
ASSERT(!globalData.structureStructure);
......@@ -221,6 +223,7 @@ Structure::Structure(JSGlobalData& globalData, const Structure* previous)
, m_preventExtensions(previous->m_preventExtensions)
, m_didTransition(true)
{
finishCreation(globalData);
ASSERT(m_prototype);
ASSERT(m_prototype.isObject() || m_prototype.isNull());
}
......
......@@ -37,16 +37,7 @@ ClassInfo StructureChain::s_info = { "StructureChain", 0, 0, 0 };
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())