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/dart_api_message.h" | 6 #include "vm/dart_api_message.h" |
7 #include "vm/object.h" | 7 #include "vm/object.h" |
8 #include "vm/snapshot_ids.h" | 8 #include "vm/snapshot_ids.h" |
9 #include "vm/symbols.h" | 9 #include "vm/symbols.h" |
10 #include "vm/unicode.h" | 10 #include "vm/unicode.h" |
(...skipping 844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
855 } | 855 } |
856 ASSERT(new_list != NULL); | 856 ASSERT(new_list != NULL); |
857 forward_list_ = reinterpret_cast<Dart_CObject**>(new_list); | 857 forward_list_ = reinterpret_cast<Dart_CObject**>(new_list); |
858 } | 858 } |
859 forward_list_[forward_id_] = object; | 859 forward_list_[forward_id_] = object; |
860 forward_id_ += 1; | 860 forward_id_ += 1; |
861 } | 861 } |
862 | 862 |
863 | 863 |
864 void ApiMessageWriter::WriteSmi(int64_t value) { | 864 void ApiMessageWriter::WriteSmi(int64_t value) { |
865 ASSERT(Smi::IsValid64(value)); | 865 ASSERT(Smi::IsValid(value)); |
866 Write<RawObject*>(Smi::New(static_cast<intptr_t>(value))); | 866 Write<RawObject*>(Smi::New(static_cast<intptr_t>(value))); |
867 } | 867 } |
868 | 868 |
869 | 869 |
870 void ApiMessageWriter::WriteNullObject() { | 870 void ApiMessageWriter::WriteNullObject() { |
871 WriteVMIsolateObject(kNullObject); | 871 WriteVMIsolateObject(kNullObject); |
872 } | 872 } |
873 | 873 |
874 | 874 |
875 void ApiMessageWriter::WriteMint(Dart_CObject* object, int64_t value) { | 875 void ApiMessageWriter::WriteMint(Dart_CObject* object, int64_t value) { |
876 ASSERT(!Smi::IsValid64(value)); | 876 ASSERT(!Smi::IsValid(value)); |
877 // Write out the serialization header value for mint object. | 877 // Write out the serialization header value for mint object. |
878 WriteInlinedHeader(object); | 878 WriteInlinedHeader(object); |
879 // Write out the class and tags information. | 879 // Write out the class and tags information. |
880 WriteIndexedObject(kMintCid); | 880 WriteIndexedObject(kMintCid); |
881 WriteTags(0); | 881 WriteTags(0); |
882 // Write the 64-bit value. | 882 // Write the 64-bit value. |
883 Write<int64_t>(value); | 883 Write<int64_t>(value); |
884 } | 884 } |
885 | 885 |
886 | 886 |
887 void ApiMessageWriter::WriteInt32(Dart_CObject* object) { | 887 void ApiMessageWriter::WriteInt32(Dart_CObject* object) { |
888 int64_t value = object->value.as_int32; | 888 int64_t value = object->value.as_int32; |
889 if (Smi::IsValid64(value)) { | 889 if (Smi::IsValid(value)) { |
890 WriteSmi(value); | 890 WriteSmi(value); |
891 } else { | 891 } else { |
892 WriteMint(object, value); | 892 WriteMint(object, value); |
893 } | 893 } |
894 } | 894 } |
895 | 895 |
896 | 896 |
897 void ApiMessageWriter::WriteInt64(Dart_CObject* object) { | 897 void ApiMessageWriter::WriteInt64(Dart_CObject* object) { |
898 int64_t value = object->value.as_int64; | 898 int64_t value = object->value.as_int64; |
899 if (Smi::IsValid64(value)) { | 899 if (Smi::IsValid(value)) { |
900 WriteSmi(value); | 900 WriteSmi(value); |
901 } else { | 901 } else { |
902 WriteMint(object, value); | 902 WriteMint(object, value); |
903 } | 903 } |
904 } | 904 } |
905 | 905 |
906 | 906 |
907 void ApiMessageWriter::WriteInlinedHeader(Dart_CObject* object) { | 907 void ApiMessageWriter::WriteInlinedHeader(Dart_CObject* object) { |
908 // Write out the serialization header value for this object. | 908 // Write out the serialization header value for this object. |
909 WriteInlinedObjectHeader(kMaxPredefinedObjectIds + object_id_); | 909 WriteInlinedObjectHeader(kMaxPredefinedObjectIds + object_id_); |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1181 if (!success) { | 1181 if (!success) { |
1182 UnmarkAllCObjects(object); | 1182 UnmarkAllCObjects(object); |
1183 return false; | 1183 return false; |
1184 } | 1184 } |
1185 } | 1185 } |
1186 UnmarkAllCObjects(object); | 1186 UnmarkAllCObjects(object); |
1187 return true; | 1187 return true; |
1188 } | 1188 } |
1189 | 1189 |
1190 } // namespace dart | 1190 } // namespace dart |
OLD | NEW |