Author: [EMAIL PROTECTED]
Date: Fri Sep 19 04:06:35 2008
New Revision: 347

Modified:
    branches/bleeding_edge/src/objects-inl.h

Log:
TryFlatten is inlined, while Flatten is not.  Make an optimization to avoid  
the call to Flatten when we're already flat.  This gives me 5% on some  
simple indexOf experiments.

Modified: branches/bleeding_edge/src/objects-inl.h
==============================================================================
--- branches/bleeding_edge/src/objects-inl.h    (original)
+++ branches/bleeding_edge/src/objects-inl.h    Fri Sep 19 04:06:35 2008
@@ -1198,7 +1198,12 @@


  void String::TryFlatten() {
-  Flatten();
+  // We don't need to flatten strings that are already flat.  Since this  
code
+  // is inlined, it can be helpful in the flat case to not call out to  
Flatten.
+  StringRepresentationTag str_type = representation_tag();
+  if (str_type != kSeqStringTag && str_type != kExternalStringTag) {
+    Flatten();
+  }
  }



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

Reply via email to