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

Unified Diff: runtime/vm/heap_profiler.cc

Issue 11318018: - Represent strings internally in UTF-16 format, this makes it (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 2 months 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/heap_profiler.cc
===================================================================
--- runtime/vm/heap_profiler.cc (revision 14314)
+++ runtime/vm/heap_profiler.cc (working copy)
@@ -278,10 +278,8 @@
}
case kOneByteStringCid:
case kTwoByteStringCid:
- case kFourByteStringCid:
case kExternalOneByteStringCid:
- case kExternalTwoByteStringCid:
- case kExternalFourByteStringCid: {
+ case kExternalTwoByteStringCid: {
WriteInstanceDump(StringId(reinterpret_cast<const RawString*>(raw_obj)));
break;
}
@@ -355,7 +353,8 @@
int32_t ch = onestr->ptr()->data_[i];
j += Utf8::Encode(ch, &characters[j]);
}
- } else if (class_id == kTwoByteStringCid) {
+ } else {
+ ASSERT(class_id == kTwoByteStringCid);
const RawTwoByteString* twostr =
reinterpret_cast<const RawTwoByteString*>(raw_string);
for (intptr_t i = 0; i < Smi::Value(twostr->ptr()->length_); ++i) {
@@ -366,18 +365,6 @@
int32_t ch = twostr->ptr()->data_[i];
j += Utf8::Encode(ch, &characters[j]);
}
- } else {
- ASSERT(class_id == kFourByteStringCid);
- const RawFourByteString* fourstr =
- reinterpret_cast<const RawFourByteString*>(raw_string);
- for (intptr_t i = 0; i < Smi::Value(fourstr->ptr()->length_); ++i) {
- length += Utf8::Length(fourstr->ptr()->data_[i]);
- }
- characters = new char[length];
- for (intptr_t i = 0, j = 0; i < Smi::Value(fourstr->ptr()->length_); ++i) {
- int32_t ch = fourstr->ptr()->data_[i];
- j += Utf8::Encode(ch, &characters[j]);
- }
}
Record record(kStringInUtf8, this);
record.WritePointer(ObjectId(raw_string));

Powered by Google App Engine
This is Rietveld 408576698