| 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/symbols.h" | 9 #include "vm/symbols.h" |
| 10 #include "vm/visitor.h" | 10 #include "vm/visitor.h" |
| (...skipping 2095 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2106 reader->isolate()->object_store()->external_##lname##_array_class()); \ | 2106 reader->isolate()->object_store()->external_##lname##_array_class()); \ |
| 2107 return NewExternalImpl<External##name##Array, RawExternal##name##Array>( \ | 2107 return NewExternalImpl<External##name##Array, RawExternal##name##Array>( \ |
| 2108 cls, data, length, peer, callback, HEAP_SPACE(kind)); \ | 2108 cls, data, length, peer, callback, HEAP_SPACE(kind)); \ |
| 2109 } \ | 2109 } \ |
| 2110 | 2110 |
| 2111 | 2111 |
| 2112 BYTEARRAY_TYPE_LIST(EXTERNALARRAY_READ_FROM) | 2112 BYTEARRAY_TYPE_LIST(EXTERNALARRAY_READ_FROM) |
| 2113 #undef EXTERNALARRAY_READ_FROM | 2113 #undef EXTERNALARRAY_READ_FROM |
| 2114 | 2114 |
| 2115 | 2115 |
| 2116 template<typename ElementT> |
| 2116 static void ByteArrayWriteTo(SnapshotWriter* writer, | 2117 static void ByteArrayWriteTo(SnapshotWriter* writer, |
| 2117 intptr_t object_id, | 2118 intptr_t object_id, |
| 2118 Snapshot::Kind kind, | 2119 Snapshot::Kind kind, |
| 2119 intptr_t byte_array_kind, | 2120 intptr_t byte_array_kind, |
| 2120 intptr_t tags, | 2121 intptr_t tags, |
| 2121 RawSmi* length, | 2122 RawSmi* length, |
| 2122 uint8_t* data) { | 2123 ElementT* data) { |
| 2123 ASSERT(writer != NULL); | 2124 ASSERT(writer != NULL); |
| 2124 intptr_t len = Smi::Value(length); | 2125 intptr_t len = Smi::Value(length); |
| 2125 | 2126 |
| 2126 // Write out the serialization header value for this object. | 2127 // Write out the serialization header value for this object. |
| 2127 writer->WriteInlinedObjectHeader(object_id); | 2128 writer->WriteInlinedObjectHeader(object_id); |
| 2128 | 2129 |
| 2129 // Write out the class and tags information. | 2130 // Write out the class and tags information. |
| 2130 writer->WriteIndexedObject(byte_array_kind); | 2131 writer->WriteIndexedObject(byte_array_kind); |
| 2131 writer->WriteIntptrValue(tags); | 2132 writer->WriteIntptrValue(tags); |
| 2132 | 2133 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 2150 #define BYTEARRAY_WRITE_TO(name, lname, type) \ | 2151 #define BYTEARRAY_WRITE_TO(name, lname, type) \ |
| 2151 void Raw##name##Array::WriteTo(SnapshotWriter* writer, \ | 2152 void Raw##name##Array::WriteTo(SnapshotWriter* writer, \ |
| 2152 intptr_t object_id, \ | 2153 intptr_t object_id, \ |
| 2153 Snapshot::Kind kind) { \ | 2154 Snapshot::Kind kind) { \ |
| 2154 ByteArrayWriteTo(writer, \ | 2155 ByteArrayWriteTo(writer, \ |
| 2155 object_id, \ | 2156 object_id, \ |
| 2156 kind, \ | 2157 kind, \ |
| 2157 k##name##ArrayCid, \ | 2158 k##name##ArrayCid, \ |
| 2158 writer->GetObjectTags(this), \ | 2159 writer->GetObjectTags(this), \ |
| 2159 ptr()->length_, \ | 2160 ptr()->length_, \ |
| 2160 reinterpret_cast<uint8_t*>(ptr()->data_)); \ | 2161 ptr()->data_); \ |
| 2161 } \ | 2162 } \ |
| 2162 | 2163 |
| 2163 | 2164 |
| 2164 BYTEARRAY_TYPE_LIST(BYTEARRAY_WRITE_TO) | 2165 BYTEARRAY_TYPE_LIST(BYTEARRAY_WRITE_TO) |
| 2165 #undef BYTEARRAY_WRITE_TO | 2166 #undef BYTEARRAY_WRITE_TO |
| 2166 | 2167 |
| 2167 | 2168 |
| 2168 #define EXTERNALARRAY_WRITE_TO(name, lname, type) \ | 2169 #define EXTERNALARRAY_WRITE_TO(name, lname, type) \ |
| 2169 void RawExternal##name##Array::WriteTo(SnapshotWriter* writer, \ | 2170 void RawExternal##name##Array::WriteTo(SnapshotWriter* writer, \ |
| 2170 intptr_t object_id, \ | 2171 intptr_t object_id, \ |
| 2171 Snapshot::Kind kind) { \ | 2172 Snapshot::Kind kind) { \ |
| 2172 ByteArrayWriteTo(writer, \ | 2173 ByteArrayWriteTo(writer, \ |
| 2173 object_id, \ | 2174 object_id, \ |
| 2174 kind, \ | 2175 kind, \ |
| 2175 k##name##ArrayCid, \ | 2176 k##name##ArrayCid, \ |
| 2176 writer->GetObjectTags(this), \ | 2177 writer->GetObjectTags(this), \ |
| 2177 ptr()->length_, \ | 2178 ptr()->length_, \ |
| 2178 reinterpret_cast<uint8_t*>(ptr()->external_data_->data())); \ | 2179 ptr()->external_data_->data()); \ |
| 2179 } \ | 2180 } \ |
| 2180 | 2181 |
| 2181 | 2182 |
| 2182 BYTEARRAY_TYPE_LIST(EXTERNALARRAY_WRITE_TO) | 2183 BYTEARRAY_TYPE_LIST(EXTERNALARRAY_WRITE_TO) |
| 2183 #undef BYTEARRAY_WRITE_TO | 2184 #undef BYTEARRAY_WRITE_TO |
| 2184 #undef BYTEARRAY_TYPE_LIST | 2185 #undef BYTEARRAY_TYPE_LIST |
| 2185 | 2186 |
| 2186 | 2187 |
| 2187 RawDartFunction* DartFunction::ReadFrom(SnapshotReader* reader, | 2188 RawDartFunction* DartFunction::ReadFrom(SnapshotReader* reader, |
| 2188 intptr_t object_id, | 2189 intptr_t object_id, |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2306 // Write out the class and tags information. | 2307 // Write out the class and tags information. |
| 2307 writer->WriteIndexedObject(kWeakPropertyCid); | 2308 writer->WriteIndexedObject(kWeakPropertyCid); |
| 2308 writer->WriteIntptrValue(writer->GetObjectTags(this)); | 2309 writer->WriteIntptrValue(writer->GetObjectTags(this)); |
| 2309 | 2310 |
| 2310 // Write out all the other fields. | 2311 // Write out all the other fields. |
| 2311 writer->Write<RawObject*>(ptr()->key_); | 2312 writer->Write<RawObject*>(ptr()->key_); |
| 2312 writer->Write<RawObject*>(ptr()->value_); | 2313 writer->Write<RawObject*>(ptr()->value_); |
| 2313 } | 2314 } |
| 2314 | 2315 |
| 2315 } // namespace dart | 2316 } // namespace dart |
| OLD | NEW |