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