OLD | NEW |
1 // Copyright (c) 2014, the Dartino project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dartino 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.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
4 | 4 |
5 #ifdef DARTINO_ENABLE_DEBUGGING | 5 #ifdef DARTINO_ENABLE_DEBUGGING |
6 | 6 |
7 #include "src/vm/session.h" | 7 #include "src/vm/session.h" |
8 | 8 |
9 #include "src/shared/bytecodes.h" | 9 #include "src/shared/bytecodes.h" |
10 #include "src/shared/connection.h" | 10 #include "src/shared/connection.h" |
(...skipping 1512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1523 const char* path, | 1523 const char* path, |
1524 FunctionOffsetsType* function_offsets, | 1524 FunctionOffsetsType* function_offsets, |
1525 ClassOffsetsType* class_offsets) { | 1525 ClassOffsetsType* class_offsets) { |
1526 // Make sure that the program is in the compact form before | 1526 // Make sure that the program is in the compact form before |
1527 // snapshotting. | 1527 // snapshotting. |
1528 if (!program()->is_optimized()) { | 1528 if (!program()->is_optimized()) { |
1529 ProgramFolder program_folder(program()); | 1529 ProgramFolder program_folder(program()); |
1530 program_folder.Fold(); | 1530 program_folder.Fold(); |
1531 } | 1531 } |
1532 | 1532 |
| 1533 program()->VerifyObjectPlacements(); |
| 1534 |
1533 SnapshotWriter writer(function_offsets, class_offsets); | 1535 SnapshotWriter writer(function_offsets, class_offsets); |
1534 List<uint8> snapshot = writer.WriteProgram(program()); | 1536 List<uint8> snapshot = writer.WriteProgram(program()); |
1535 bool success = writeToDisk | 1537 bool success = writeToDisk |
1536 ? Platform::StoreFile(path, snapshot) | 1538 ? Platform::StoreFile(path, snapshot) |
1537 : true; | 1539 : true; |
1538 snapshot.Delete(); | 1540 snapshot.Delete(); |
1539 return success; | 1541 return success; |
1540 } | 1542 } |
1541 | 1543 |
1542 void Session::NewMap(int map_index) { | 1544 void Session::NewMap(int map_index) { |
(...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2252 if (program()->was_loaded_from_snapshot()) { | 2254 if (program()->was_loaded_from_snapshot()) { |
2253 return program()->OffsetOf(HeapObject::cast(klass)); | 2255 return program()->OffsetOf(HeapObject::cast(klass)); |
2254 } else { | 2256 } else { |
2255 return MapLookupByObject(class_map_id_, klass); | 2257 return MapLookupByObject(class_map_id_, klass); |
2256 } | 2258 } |
2257 } | 2259 } |
2258 | 2260 |
2259 } // namespace dartino | 2261 } // namespace dartino |
2260 | 2262 |
2261 #endif // DARTINO_ENABLE_DEBUGGING | 2263 #endif // DARTINO_ENABLE_DEBUGGING |
OLD | NEW |