Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(662)

Unified Diff: runtime/vm/object.cc

Issue 11365243: Revert OneByteString back to ISO Latin-1 instead of ASCII (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: runtime/vm/object.cc
===================================================================
--- runtime/vm/object.cc (revision 14802)
+++ runtime/vm/object.cc (working copy)
@@ -10077,12 +10077,12 @@
Heap::Space space) {
Utf8::Type type;
intptr_t len = Utf8::CodePointCount(utf8_array, array_len, &type);
- if (type == Utf8::kAscii) {
+ if (type == Utf8::kISOLatin1) {
const String& strobj = String::Handle(OneByteString::New(len, space));
if (len > 0) {
NoGCScope no_gc;
- Utf8::DecodeToAscii(utf8_array, array_len,
- OneByteString::CharAddr(strobj, 0), len);
+ Utf8::DecodeToISOLatin1(utf8_array, array_len,
+ OneByteString::CharAddr(strobj, 0), len);
}
return strobj.raw();
}
@@ -10100,7 +10100,7 @@
Heap::Space space) {
bool is_one_byte_string = true;
for (intptr_t i = 0; i < array_len; ++i) {
- if (utf16_array[i] > 0x7F) {
+ if (utf16_array[i] > 0xFF) {
is_one_byte_string = false;
break;
}
@@ -10118,7 +10118,7 @@
bool is_one_byte_string = true;
intptr_t utf16_len = array_len;
for (intptr_t i = 0; i < array_len; ++i) {
- if (utf32_array[i] > 0x7F) {
+ if (utf32_array[i] > 0xFF) {
is_one_byte_string = false;
}
if (utf32_array[i] > 0xFFFF) {
@@ -10199,7 +10199,7 @@
if (dst.IsOneByteString()) {
NoGCScope no_gc;
for (intptr_t i = 0; i < array_len; ++i) {
- ASSERT(utf16_array[i] <= 0x7F);
+ ASSERT(utf16_array[i] <= 0xFF);
*OneByteString::CharAddr(dst, i + dst_offset) = utf16_array[i];
}
} else {
@@ -10354,7 +10354,7 @@
intptr_t char_size = str.CharSize();
if (char_size == kTwoByteChar) {
for (intptr_t i = begin_index; i < begin_index + length; ++i) {
- if (str.CharAt(i) > 0x7F) {
+ if (str.CharAt(i) > 0xFF) {
is_one_byte_string = false;
break;
}
@@ -10413,10 +10413,10 @@
if (!has_mapping) {
return str.raw();
}
- if (dst_max <= 0x7F) {
+ if (dst_max <= 0xFF) {
return OneByteString::Transform(mapping, str, space);
}
- ASSERT(dst_max > 0x7F);
+ ASSERT(dst_max > 0xFF);
return TwoByteString::Transform(mapping, str, space);
}
@@ -10564,7 +10564,7 @@
Heap::Space space) {
const String& result =String::Handle(OneByteString::New(len, space));
for (intptr_t i = 0; i < len; ++i) {
- ASSERT(characters[i] <= 0x7F);
+ ASSERT(characters[i] <= 0xFF);
*CharAddr(result, i) = characters[i];
}
return OneByteString::raw(result);
@@ -10576,7 +10576,7 @@
Heap::Space space) {
const String& result = String::Handle(OneByteString::New(len, space));
for (intptr_t i = 0; i < len; ++i) {
- ASSERT(characters[i] <= 0x7F);
+ ASSERT(characters[i] <= 0xFF);
*CharAddr(result, i) = characters[i];
}
return OneByteString::raw(result);
@@ -10630,7 +10630,7 @@
const String& result = String::Handle(OneByteString::New(len, space));
for (intptr_t i = 0; i < len; ++i) {
int32_t ch = mapping(str.CharAt(i));
- ASSERT(ch >= 0 && ch <= 0x7F);
+ ASSERT(ch >= 0 && ch <= 0xFF);
*CharAddr(result, i) = ch;
}
return OneByteString::raw(result);

Powered by Google App Engine
This is Rietveld 408576698