- ASSERT(!m_value.isNull());
- }
- JSString(JSGlobalData* globalData, PassRefPtr<StringImpl> value, HasOtherOwnerType)
- : JSCell(*globalData, globalData->stringStructure.get())
- , m_length(value->length())
- , 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.
- JSString(JSGlobalData* globalData, unsigned fiberCount, JSString* s1, JSString* s2)
- : JSCell(*globalData, globalData->stringStructure.get())
- , 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.
- JSString(JSGlobalData* globalData, unsigned fiberCount, JSString* s1, const UString& u2)
- : JSCell(*globalData, globalData->stringStructure.get())
- , 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.
- JSString(JSGlobalData* globalData, unsigned fiberCount, const UString& u1, JSString* s2)
- : JSCell(*globalData, globalData->stringStructure.get())
- , 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)
- : JSCell(exec->globalData(), exec->globalData().stringStructure.get())
- , m_length(0)
- , m_fiberCount(s_maxInternalRopeLength)
- {
- unsigned index = 0;
- appendValueInConstructAndIncrementLength(exec, index, v1);
- appendValueInConstructAndIncrementLength(exec, index, v2);
- appendValueInConstructAndIncrementLength(exec, index, v3);
- ASSERT(index == s_maxInternalRopeLength);