| 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/snapshot.h" | 5 #include "vm/snapshot.h" |
| 6 | 6 |
| 7 #include "platform/assert.h" | 7 #include "platform/assert.h" |
| 8 #include "vm/bigint_operations.h" | 8 #include "vm/bigint_operations.h" |
| 9 #include "vm/bootstrap.h" | 9 #include "vm/bootstrap.h" |
| 10 #include "vm/class_finalizer.h" | |
| 11 #include "vm/exceptions.h" | 10 #include "vm/exceptions.h" |
| 12 #include "vm/heap.h" | 11 #include "vm/heap.h" |
| 13 #include "vm/longjump.h" | 12 #include "vm/longjump.h" |
| 14 #include "vm/object.h" | 13 #include "vm/object.h" |
| 15 #include "vm/object_store.h" | 14 #include "vm/object_store.h" |
| 16 #include "vm/snapshot_ids.h" | 15 #include "vm/snapshot_ids.h" |
| 17 #include "vm/symbols.h" | 16 #include "vm/symbols.h" |
| 18 | 17 |
| 19 namespace dart { | 18 namespace dart { |
| 20 | 19 |
| (...skipping 920 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 941 } | 940 } |
| 942 UNREACHABLE(); | 941 UNREACHABLE(); |
| 943 } | 942 } |
| 944 | 943 |
| 945 | 944 |
| 946 void FullSnapshotWriter::WriteFullSnapshot() { | 945 void FullSnapshotWriter::WriteFullSnapshot() { |
| 947 Isolate* isolate = Isolate::Current(); | 946 Isolate* isolate = Isolate::Current(); |
| 948 ASSERT(isolate != NULL); | 947 ASSERT(isolate != NULL); |
| 949 ObjectStore* object_store = isolate->object_store(); | 948 ObjectStore* object_store = isolate->object_store(); |
| 950 ASSERT(object_store != NULL); | 949 ASSERT(object_store != NULL); |
| 951 ASSERT(ClassFinalizer::AllClassesFinalized()); | |
| 952 | 950 |
| 953 // Setup for long jump in case there is an exception while writing | 951 // Setup for long jump in case there is an exception while writing |
| 954 // the snapshot. | 952 // the snapshot. |
| 955 LongJump* base = isolate->long_jump_base(); | 953 LongJump* base = isolate->long_jump_base(); |
| 956 LongJump jump; | 954 LongJump jump; |
| 957 isolate->set_long_jump_base(&jump); | 955 isolate->set_long_jump_base(&jump); |
| 958 // TODO(6726): Allocate these constant strings once in the VM isolate. | 956 // TODO(6726): Allocate these constant strings once in the VM isolate. |
| 959 *ErrorHandle() = LanguageError::New( | 957 *ErrorHandle() = LanguageError::New( |
| 960 String::Handle(String::New("Error while writing full snapshot"))); | 958 String::Handle(String::New("Error while writing full snapshot"))); |
| 961 if (setjmp(*jump.Set()) == 0) { | 959 if (setjmp(*jump.Set()) == 0) { |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1254 args.SetAt(0, msg_obj); | 1252 args.SetAt(0, msg_obj); |
| 1255 Exceptions::ThrowByType(type, args); | 1253 Exceptions::ThrowByType(type, args); |
| 1256 UNREACHABLE(); | 1254 UNREACHABLE(); |
| 1257 } | 1255 } |
| 1258 | 1256 |
| 1259 | 1257 |
| 1260 void ScriptSnapshotWriter::WriteScriptSnapshot(const Library& lib) { | 1258 void ScriptSnapshotWriter::WriteScriptSnapshot(const Library& lib) { |
| 1261 ASSERT(kind() == Snapshot::kScript); | 1259 ASSERT(kind() == Snapshot::kScript); |
| 1262 Isolate* isolate = Isolate::Current(); | 1260 Isolate* isolate = Isolate::Current(); |
| 1263 ASSERT(isolate != NULL); | 1261 ASSERT(isolate != NULL); |
| 1264 ASSERT(ClassFinalizer::AllClassesFinalized()); | |
| 1265 | 1262 |
| 1266 // Setup for long jump in case there is an exception while writing | 1263 // Setup for long jump in case there is an exception while writing |
| 1267 // the snapshot. | 1264 // the snapshot. |
| 1268 LongJump* base = isolate->long_jump_base(); | 1265 LongJump* base = isolate->long_jump_base(); |
| 1269 LongJump jump; | 1266 LongJump jump; |
| 1270 isolate->set_long_jump_base(&jump); | 1267 isolate->set_long_jump_base(&jump); |
| 1271 *ErrorHandle() = LanguageError::New( | 1268 *ErrorHandle() = LanguageError::New( |
| 1272 String::Handle(String::New("Error while writing script snapshot"))); | 1269 String::Handle(String::New("Error while writing script snapshot"))); |
| 1273 if (setjmp(*jump.Set()) == 0) { | 1270 if (setjmp(*jump.Set()) == 0) { |
| 1274 // Write out the library object. | 1271 // Write out the library object. |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1315 UnmarkAll(); | 1312 UnmarkAll(); |
| 1316 isolate->set_long_jump_base(base); | 1313 isolate->set_long_jump_base(base); |
| 1317 } else { | 1314 } else { |
| 1318 isolate->set_long_jump_base(base); | 1315 isolate->set_long_jump_base(base); |
| 1319 ThrowException(exception_type(), exception_msg()); | 1316 ThrowException(exception_type(), exception_msg()); |
| 1320 } | 1317 } |
| 1321 } | 1318 } |
| 1322 | 1319 |
| 1323 | 1320 |
| 1324 } // namespace dart | 1321 } // namespace dart |
| OLD | NEW |