| 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/bigint_operations.h" | 5 #include "vm/bigint_operations.h" |
| 6 #include "vm/object.h" | 6 #include "vm/object.h" |
| 7 #include "vm/object_store.h" | 7 #include "vm/object_store.h" |
| 8 #include "vm/snapshot.h" | 8 #include "vm/snapshot.h" |
| 9 #include "vm/visitor.h" | 9 #include "vm/visitor.h" |
| 10 | 10 |
| (...skipping 1163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1174 Snapshot::Kind kind) { | 1174 Snapshot::Kind kind) { |
| 1175 ASSERT(writer != NULL); | 1175 ASSERT(writer != NULL); |
| 1176 | 1176 |
| 1177 // Write out the serialization header value for this object. | 1177 // Write out the serialization header value for this object. |
| 1178 writer->WriteSerializationMarker(kInlined, object_id); | 1178 writer->WriteSerializationMarker(kInlined, object_id); |
| 1179 | 1179 |
| 1180 // Write out the class and tags information. | 1180 // Write out the class and tags information. |
| 1181 writer->WriteObjectHeader(ObjectStore::kBigintClass, ptr()->tags_); | 1181 writer->WriteObjectHeader(ObjectStore::kBigintClass, ptr()->tags_); |
| 1182 | 1182 |
| 1183 // Write out the bigint value as a HEXCstring. | 1183 // Write out the bigint value as a HEXCstring. |
| 1184 ptr()->bn_.d = ptr()->data_; | 1184 intptr_t length = ptr()->signed_length_; |
| 1185 const char* str = BigintOperations::ToHexCString(&ptr()->bn_, &ZoneAllocator); | 1185 bool is_negative = false; |
| 1186 if (length <= 0) { |
| 1187 length = -length; |
| 1188 is_negative = true; |
| 1189 } |
| 1190 uword data_start = reinterpret_cast<uword>(ptr()) + sizeof(RawBigint); |
| 1191 const char* str = BigintOperations::ToHexCString( |
| 1192 length, |
| 1193 is_negative, |
| 1194 reinterpret_cast<void*>(data_start), |
| 1195 &ZoneAllocator); |
| 1186 bool neg = false; | 1196 bool neg = false; |
| 1187 if (*str == '-') { | 1197 if (*str == '-') { |
| 1188 neg = true; | 1198 neg = true; |
| 1189 str++; | 1199 str++; |
| 1190 } | 1200 } |
| 1191 intptr_t len = strlen(str); | 1201 intptr_t len = strlen(str); |
| 1192 ASSERT(len > 2 && str[0] == '0' && str[1] == 'x'); | 1202 ASSERT(len > 2 && str[0] == '0' && str[1] == 'x'); |
| 1193 if (neg) { | 1203 if (neg) { |
| 1194 writer->WriteIntptrValue(len - 1); // Include '-' in length. | 1204 writer->WriteIntptrValue(len - 1); // Include '-' in length. |
| 1195 writer->Write<uint8_t>('-'); | 1205 writer->Write<uint8_t>('-'); |
| (...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1858 | 1868 |
| 1859 | 1869 |
| 1860 void RawICData::WriteTo(SnapshotWriter* writer, | 1870 void RawICData::WriteTo(SnapshotWriter* writer, |
| 1861 intptr_t object_id, | 1871 intptr_t object_id, |
| 1862 Snapshot::Kind kind) { | 1872 Snapshot::Kind kind) { |
| 1863 UNIMPLEMENTED(); | 1873 UNIMPLEMENTED(); |
| 1864 } | 1874 } |
| 1865 | 1875 |
| 1866 | 1876 |
| 1867 } // namespace dart | 1877 } // namespace dart |
| OLD | NEW |