Revision: 10871
Author:   [email protected]
Date:     Wed Feb 29 06:25:24 2012
Log: Inline one level of recursive call of WriteToFlat for the common case of cons string list.

BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com/9536011
http://code.google.com/p/v8/source/detail?r=10871

Modified:
 /branches/bleeding_edge/src/objects.cc

=======================================
--- /branches/bleeding_edge/src/objects.cc      Tue Feb 28 01:05:55 2012
+++ /branches/bleeding_edge/src/objects.cc      Wed Feb 29 06:25:24 2012
@@ -6862,10 +6862,21 @@
           // Left hand side is longer.  Recurse over right.
           if (to > boundary) {
             String* second = cons_string->second();
-            WriteToFlat(second,
-                        sink + boundary - from,
-                        0,
+ // When repeatedly appending to a string, we get a cons string that + // is unbalanced to the left, a list, essentially. We inline the
+            // common case of sequential ascii right child.
+            if (to - boundary == 1) {
+ sink[boundary - from] = static_cast<sinkchar>(second->Get(0));
+            } else if (second->IsSeqAsciiString()) {
+              CopyChars(sink + boundary - from,
+                        SeqAsciiString::cast(second)->GetChars(),
                         to - boundary);
+            } else {
+              WriteToFlat(second,
+                          sink + boundary - from,
+                          0,
+                          to - boundary);
+            }
             to = boundary;
           }
           source = first;

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to