| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 "include/dart_api.h" | 5 #include "include/dart_api.h" |
| 6 #include "include/dart_mirrors_api.h" | 6 #include "include/dart_mirrors_api.h" |
| 7 #include "include/dart_native_api.h" | 7 #include "include/dart_native_api.h" |
| 8 | 8 |
| 9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
| 10 #include "lib/stacktrace.h" | 10 #include "lib/stacktrace.h" |
| (...skipping 1476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1487 | 1487 |
| 1488 #if defined(DEBUG) | 1488 #if defined(DEBUG) |
| 1489 FunctionVisitor check_canonical(T); | 1489 FunctionVisitor check_canonical(T); |
| 1490 I->heap()->IterateObjects(&check_canonical); | 1490 I->heap()->IterateObjects(&check_canonical); |
| 1491 #endif // #if defined(DEBUG). | 1491 #endif // #if defined(DEBUG). |
| 1492 | 1492 |
| 1493 FullSnapshotWriter writer(Snapshot::kCore, | 1493 FullSnapshotWriter writer(Snapshot::kCore, |
| 1494 vm_isolate_snapshot_buffer, | 1494 vm_isolate_snapshot_buffer, |
| 1495 isolate_snapshot_buffer, | 1495 isolate_snapshot_buffer, |
| 1496 ApiReallocate, | 1496 ApiReallocate, |
| 1497 NULL, /* instructions_writer */ | 1497 NULL /* instructions_writer */); |
| 1498 true /* vm_isolate_is_symbolic */); | |
| 1499 writer.WriteFullSnapshot(); | 1498 writer.WriteFullSnapshot(); |
| 1500 *vm_isolate_snapshot_size = writer.VmIsolateSnapshotSize(); | 1499 *vm_isolate_snapshot_size = writer.VmIsolateSnapshotSize(); |
| 1501 *isolate_snapshot_size = writer.IsolateSnapshotSize(); | 1500 *isolate_snapshot_size = writer.IsolateSnapshotSize(); |
| 1502 return Api::Success(); | 1501 return Api::Success(); |
| 1503 } | 1502 } |
| 1504 | 1503 |
| 1505 | 1504 |
| 1506 static Dart_Handle createLibrarySnapshot(Dart_Handle library, | 1505 static Dart_Handle createLibrarySnapshot(Dart_Handle library, |
| 1507 uint8_t** buffer, | 1506 uint8_t** buffer, |
| 1508 intptr_t* size) { | 1507 intptr_t* size) { |
| (...skipping 4607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6116 RETURN_NULL_ERROR(assembly_size); | 6115 RETURN_NULL_ERROR(assembly_size); |
| 6117 } | 6116 } |
| 6118 I->heap()->CollectAllGarbage(); | 6117 I->heap()->CollectAllGarbage(); |
| 6119 AssemblyInstructionsWriter instructions_writer(assembly_buffer, | 6118 AssemblyInstructionsWriter instructions_writer(assembly_buffer, |
| 6120 ApiReallocate, | 6119 ApiReallocate, |
| 6121 2 * MB /* initial_size */); | 6120 2 * MB /* initial_size */); |
| 6122 FullSnapshotWriter writer(Snapshot::kAppNoJIT, | 6121 FullSnapshotWriter writer(Snapshot::kAppNoJIT, |
| 6123 vm_isolate_snapshot_buffer, | 6122 vm_isolate_snapshot_buffer, |
| 6124 isolate_snapshot_buffer, | 6123 isolate_snapshot_buffer, |
| 6125 ApiReallocate, | 6124 ApiReallocate, |
| 6126 &instructions_writer, | 6125 &instructions_writer); |
| 6127 false /* vm_isolate_is_symbolic */); | |
| 6128 | 6126 |
| 6129 writer.WriteFullSnapshot(); | 6127 writer.WriteFullSnapshot(); |
| 6130 *vm_isolate_snapshot_size = writer.VmIsolateSnapshotSize(); | 6128 *vm_isolate_snapshot_size = writer.VmIsolateSnapshotSize(); |
| 6131 *isolate_snapshot_size = writer.IsolateSnapshotSize(); | 6129 *isolate_snapshot_size = writer.IsolateSnapshotSize(); |
| 6132 *assembly_size = instructions_writer.AssemblySize(); | 6130 *assembly_size = instructions_writer.AssemblySize(); |
| 6133 | 6131 |
| 6134 return Api::Success(); | 6132 return Api::Success(); |
| 6135 } | 6133 } |
| 6136 | 6134 |
| 6137 | 6135 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6178 } | 6176 } |
| 6179 I->heap()->CollectAllGarbage(); | 6177 I->heap()->CollectAllGarbage(); |
| 6180 BlobInstructionsWriter instructions_writer(instructions_blob_buffer, | 6178 BlobInstructionsWriter instructions_writer(instructions_blob_buffer, |
| 6181 rodata_blob_buffer, | 6179 rodata_blob_buffer, |
| 6182 ApiReallocate, | 6180 ApiReallocate, |
| 6183 2 * MB /* initial_size */); | 6181 2 * MB /* initial_size */); |
| 6184 FullSnapshotWriter writer(Snapshot::kAppNoJIT, | 6182 FullSnapshotWriter writer(Snapshot::kAppNoJIT, |
| 6185 vm_isolate_snapshot_buffer, | 6183 vm_isolate_snapshot_buffer, |
| 6186 isolate_snapshot_buffer, | 6184 isolate_snapshot_buffer, |
| 6187 ApiReallocate, | 6185 ApiReallocate, |
| 6188 &instructions_writer, | 6186 &instructions_writer); |
| 6189 false /* vm_isolate_is_symbolic */); | |
| 6190 | 6187 |
| 6191 writer.WriteFullSnapshot(); | 6188 writer.WriteFullSnapshot(); |
| 6192 *vm_isolate_snapshot_size = writer.VmIsolateSnapshotSize(); | 6189 *vm_isolate_snapshot_size = writer.VmIsolateSnapshotSize(); |
| 6193 *isolate_snapshot_size = writer.IsolateSnapshotSize(); | 6190 *isolate_snapshot_size = writer.IsolateSnapshotSize(); |
| 6194 *instructions_blob_size = instructions_writer.InstructionsBlobSize(); | 6191 *instructions_blob_size = instructions_writer.InstructionsBlobSize(); |
| 6195 *rodata_blob_size = instructions_writer.RodataBlobSize(); | 6192 *rodata_blob_size = instructions_writer.RodataBlobSize(); |
| 6196 | 6193 |
| 6197 return Api::Success(); | 6194 return Api::Success(); |
| 6198 } | 6195 } |
| 6199 #endif // DART_PRECOMPILER | 6196 #endif // DART_PRECOMPILER |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6277 I->StopBackgroundCompiler(); | 6274 I->StopBackgroundCompiler(); |
| 6278 | 6275 |
| 6279 BlobInstructionsWriter instructions_writer(instructions_blob_buffer, | 6276 BlobInstructionsWriter instructions_writer(instructions_blob_buffer, |
| 6280 rodata_blob_buffer, | 6277 rodata_blob_buffer, |
| 6281 ApiReallocate, | 6278 ApiReallocate, |
| 6282 2 * MB /* initial_size */); | 6279 2 * MB /* initial_size */); |
| 6283 FullSnapshotWriter writer(Snapshot::kAppWithJIT, | 6280 FullSnapshotWriter writer(Snapshot::kAppWithJIT, |
| 6284 vm_isolate_snapshot_buffer, | 6281 vm_isolate_snapshot_buffer, |
| 6285 isolate_snapshot_buffer, | 6282 isolate_snapshot_buffer, |
| 6286 ApiReallocate, | 6283 ApiReallocate, |
| 6287 &instructions_writer, | 6284 &instructions_writer); |
| 6288 false /* vm_isolate_is_symbolic */); | |
| 6289 writer.WriteFullSnapshot(); | 6285 writer.WriteFullSnapshot(); |
| 6290 *vm_isolate_snapshot_size = writer.VmIsolateSnapshotSize(); | 6286 *vm_isolate_snapshot_size = writer.VmIsolateSnapshotSize(); |
| 6291 *isolate_snapshot_size = writer.IsolateSnapshotSize(); | 6287 *isolate_snapshot_size = writer.IsolateSnapshotSize(); |
| 6292 *instructions_blob_size = instructions_writer.InstructionsBlobSize(); | 6288 *instructions_blob_size = instructions_writer.InstructionsBlobSize(); |
| 6293 *rodata_blob_size = instructions_writer.RodataBlobSize(); | 6289 *rodata_blob_size = instructions_writer.RodataBlobSize(); |
| 6294 | 6290 |
| 6295 return Api::Success(); | 6291 return Api::Success(); |
| 6296 } | 6292 } |
| 6297 | 6293 |
| 6298 | 6294 |
| 6299 DART_EXPORT bool Dart_IsRunningPrecompiledCode() { | 6295 DART_EXPORT bool Dart_IsRunningPrecompiledCode() { |
| 6300 return Snapshot::IncludesCode(Dart::snapshot_kind()); | 6296 return Snapshot::IncludesCode(Dart::snapshot_kind()); |
| 6301 } | 6297 } |
| 6302 | 6298 |
| 6303 | 6299 |
| 6304 DART_EXPORT bool Dart_IsPrecompiledRuntime() { | 6300 DART_EXPORT bool Dart_IsPrecompiledRuntime() { |
| 6305 #if defined(DART_PRECOMPILED_RUNTIME) | 6301 #if defined(DART_PRECOMPILED_RUNTIME) |
| 6306 return true; | 6302 return true; |
| 6307 #else | 6303 #else |
| 6308 return false; | 6304 return false; |
| 6309 #endif | 6305 #endif |
| 6310 } | 6306 } |
| 6311 | 6307 |
| 6312 } // namespace dart | 6308 } // namespace dart |
| OLD | NEW |