Ignore:
Timestamp:
May 26, 2015, 11:54:01 AM (10 years ago)
Author:
[email protected]
Message:

String.prototype.charAt() should use StringView.
<https://webkit.org/b/145352>

Reviewed by Darin Adler.

Remove the jsSingleCharacterSubstring() function since it's actually completely
counter-productive: it could create a single-character string that would retain
a much larger string for the duration of its lifetime.

This made sense before StringImpl learned to put its characters at the tail end
of its own allocation. Now that it does, it's far better to just create a new
single-character StringImpl.

With that out of the way, we can make String.prototype.charAt() use StringView
to avoid reifying substring JSStrings (and avoid some ref churn too.)

  • runtime/JSString.cpp:

(JSC::JSRopeString::getIndexSlowCase):

  • runtime/JSString.h:

(JSC::JSString::getIndex):
(JSC::jsSingleCharacterSubstring): Deleted.

  • runtime/StringPrototype.cpp:

(JSC::stringProtoFuncCharAt):
(JSC::stringProtoFuncSplit):

File:
1 edited

Legend:

Unmodified
Added
Removed
Note: See TracChangeset for help on using the changeset viewer.