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 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3103 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
8b33cb7133
commit
4c7620dc79
@ -754,7 +754,8 @@ bool String::MakeExternal(v8::String::ExternalStringResource* resource) {
|
||||
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 @@ bool String::MakeExternal(v8::String::ExternalAsciiStringResource* resource) {
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user