Push version 2.2.2 to trunk.

Introduced new profiler API.

Fixed random number generator to produce full 32 random bits.


git-svn-id: http://v8.googlecode.com/svn/trunk@4386 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
diff --git a/include/v8.h b/include/v8.h
index f64b386..db739bb 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -855,12 +855,22 @@
    * \param start The starting position within the string at which
    * copying begins.
    * \param length The number of bytes to copy from the string.
-   * \return The number of characters copied to the buffer
+   * \param nchars_ref The number of characters written, can be NULL.
+   * \return The number of bytes copied to the buffer
    * excluding the NULL terminator.
    */
   int Write(uint16_t* buffer, int start = 0, int length = -1) const;  // UTF-16
   int WriteAscii(char* buffer, int start = 0, int length = -1) const;  // ASCII
-  int WriteUtf8(char* buffer, int length = -1) const; // UTF-8
+  int WriteUtf8(char* buffer,
+                int length = -1,
+                int* nchars_ref = NULL) const; // UTF-8
+
+  /**
+   * Flatten internal memory. Operations on the string tend to run faster
+   * after flattening especially if the string is a concatenation of many
+   * others.
+   */
+  void Flatten();
 
   /**
    * A zero length string.