| 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 786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 797 break; | 797 break; |
| 798 case Dart_CObject::kString: { | 798 case Dart_CObject::kString: { |
| 799 const uint8_t* utf8_str = | 799 const uint8_t* utf8_str = |
| 800 reinterpret_cast<const uint8_t*>(object->value.as_string); | 800 reinterpret_cast<const uint8_t*>(object->value.as_string); |
| 801 intptr_t utf8_len = strlen(object->value.as_string); | 801 intptr_t utf8_len = strlen(object->value.as_string); |
| 802 if (!Utf8::IsValid(utf8_str, utf8_len)) { | 802 if (!Utf8::IsValid(utf8_str, utf8_len)) { |
| 803 return false; | 803 return false; |
| 804 } | 804 } |
| 805 | 805 |
| 806 Utf8::Type type; | 806 Utf8::Type type; |
| 807 intptr_t len = Utf8::CodePointCount(utf8_str, utf8_len, &type); | 807 intptr_t len = Utf8::CodeUnitCount(utf8_str, utf8_len, &type); |
| 808 | 808 |
| 809 // Write out the serialization header value for this object. | 809 // Write out the serialization header value for this object. |
| 810 WriteInlinedHeader(object); | 810 WriteInlinedHeader(object); |
| 811 // Write out the class and tags information. | 811 // Write out the class and tags information. |
| 812 WriteIndexedObject(type == Utf8::kLatin1 ? kOneByteStringCid | 812 WriteIndexedObject(type == Utf8::kLatin1 ? kOneByteStringCid |
| 813 : kTwoByteStringCid); | 813 : kTwoByteStringCid); |
| 814 WriteIntptrValue(0); | 814 WriteIntptrValue(0); |
| 815 // Write string length, hash and content | 815 // Write string length, hash and content |
| 816 WriteSmi(len); | 816 WriteSmi(len); |
| 817 WriteSmi(0); // TODO(sgjesse): Hash - not written. | 817 WriteSmi(0); // TODO(sgjesse): Hash - not written. |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 897 if (!success) { | 897 if (!success) { |
| 898 UnmarkAllCObjects(object); | 898 UnmarkAllCObjects(object); |
| 899 return false; | 899 return false; |
| 900 } | 900 } |
| 901 } | 901 } |
| 902 UnmarkAllCObjects(object); | 902 UnmarkAllCObjects(object); |
| 903 return true; | 903 return true; |
| 904 } | 904 } |
| 905 | 905 |
| 906 } // namespace dart | 906 } // namespace dart |
| OLD | NEW |