Ignore:
Timestamp:
Nov 14, 2011, 3:51:06 PM (14 years ago)
Author:
[email protected]
Message:

Towards 8 bit strings - Add 8 bit handling to JSString Ropes
https://bugs.webkit.org/show_bug.cgi?id=72317

Added bit to track that a rope is made up of all 8 bit fibers.
Created an 8 bit path (fast and slow cases) to handle 8 bit
only ropes.

Reviewed by Oliver Hunt.

  • runtime/JSString.cpp:

(JSC::JSString::resolveRope):
(JSC::JSString::resolveRopeSlowCase8):
(JSC::JSString::resolveRopeSlowCase16):

  • runtime/JSString.h:

(JSC::RopeBuilder::finishCreation):
(JSC::RopeBuilder::is8Bit):
(JSC::jsSubstring8):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/JSString.h

    r99754 r100202  
    2323#ifndef JSString_h
    2424#define JSString_h
    25 
    2625#include "CallFrame.h"
    2726#include "CommonIdentifiers.h"
     
    8685                m_jsString->m_fibers[m_index++].set(m_globalData, m_jsString, jsString);
    8786                m_jsString->m_length += jsString->m_length;
     87                m_jsString->m_is8Bit = m_jsString->m_is8Bit && jsString->m_is8Bit;
    8888            }
    8989
     
    128128            Base::finishCreation(globalData);
    129129            m_length = length;
     130            m_is8Bit = m_value.impl()->is8Bit();
    130131        }
    131132
     
    135136            Base::finishCreation(globalData);
    136137            m_length = length;
     138            m_is8Bit = m_value.impl()->is8Bit();
    137139            Heap::heap(this)->reportExtraMemoryCost(cost);
    138140        }
     
    142144            Base::finishCreation(globalData);
    143145            m_length = s1->length() + s2->length();
     146            m_is8Bit = (s1->is8Bit() && s2->is8Bit());
    144147            m_fibers[0].set(globalData, this, s1);
    145148            m_fibers[1].set(globalData, this, s2);
     
    150153            Base::finishCreation(globalData);
    151154            m_length = s1->length() + s2->length() + s3->length();
     155            m_is8Bit = (s1->is8Bit() && s2->is8Bit() &&  s3->is8Bit());
    152156            m_fibers[0].set(globalData, this, s1);
    153157            m_fibers[1].set(globalData, this, s2);
     
    245249
    246250        void resolveRope(ExecState*) const;
     251        void resolveRopeSlowCase(ExecState*, LChar*) const;
    247252        void resolveRopeSlowCase(ExecState*, UChar*) const;
    248253        void outOfMemory(ExecState*) const;
     
    257262
    258263        // A string is represented either by a UString or a rope of fibers.
     264        bool m_is8Bit : 1;
    259265        unsigned m_length;
    260266        mutable UString m_value;
     
    262268
    263269        bool isRope() const { return m_value.isNull(); }
     270        bool is8Bit() const { return m_is8Bit; }
    264271        UString& string() { ASSERT(!isRope()); return m_value; }
    265272
Note: See TracChangeset for help on using the changeset viewer.