| 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 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 | 378 |
| 379 // Set the object tags. | 379 // Set the object tags. |
| 380 instantiated_type_arguments.set_tags(tags); | 380 instantiated_type_arguments.set_tags(tags); |
| 381 | 381 |
| 382 // Set all the object fields. | 382 // Set all the object fields. |
| 383 // TODO(5411462): Need to assert No GC can happen here, even though | 383 // TODO(5411462): Need to assert No GC can happen here, even though |
| 384 // allocations may happen. | 384 // allocations may happen. |
| 385 intptr_t num_flds = (instantiated_type_arguments.raw()->to() - | 385 intptr_t num_flds = (instantiated_type_arguments.raw()->to() - |
| 386 instantiated_type_arguments.raw()->from()); | 386 instantiated_type_arguments.raw()->from()); |
| 387 for (intptr_t i = 0; i <= num_flds; i++) { | 387 for (intptr_t i = 0; i <= num_flds; i++) { |
| 388 *(instantiated_type_arguments.raw()->from() + i) = reader->ReadObjectRef(); | 388 instantiated_type_arguments.StorePointer( |
| 389 (instantiated_type_arguments.raw()->from() + i), |
| 390 reader->ReadObjectRef()); |
| 389 } | 391 } |
| 390 return instantiated_type_arguments.raw(); | 392 return instantiated_type_arguments.raw(); |
| 391 } | 393 } |
| 392 | 394 |
| 393 | 395 |
| 394 void RawInstantiatedTypeArguments::WriteTo(SnapshotWriter* writer, | 396 void RawInstantiatedTypeArguments::WriteTo(SnapshotWriter* writer, |
| 395 intptr_t object_id, | 397 intptr_t object_id, |
| 396 Snapshot::Kind kind) { | 398 Snapshot::Kind kind) { |
| 397 ASSERT(writer != NULL); | 399 ASSERT(writer != NULL); |
| 398 ASSERT(kind == Snapshot::kMessage); | 400 ASSERT(kind == Snapshot::kMessage); |
| (...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1071 reader->AddBackRef(object_id, &scope, kIsDeserialized); | 1073 reader->AddBackRef(object_id, &scope, kIsDeserialized); |
| 1072 | 1074 |
| 1073 // Set the object tags. | 1075 // Set the object tags. |
| 1074 scope.set_tags(tags); | 1076 scope.set_tags(tags); |
| 1075 | 1077 |
| 1076 // Set all the object fields. | 1078 // Set all the object fields. |
| 1077 // TODO(5411462): Need to assert No GC can happen here, even though | 1079 // TODO(5411462): Need to assert No GC can happen here, even though |
| 1078 // allocations may happen. | 1080 // allocations may happen. |
| 1079 intptr_t num_flds = (scope.raw()->to(num_vars) - scope.raw()->from()); | 1081 intptr_t num_flds = (scope.raw()->to(num_vars) - scope.raw()->from()); |
| 1080 for (intptr_t i = 0; i <= num_flds; i++) { | 1082 for (intptr_t i = 0; i <= num_flds; i++) { |
| 1081 *(scope.raw()->from() + i) = reader->ReadObjectRef(); | 1083 scope.StorePointer((scope.raw()->from() + i), reader->ReadObjectRef()); |
| 1082 } | 1084 } |
| 1083 | 1085 |
| 1084 return scope.raw(); | 1086 return scope.raw(); |
| 1085 } | 1087 } |
| 1086 | 1088 |
| 1087 | 1089 |
| 1088 void RawContextScope::WriteTo(SnapshotWriter* writer, | 1090 void RawContextScope::WriteTo(SnapshotWriter* writer, |
| 1089 intptr_t object_id, | 1091 intptr_t object_id, |
| 1090 Snapshot::Kind kind) { | 1092 Snapshot::Kind kind) { |
| 1091 ASSERT(writer != NULL); | 1093 ASSERT(writer != NULL); |
| (...skipping 1000 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2092 reader->isolate(), | 2094 reader->isolate(), |
| 2093 JSRegExp::New(len, (kind == Snapshot::kFull) ? Heap::kOld : Heap::kNew)); | 2095 JSRegExp::New(len, (kind == Snapshot::kFull) ? Heap::kOld : Heap::kNew)); |
| 2094 reader->AddBackRef(object_id, ®ex, kIsDeserialized); | 2096 reader->AddBackRef(object_id, ®ex, kIsDeserialized); |
| 2095 | 2097 |
| 2096 // Set the object tags. | 2098 // Set the object tags. |
| 2097 regex.set_tags(tags); | 2099 regex.set_tags(tags); |
| 2098 | 2100 |
| 2099 // Read and Set all the other fields. | 2101 // Read and Set all the other fields. |
| 2100 regex.raw_ptr()->num_bracket_expressions_ = reader->ReadAsSmi(); | 2102 regex.raw_ptr()->num_bracket_expressions_ = reader->ReadAsSmi(); |
| 2101 *reader->StringHandle() ^= reader->ReadObjectImpl(); | 2103 *reader->StringHandle() ^= reader->ReadObjectImpl(); |
| 2102 regex.raw_ptr()->pattern_ = (*reader->StringHandle()).raw(); | 2104 regex.set_pattern(*reader->StringHandle()); |
| 2103 regex.raw_ptr()->type_ = reader->ReadIntptrValue(); | 2105 regex.raw_ptr()->type_ = reader->ReadIntptrValue(); |
| 2104 regex.raw_ptr()->flags_ = reader->ReadIntptrValue(); | 2106 regex.raw_ptr()->flags_ = reader->ReadIntptrValue(); |
| 2105 | 2107 |
| 2106 // TODO(5411462): Need to implement a way of recompiling the regex. | 2108 // TODO(5411462): Need to implement a way of recompiling the regex. |
| 2107 | 2109 |
| 2108 return regex.raw(); | 2110 return regex.raw(); |
| 2109 } | 2111 } |
| 2110 | 2112 |
| 2111 | 2113 |
| 2112 void RawJSRegExp::WriteTo(SnapshotWriter* writer, | 2114 void RawJSRegExp::WriteTo(SnapshotWriter* writer, |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2169 // Write out the class and tags information. | 2171 // Write out the class and tags information. |
| 2170 writer->WriteIndexedObject(kWeakPropertyCid); | 2172 writer->WriteIndexedObject(kWeakPropertyCid); |
| 2171 writer->WriteIntptrValue(writer->GetObjectTags(this)); | 2173 writer->WriteIntptrValue(writer->GetObjectTags(this)); |
| 2172 | 2174 |
| 2173 // Write out all the other fields. | 2175 // Write out all the other fields. |
| 2174 writer->Write<RawObject*>(ptr()->key_); | 2176 writer->Write<RawObject*>(ptr()->key_); |
| 2175 writer->Write<RawObject*>(ptr()->value_); | 2177 writer->Write<RawObject*>(ptr()->value_); |
| 2176 } | 2178 } |
| 2177 | 2179 |
| 2178 } // namespace dart | 2180 } // namespace dart |
| OLD | NEW |