| 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 1504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1515 const char* path, | 1515 const char* path, |
| 1516 FunctionOffsetsType* function_offsets, | 1516 FunctionOffsetsType* function_offsets, |
| 1517 ClassOffsetsType* class_offsets) { | 1517 ClassOffsetsType* class_offsets) { |
| 1518 // Make sure that the program is in the compact form before | 1518 // Make sure that the program is in the compact form before |
| 1519 // snapshotting. | 1519 // snapshotting. |
| 1520 if (!program()->is_optimized()) { | 1520 if (!program()->is_optimized()) { |
| 1521 ProgramFolder program_folder(program()); | 1521 ProgramFolder program_folder(program()); |
| 1522 program_folder.Fold(); | 1522 program_folder.Fold(); |
| 1523 } | 1523 } |
| 1524 | 1524 |
| 1525 program()->VerifyObjectPlacements(); |
| 1526 |
| 1525 SnapshotWriter writer(function_offsets, class_offsets); | 1527 SnapshotWriter writer(function_offsets, class_offsets); |
| 1526 List<uint8> snapshot = writer.WriteProgram(program()); | 1528 List<uint8> snapshot = writer.WriteProgram(program()); |
| 1527 bool success = writeToDisk | 1529 bool success = writeToDisk |
| 1528 ? Platform::StoreFile(path, snapshot) | 1530 ? Platform::StoreFile(path, snapshot) |
| 1529 : true; | 1531 : true; |
| 1530 snapshot.Delete(); | 1532 snapshot.Delete(); |
| 1531 return success; | 1533 return success; |
| 1532 } | 1534 } |
| 1533 | 1535 |
| 1534 void Session::NewMap(int map_index) { | 1536 void Session::NewMap(int map_index) { |
| (...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2244 if (program()->was_loaded_from_snapshot()) { | 2246 if (program()->was_loaded_from_snapshot()) { |
| 2245 return program()->OffsetOf(HeapObject::cast(klass)); | 2247 return program()->OffsetOf(HeapObject::cast(klass)); |
| 2246 } else { | 2248 } else { |
| 2247 return MapLookupByObject(class_map_id_, klass); | 2249 return MapLookupByObject(class_map_id_, klass); |
| 2248 } | 2250 } |
| 2249 } | 2251 } |
| 2250 | 2252 |
| 2251 } // namespace dartino | 2253 } // namespace dartino |
| 2252 | 2254 |
| 2253 #endif // DARTINO_ENABLE_DEBUGGING | 2255 #endif // DARTINO_ENABLE_DEBUGGING |
| OLD | NEW |