Ignore:
Timestamp:
Jan 3, 2016, 1:48:58 AM (9 years ago)
Author:
[email protected]
Message:

Remove redundant StringImpl substring creation function.
<https://webkit.org/b/152652>

Reviewed by Daniel Bates.

Source/JavaScriptCore:

Remove jsSubstring8() and make the only call site use jsSubstring().

  • runtime/JSString.h:

(JSC::jsSubstring8): Deleted.

  • runtime/StringPrototype.cpp:

(JSC::replaceUsingRegExpSearch):

Source/WTF:

Remove StringImpl::createSubstringSharingImpl8() and make the only
caller use createSubstringSharingImpl() instead.

They do the same thing anyway, the only difference is that the branch
on is8Bit() now happens in the callee instead of at the call site.

  • wtf/text/StringImpl.h:

(WTF::StringImpl::createSubstringSharingImpl8): Deleted.

File:
1 edited

Legend:

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

    r194496 r194509  
    4848JSString* jsSubstring(VM*, const String&, unsigned offset, unsigned length);
    4949JSString* jsSubstring(ExecState*, const String&, unsigned offset, unsigned length);
    50 JSString* jsSubstring8(VM*, const String&, unsigned offset, unsigned length);
    51 JSString* jsSubstring8(ExecState*, const String&, unsigned offset, unsigned length);
    5250
    5351// Non-trivial strings are two or more characters long.
     
    556554}
    557555
    558 inline JSString* jsSubstring8(VM* vm, const String& s, unsigned offset, unsigned length)
     556inline JSString* jsSubstring(VM* vm, const String& s, unsigned offset, unsigned length)
    559557{
    560558    ASSERT(offset <= static_cast<unsigned>(s.length()));
     
    568566            return vm->smallStrings.singleCharacterString(c);
    569567    }
    570     return JSString::createHasOtherOwner(*vm, StringImpl::createSubstringSharingImpl8(s.impl(), offset, length));
    571 }
    572 
    573 inline JSString* jsSubstring(VM* vm, const String& s, unsigned offset, unsigned length)
    574 {
    575     ASSERT(offset <= static_cast<unsigned>(s.length()));
    576     ASSERT(length <= static_cast<unsigned>(s.length()));
    577     ASSERT(offset + length <= static_cast<unsigned>(s.length()));
    578     if (!length)
    579         return vm->smallStrings.emptyString();
    580     if (length == 1) {
    581         UChar c = s.characterAt(offset);
    582         if (c <= maxSingleCharacterString)
    583             return vm->smallStrings.singleCharacterString(c);
    584     }
    585568    return JSString::createHasOtherOwner(*vm, StringImpl::createSubstringSharingImpl(s.impl(), offset, length));
    586569}
     
    607590inline JSString* jsString(ExecState* exec, const String& s) { return jsString(&exec->vm(), s); }
    608591inline JSString* jsSingleCharacterString(ExecState* exec, UChar c) { return jsSingleCharacterString(&exec->vm(), c); }
    609 inline JSString* jsSubstring8(ExecState* exec, const String& s, unsigned offset, unsigned length) { return jsSubstring8(&exec->vm(), s, offset, length); }
    610592inline JSString* jsSubstring(ExecState* exec, const String& s, unsigned offset, unsigned length) { return jsSubstring(&exec->vm(), s, offset, length); }
    611593inline JSString* jsNontrivialString(ExecState* exec, const String& s) { return jsNontrivialString(&exec->vm(), s); }
Note: See TracChangeset for help on using the changeset viewer.