Title: [185367] trunk/Source/_javascript_Core
Revision
185367
Author
[email protected]
Date
2015-06-09 11:01:44 -0700 (Tue, 09 Jun 2015)

Log Message

[JSC] String.prototype.indexOf() should use StringView.
<https://webkit.org/b/145351>

Reviewed by Darin Adler.

Use StringView::find() to implement String.prototype.indexOf().
This avoids reifying the needle and haystack JSStrings in case they
are substrings.

Reduces malloc memory by ~190 kB on cnet.com.

* runtime/StringPrototype.cpp:
(JSC::stringProtoFuncIndexOf):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (185366 => 185367)


--- trunk/Source/_javascript_Core/ChangeLog	2015-06-09 17:11:50 UTC (rev 185366)
+++ trunk/Source/_javascript_Core/ChangeLog	2015-06-09 18:01:44 UTC (rev 185367)
@@ -1,3 +1,19 @@
+2015-06-09  Andreas Kling  <[email protected]>
+
+        [JSC] String.prototype.indexOf() should use StringView.
+        <https://webkit.org/b/145351>
+
+        Reviewed by Darin Adler.
+
+        Use StringView::find() to implement String.prototype.indexOf().
+        This avoids reifying the needle and haystack JSStrings in case they
+        are substrings.
+
+        Reduces malloc memory by ~190 kB on cnet.com.
+
+        * runtime/StringPrototype.cpp:
+        (JSC::stringProtoFuncIndexOf):
+
 2015-06-09  Csaba Osztrogonác  <[email protected]>
 
         [cmake] Fix the style issues in cmake project files

Modified: trunk/Source/_javascript_Core/runtime/StringPrototype.cpp (185366 => 185367)


--- trunk/Source/_javascript_Core/runtime/StringPrototype.cpp	2015-06-09 17:11:50 UTC (rev 185366)
+++ trunk/Source/_javascript_Core/runtime/StringPrototype.cpp	2015-06-09 18:01:44 UTC (rev 185367)
@@ -896,7 +896,7 @@
     if (thisJSString->length() < otherJSString->length() + pos)
         return JSValue::encode(jsNumber(-1));
 
-    size_t result = thisJSString->value(exec).find(otherJSString->value(exec), pos);
+    size_t result = thisJSString->view(exec).find(otherJSString->view(exec), pos);
     if (result == notFound)
         return JSValue::encode(jsNumber(-1));
     return JSValue::encode(jsNumber(result));
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to