Changeset 54804 in webkit for trunk/JavaScriptCore/runtime/JSString.cpp
- Timestamp:
- Feb 15, 2010, 5:32:06 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/runtime/JSString.cpp
r53371 r54804 32 32 namespace JSC { 33 33 34 void JSString::Rope::destructNonRecursive()34 void Rope::destructNonRecursive() 35 35 { 36 36 Vector<Rope*, 32> workQueue; … … 38 38 39 39 while (true) { 40 unsigned length = rope-> ropeLength();40 unsigned length = rope->fiberCount(); 41 41 for (unsigned i = 0; i < length; ++i) { 42 42 Fiber& fiber = rope->fibers(i); … … 62 62 } 63 63 64 JSString::Rope::~Rope()64 Rope::~Rope() 65 65 { 66 66 destructNonRecursive(); … … 83 83 // Allocate the buffer to hold the final string, position initially points to the end. 84 84 UChar* buffer; 85 if (PassRefPtr<UStringImpl> newImpl = UStringImpl::tryCreateUninitialized(m_ stringLength, buffer))85 if (PassRefPtr<UStringImpl> newImpl = UStringImpl::tryCreateUninitialized(m_length, buffer)) 86 86 m_value = newImpl; 87 87 else { 88 for (unsigned i = 0; i < m_ ropeLength; ++i) {88 for (unsigned i = 0; i < m_fiberCount; ++i) { 89 89 m_fibers[i].deref(); 90 90 m_fibers[i] = static_cast<void*>(0); 91 91 } 92 m_ ropeLength= 0;92 m_fiberCount = 0; 93 93 ASSERT(!isRope()); 94 94 ASSERT(m_value == UString()); … … 96 96 return; 97 97 } 98 UChar* position = buffer + m_ stringLength;98 UChar* position = buffer + m_length; 99 99 100 100 // Start with the current Rope. 101 101 Vector<Rope::Fiber, 32> workQueue; 102 102 Rope::Fiber currentFiber; 103 for (unsigned i = 0; i < (m_ ropeLength- 1); ++i)103 for (unsigned i = 0; i < (m_fiberCount - 1); ++i) 104 104 workQueue.append(m_fibers[i]); 105 currentFiber = m_fibers[m_ ropeLength- 1];105 currentFiber = m_fibers[m_fiberCount - 1]; 106 106 while (true) { 107 107 if (currentFiber.isRope()) { … … 109 109 // Copy the contents of the current rope into the workQueue, with the last item in 'currentFiber' 110 110 // (we will be working backwards over the rope). 111 unsigned ropeLengthMinusOne = rope->ropeLength() - 1;112 for (unsigned i = 0; i < ropeLengthMinusOne; ++i)111 unsigned fiberCountMinusOne = rope->fiberCount() - 1; 112 for (unsigned i = 0; i < fiberCountMinusOne; ++i) 113 113 workQueue.append(rope->fibers(i)); 114 currentFiber = rope->fibers( ropeLengthMinusOne);114 currentFiber = rope->fibers(fiberCountMinusOne); 115 115 } else { 116 116 UString::Rep* string = currentFiber.string(); … … 123 123 // Create a string from the UChar buffer, clear the rope RefPtr. 124 124 ASSERT(buffer == position); 125 for (unsigned i = 0; i < m_ ropeLength; ++i) {125 for (unsigned i = 0; i < m_fiberCount; ++i) { 126 126 m_fibers[i].deref(); 127 127 m_fibers[i] = static_cast<void*>(0); 128 128 } 129 m_ ropeLength= 0;129 m_fiberCount = 0; 130 130 131 131 ASSERT(!isRope()); … … 154 154 bool JSString::toBoolean(ExecState*) const 155 155 { 156 return m_ stringLength;156 return m_length; 157 157 } 158 158 … … 216 216 { 217 217 if (propertyName == exec->propertyNames().length) { 218 descriptor.setDescriptor(jsNumber(exec, m_ stringLength), DontEnum | DontDelete | ReadOnly);218 descriptor.setDescriptor(jsNumber(exec, m_length), DontEnum | DontDelete | ReadOnly); 219 219 return true; 220 220 } … … 222 222 bool isStrictUInt32; 223 223 unsigned i = propertyName.toStrictUInt32(&isStrictUInt32); 224 if (isStrictUInt32 && i < m_ stringLength) {224 if (isStrictUInt32 && i < m_length) { 225 225 descriptor.setDescriptor(jsSingleCharacterSubstring(exec, value(exec), i), DontDelete | ReadOnly); 226 226 return true;
Note:
See TracChangeset
for help on using the changeset viewer.