| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/dart_api_message.h" | 5 #include "vm/dart_api_message.h" |
| 6 #include "vm/object.h" | 6 #include "vm/object.h" |
| 7 #include "vm/snapshot_ids.h" | 7 #include "vm/snapshot_ids.h" |
| 8 #include "vm/symbols.h" | 8 #include "vm/symbols.h" |
| 9 #include "vm/unicode.h" | 9 #include "vm/unicode.h" |
| 10 | 10 |
| (...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 769 break; | 769 break; |
| 770 case Dart_CObject::kString: { | 770 case Dart_CObject::kString: { |
| 771 const uint8_t* utf8_str = | 771 const uint8_t* utf8_str = |
| 772 reinterpret_cast<const uint8_t*>(object->value.as_string); | 772 reinterpret_cast<const uint8_t*>(object->value.as_string); |
| 773 intptr_t utf8_len = strlen(object->value.as_string); | 773 intptr_t utf8_len = strlen(object->value.as_string); |
| 774 if (!Utf8::IsValid(utf8_str, utf8_len)) { | 774 if (!Utf8::IsValid(utf8_str, utf8_len)) { |
| 775 return false; | 775 return false; |
| 776 } | 776 } |
| 777 | 777 |
| 778 Utf8::Type type; | 778 Utf8::Type type; |
| 779 intptr_t len = Utf8::CodePointCount(utf8_str, utf8_len, &type); | 779 intptr_t len = Utf8::CodeUnitCount(utf8_str, utf8_len, &type); |
| 780 | 780 |
| 781 // Write out the serialization header value for this object. | 781 // Write out the serialization header value for this object. |
| 782 WriteInlinedHeader(object); | 782 WriteInlinedHeader(object); |
| 783 // Write out the class and tags information. | 783 // Write out the class and tags information. |
| 784 WriteIndexedObject(type == Utf8::kLatin1 ? kOneByteStringCid | 784 WriteIndexedObject(type == Utf8::kLatin1 ? kOneByteStringCid |
| 785 : kTwoByteStringCid); | 785 : kTwoByteStringCid); |
| 786 WriteIntptrValue(0); | 786 WriteIntptrValue(0); |
| 787 // Write string length, hash and content | 787 // Write string length, hash and content |
| 788 WriteSmi(len); | 788 WriteSmi(len); |
| 789 WriteSmi(0); // TODO(sgjesse): Hash - not written. | 789 WriteSmi(0); // TODO(sgjesse): Hash - not written. |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 865 if (!success) { | 865 if (!success) { |
| 866 UnmarkAllCObjects(object); | 866 UnmarkAllCObjects(object); |
| 867 return false; | 867 return false; |
| 868 } | 868 } |
| 869 } | 869 } |
| 870 UnmarkAllCObjects(object); | 870 UnmarkAllCObjects(object); |
| 871 return true; | 871 return true; |
| 872 } | 872 } |
| 873 | 873 |
| 874 } // namespace dart | 874 } // namespace dart |
| OLD | NEW |