Ignore:
Timestamp:
Jun 17, 2015, 11:54:13 AM (10 years ago)
Author:
[email protected]
Message:

[JSC] jsSubstring() should have a fast path for 0..baseLength "substrings."
<https://webkit.org/b/146051>

Reviewed by Anders Carlsson.

If asked to make a substring that actually spans the entire base string,
have jsSubstring() just return the base instead of allocating a new JSString.

3% speed-up on Octane/regexp.

  • runtime/JSString.h:

(JSC::jsSubstring):

File:
1 edited

Legend:

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

    r185486 r185659  
    529529    if (!length)
    530530        return vm.smallStrings.emptyString();
     531    if (!offset && length == s->length())
     532        return s;
    531533    return JSRopeString::create(*exec, *s, offset, length);
    532534}
Note: See TracChangeset for help on using the changeset viewer.