| 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 775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 786 break; | 786 break; |
| 787 case Dart_CObject::kString: { | 787 case Dart_CObject::kString: { |
| 788 const uint8_t* utf8_str = | 788 const uint8_t* utf8_str = |
| 789 reinterpret_cast<const uint8_t*>(object->value.as_string); | 789 reinterpret_cast<const uint8_t*>(object->value.as_string); |
| 790 intptr_t utf8_len = strlen(object->value.as_string); | 790 intptr_t utf8_len = strlen(object->value.as_string); |
| 791 if (!Utf8::IsValid(utf8_str, utf8_len)) { | 791 if (!Utf8::IsValid(utf8_str, utf8_len)) { |
| 792 return false; | 792 return false; |
| 793 } | 793 } |
| 794 | 794 |
| 795 Utf8::Type type; | 795 Utf8::Type type; |
| 796 intptr_t len = Utf8::CodeUnitCount(utf8_str, utf8_len, &type); | 796 intptr_t len = Utf8::CodePointCount(utf8_str, utf8_len, &type); |
| 797 | 797 |
| 798 // Write out the serialization header value for this object. | 798 // Write out the serialization header value for this object. |
| 799 WriteInlinedHeader(object); | 799 WriteInlinedHeader(object); |
| 800 // Write out the class and tags information. | 800 // Write out the class and tags information. |
| 801 WriteIndexedObject(type == Utf8::kLatin1 ? kOneByteStringCid | 801 WriteIndexedObject(type == Utf8::kLatin1 ? kOneByteStringCid |
| 802 : kTwoByteStringCid); | 802 : kTwoByteStringCid); |
| 803 WriteIntptrValue(0); | 803 WriteIntptrValue(0); |
| 804 // Write string length, hash and content | 804 // Write string length, hash and content |
| 805 WriteSmi(len); | 805 WriteSmi(len); |
| 806 WriteSmi(0); // TODO(sgjesse): Hash - not written. | 806 WriteSmi(0); // TODO(sgjesse): Hash - not written. |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 882 if (!success) { | 882 if (!success) { |
| 883 UnmarkAllCObjects(object); | 883 UnmarkAllCObjects(object); |
| 884 return false; | 884 return false; |
| 885 } | 885 } |
| 886 } | 886 } |
| 887 UnmarkAllCObjects(object); | 887 UnmarkAllCObjects(object); |
| 888 return true; | 888 return true; |
| 889 } | 889 } |
| 890 | 890 |
| 891 } // namespace dart | 891 } // namespace dart |
| OLD | NEW |