Ignore:
Timestamp:
Dec 18, 2009, 2:59:18 PM (15 years ago)
Author:
[email protected]
Message:

Add createNonCopying method to UString to make replace constructor passed bool,
to make behaviour more explicit. Add createFromUTF8 to UString (wrapping method
on UString::Rep), since other cases of transliteration (e.g. from ascii) are
performed in UString constructors. Add/use setHash & size() accessors on Rep,
rather than accessing _hash/len directly.

Reviewed by Sam Weinig.

  • API/JSClassRef.cpp:

(OpaqueJSClass::OpaqueJSClass):

  • API/OpaqueJSString.cpp:

(OpaqueJSString::ustring):

(JSC::arrayProtoFuncToString):

  • runtime/Identifier.cpp:

(JSC::Identifier::equal):
(JSC::CStringTranslator::translate):
(JSC::UCharBufferTranslator::translate):
(JSC::Identifier::addSlowCase):

  • runtime/JSString.cpp:

(JSC::JSString::resolveRope):

  • runtime/JSString.h:

(JSC::JSString::Rope::Fiber::refAndGetLength):
(JSC::JSString::Rope::append):

  • runtime/StringBuilder.h:

(JSC::StringBuilder::release):

  • runtime/StringConstructor.cpp:

(JSC::stringFromCharCodeSlowCase):

  • runtime/StringPrototype.cpp:

(JSC::substituteBackreferencesSlow):
(JSC::stringProtoFuncToLowerCase):
(JSC::stringProtoFuncToUpperCase):
(JSC::stringProtoFuncFontsize):
(JSC::stringProtoFuncLink):

  • runtime/UString.cpp:

(JSC::UString::UString):
(JSC::UString::createNonCopying):
(JSC::UString::createFromUTF8):

  • runtime/UString.h:

(JSC::UString::Rep::setHash):
(JSC::UString::~UString):
(JSC::makeString):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/runtime/Identifier.cpp

    r45881 r52346  
    7878bool Identifier::equal(const UString::Rep* r, const char* s)
    7979{
    80     int length = r->len;
     80    int length = r->size();
    8181    const UChar* d = r->data();
    8282    for (int i = 0; i != length; ++i)
     
    8888bool Identifier::equal(const UString::Rep* r, const UChar* s, int length)
    8989{
    90     if (r->len != length)
     90    if (r->size() != length)
    9191        return false;
    9292    const UChar* d = r->data();
     
    116116       
    117117        UString::Rep* r = UString::Rep::create(d, static_cast<int>(length)).releaseRef();
    118         r->_hash = hash;
     118        r->setHash(hash);
    119119
    120120        location = r;
     
    181181       
    182182        UString::Rep* r = UString::Rep::create(d, buf.length).releaseRef();
    183         r->_hash = hash;
     183        r->setHash(hash);
    184184       
    185185        location = r;
     
    214214{
    215215    ASSERT(!r->identifierTable());
    216     if (r->len == 1) {
     216    if (r->size() == 1) {
    217217        UChar c = r->data()[0];
    218218        if (c <= 0xFF)
     
    225225            }
    226226    }
    227     if (!r->len) {
     227    if (!r->size()) {
    228228        UString::Rep::empty().hash();
    229229        return &UString::Rep::empty();
Note: See TracChangeset for help on using the changeset viewer.