Revision: 3103
Author: [email protected]
Date: Wed Oct 21 05:14:50 2009
Log: Use WriteToFlat instead of to C strings methods as WriteToFlat  
performs notably
better for various kinds of strings.

Review URL: http://codereview.chromium.org/293027
http://code.google.com/p/v8/source/detail?r=3103

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

=======================================
--- /branches/bleeding_edge/src/objects.cc      Tue Oct 20 08:26:17 2009
+++ /branches/bleeding_edge/src/objects.cc      Wed Oct 21 05:14:50 2009
@@ -754,7 +754,8 @@
    if (FLAG_enable_slow_asserts) {
      // Assert that the resource and the string are equivalent.
      ASSERT(static_cast<size_t>(this->length()) == resource->length());
-    SmartPointer<uc16> smart_chars = this->ToWideCString();
+    SmartPointer<uc16> smart_chars(NewArray<uc16>(this->length()));
+    String::WriteToFlat(this, *smart_chars, 0, this->length());
      ASSERT(memcmp(*smart_chars,
                    resource->data(),
                    resource->length() * sizeof(**smart_chars)) == 0);
@@ -797,7 +798,8 @@
    if (FLAG_enable_slow_asserts) {
      // Assert that the resource and the string are equivalent.
      ASSERT(static_cast<size_t>(this->length()) == resource->length());
-    SmartPointer<char> smart_chars = this->ToCString();
+    SmartPointer<char> smart_chars(NewArray<char>(this->length()));
+    String::WriteToFlat(this, *smart_chars, 0, this->length());
      ASSERT(memcmp(*smart_chars,
                    resource->data(),
                    resource->length()*sizeof(**smart_chars)) == 0);

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

Reply via email to