Title: [185368] trunk/Source/_javascript_Core
- Revision
- 185368
- Author
- [email protected]
- Date
- 2015-06-09 11:03:40 -0700 (Tue, 09 Jun 2015)
Log Message
[JSC] JSString::getIndex() should avoid reifying substrings.
<https://webkit.org/b/145803>
Reviewed by Darin Adler.
Implement getIndex() using JSString::view(), which cuts it down to a one-liner
and also avoids reifying substrings.
I saw 178 kB of reified substrings below operationGetByVal -> getIndex()
on cnet.com, so this should help.
* runtime/JSString.cpp:
(JSC::JSRopeString::getIndexSlowCase): Deleted.
* runtime/JSString.h:
(JSC::JSString::getIndex):
Modified Paths
Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (185367 => 185368)
--- trunk/Source/_javascript_Core/ChangeLog 2015-06-09 18:01:44 UTC (rev 185367)
+++ trunk/Source/_javascript_Core/ChangeLog 2015-06-09 18:03:40 UTC (rev 185368)
@@ -1,5 +1,23 @@
2015-06-09 Andreas Kling <[email protected]>
+ [JSC] JSString::getIndex() should avoid reifying substrings.
+ <https://webkit.org/b/145803>
+
+ Reviewed by Darin Adler.
+
+ Implement getIndex() using JSString::view(), which cuts it down to a one-liner
+ and also avoids reifying substrings.
+
+ I saw 178 kB of reified substrings below operationGetByVal -> getIndex()
+ on cnet.com, so this should help.
+
+ * runtime/JSString.cpp:
+ (JSC::JSRopeString::getIndexSlowCase): Deleted.
+ * runtime/JSString.h:
+ (JSC::JSString::getIndex):
+
+2015-06-09 Andreas Kling <[email protected]>
+
[JSC] String.prototype.indexOf() should use StringView.
<https://webkit.org/b/145351>
Modified: trunk/Source/_javascript_Core/runtime/JSString.cpp (185367 => 185368)
--- trunk/Source/_javascript_Core/runtime/JSString.cpp 2015-06-09 18:01:44 UTC (rev 185367)
+++ trunk/Source/_javascript_Core/runtime/JSString.cpp 2015-06-09 18:03:40 UTC (rev 185368)
@@ -365,18 +365,6 @@
throwOutOfMemoryError(exec);
}
-JSString* JSRopeString::getIndexSlowCase(ExecState* exec, unsigned i)
-{
- ASSERT(isRope());
- resolveRope(exec);
- // Return a safe no-value result, this should never be used, since the excetion will be thrown.
- if (exec->exception())
- return jsEmptyString(exec);
- ASSERT(!isRope());
- RELEASE_ASSERT(i < m_value.length());
- return jsSingleCharacterString(exec, m_value[i]);
-}
-
JSValue JSString::toPrimitive(ExecState*, PreferredPrimitiveType) const
{
return const_cast<JSString*>(this);
Modified: trunk/Source/_javascript_Core/runtime/JSString.h (185367 => 185368)
--- trunk/Source/_javascript_Core/runtime/JSString.h 2015-06-09 18:01:44 UTC (rev 185367)
+++ trunk/Source/_javascript_Core/runtime/JSString.h 2015-06-09 18:03:40 UTC (rev 185368)
@@ -372,8 +372,6 @@
void clearFibers() const;
StringView view(ExecState*) const;
- JS_EXPORT_PRIVATE JSString* getIndexSlowCase(ExecState*, unsigned);
-
WriteBarrierBase<JSString>& fiber(unsigned i) const
{
ASSERT(!isSubstring());
@@ -493,10 +491,7 @@
inline JSString* JSString::getIndex(ExecState* exec, unsigned i)
{
ASSERT(canGetIndex(i));
- if (isRope())
- return static_cast<JSRopeString*>(this)->getIndexSlowCase(exec, i);
- ASSERT(i < m_value.length());
- return jsSingleCharacterString(exec, m_value[i]);
+ return jsSingleCharacterString(exec, view(exec)[i]);
}
inline JSString* jsString(VM* vm, const String& s)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes