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 1211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1222 | 1222 |
1223 // Read in the HexCString representation of the bigint. | 1223 // Read in the HexCString representation of the bigint. |
1224 intptr_t len = reader->ReadIntptrValue(); | 1224 intptr_t len = reader->ReadIntptrValue(); |
1225 char* str = reinterpret_cast<char*>(ZoneAllocator(len + 1)); | 1225 char* str = reinterpret_cast<char*>(ZoneAllocator(len + 1)); |
1226 str[len] = '\0'; | 1226 str[len] = '\0'; |
1227 for (intptr_t i = 0; i < len; i++) { | 1227 for (intptr_t i = 0; i < len; i++) { |
1228 str[i] = reader->Read<uint8_t>(); | 1228 str[i] = reader->Read<uint8_t>(); |
1229 } | 1229 } |
1230 | 1230 |
1231 // Create a Bigint object from HexCString. | 1231 // Create a Bigint object from HexCString. |
1232 Bigint& obj = Bigint::ZoneHandle(reader->isolate(), | 1232 Bigint& obj = Bigint::ZoneHandle( |
1233 BigintOperations::FromHexCString(str)); | 1233 reader->isolate(), |
| 1234 (kind == Snapshot::kFull) ? reader->NewBigint(str) : |
| 1235 BigintOperations::FromHexCString(str)); |
1234 | 1236 |
1235 // If it is a canonical constant make it one. | 1237 // If it is a canonical constant make it one. |
1236 if ((kind != Snapshot::kFull) && RawObject::IsCanonical(tags)) { | 1238 if ((kind != Snapshot::kFull) && RawObject::IsCanonical(tags)) { |
1237 obj ^= obj.Canonicalize(); | 1239 obj ^= obj.Canonicalize(); |
1238 } | 1240 } |
1239 reader->AddBackwardReference(object_id, &obj); | 1241 reader->AddBackwardReference(object_id, &obj); |
1240 | 1242 |
1241 // Set the object tags. | 1243 // Set the object tags. |
1242 obj.set_tags(tags); | 1244 obj.set_tags(tags); |
1243 | 1245 |
(...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1967 writer->Write<RawObject*>(ptr()->num_bracket_expressions_); | 1969 writer->Write<RawObject*>(ptr()->num_bracket_expressions_); |
1968 writer->WriteObject(ptr()->pattern_); | 1970 writer->WriteObject(ptr()->pattern_); |
1969 writer->WriteIntptrValue(ptr()->type_); | 1971 writer->WriteIntptrValue(ptr()->type_); |
1970 writer->WriteIntptrValue(ptr()->flags_); | 1972 writer->WriteIntptrValue(ptr()->flags_); |
1971 | 1973 |
1972 // Do not write out the data part which is native. | 1974 // Do not write out the data part which is native. |
1973 } | 1975 } |
1974 | 1976 |
1975 | 1977 |
1976 } // namespace dart | 1978 } // namespace dart |
OLD | NEW |