| 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 #if defined(DEBUG) | 1487 #if defined(DEBUG) |
| 1488 I->heap()->CollectAllGarbage(); | 1488 I->heap()->CollectAllGarbage(); |
| 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 4666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6175 if (assembly_size == NULL) { | 6174 if (assembly_size == NULL) { |
| 6176 RETURN_NULL_ERROR(assembly_size); | 6175 RETURN_NULL_ERROR(assembly_size); |
| 6177 } | 6176 } |
| 6178 AssemblyInstructionsWriter instructions_writer(assembly_buffer, | 6177 AssemblyInstructionsWriter instructions_writer(assembly_buffer, |
| 6179 ApiReallocate, | 6178 ApiReallocate, |
| 6180 2 * MB /* initial_size */); | 6179 2 * MB /* initial_size */); |
| 6181 FullSnapshotWriter writer(Snapshot::kAppNoJIT, | 6180 FullSnapshotWriter writer(Snapshot::kAppNoJIT, |
| 6182 vm_isolate_snapshot_buffer, | 6181 vm_isolate_snapshot_buffer, |
| 6183 isolate_snapshot_buffer, | 6182 isolate_snapshot_buffer, |
| 6184 ApiReallocate, | 6183 ApiReallocate, |
| 6185 &instructions_writer, | 6184 &instructions_writer); |
| 6186 false /* vm_isolate_is_symbolic */); | |
| 6187 | 6185 |
| 6188 writer.WriteFullSnapshot(); | 6186 writer.WriteFullSnapshot(); |
| 6189 *vm_isolate_snapshot_size = writer.VmIsolateSnapshotSize(); | 6187 *vm_isolate_snapshot_size = writer.VmIsolateSnapshotSize(); |
| 6190 *isolate_snapshot_size = writer.IsolateSnapshotSize(); | 6188 *isolate_snapshot_size = writer.IsolateSnapshotSize(); |
| 6191 *assembly_size = instructions_writer.AssemblySize(); | 6189 *assembly_size = instructions_writer.AssemblySize(); |
| 6192 | 6190 |
| 6193 return Api::Success(); | 6191 return Api::Success(); |
| 6194 } | 6192 } |
| 6195 | 6193 |
| 6196 | 6194 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6236 RETURN_NULL_ERROR(instructions_blob_size); | 6234 RETURN_NULL_ERROR(instructions_blob_size); |
| 6237 } | 6235 } |
| 6238 BlobInstructionsWriter instructions_writer(instructions_blob_buffer, | 6236 BlobInstructionsWriter instructions_writer(instructions_blob_buffer, |
| 6239 rodata_blob_buffer, | 6237 rodata_blob_buffer, |
| 6240 ApiReallocate, | 6238 ApiReallocate, |
| 6241 2 * MB /* initial_size */); | 6239 2 * MB /* initial_size */); |
| 6242 FullSnapshotWriter writer(Snapshot::kAppNoJIT, | 6240 FullSnapshotWriter writer(Snapshot::kAppNoJIT, |
| 6243 vm_isolate_snapshot_buffer, | 6241 vm_isolate_snapshot_buffer, |
| 6244 isolate_snapshot_buffer, | 6242 isolate_snapshot_buffer, |
| 6245 ApiReallocate, | 6243 ApiReallocate, |
| 6246 &instructions_writer, | 6244 &instructions_writer); |
| 6247 false /* vm_isolate_is_symbolic */); | |
| 6248 | 6245 |
| 6249 writer.WriteFullSnapshot(); | 6246 writer.WriteFullSnapshot(); |
| 6250 *vm_isolate_snapshot_size = writer.VmIsolateSnapshotSize(); | 6247 *vm_isolate_snapshot_size = writer.VmIsolateSnapshotSize(); |
| 6251 *isolate_snapshot_size = writer.IsolateSnapshotSize(); | 6248 *isolate_snapshot_size = writer.IsolateSnapshotSize(); |
| 6252 *instructions_blob_size = instructions_writer.InstructionsBlobSize(); | 6249 *instructions_blob_size = instructions_writer.InstructionsBlobSize(); |
| 6253 *rodata_blob_size = instructions_writer.RodataBlobSize(); | 6250 *rodata_blob_size = instructions_writer.RodataBlobSize(); |
| 6254 | 6251 |
| 6255 return Api::Success(); | 6252 return Api::Success(); |
| 6256 } | 6253 } |
| 6257 #endif // DART_PRECOMPILER | 6254 #endif // DART_PRECOMPILER |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6334 I->StopBackgroundCompiler(); | 6331 I->StopBackgroundCompiler(); |
| 6335 | 6332 |
| 6336 BlobInstructionsWriter instructions_writer(instructions_blob_buffer, | 6333 BlobInstructionsWriter instructions_writer(instructions_blob_buffer, |
| 6337 rodata_blob_buffer, | 6334 rodata_blob_buffer, |
| 6338 ApiReallocate, | 6335 ApiReallocate, |
| 6339 2 * MB /* initial_size */); | 6336 2 * MB /* initial_size */); |
| 6340 FullSnapshotWriter writer(Snapshot::kAppWithJIT, | 6337 FullSnapshotWriter writer(Snapshot::kAppWithJIT, |
| 6341 vm_isolate_snapshot_buffer, | 6338 vm_isolate_snapshot_buffer, |
| 6342 isolate_snapshot_buffer, | 6339 isolate_snapshot_buffer, |
| 6343 ApiReallocate, | 6340 ApiReallocate, |
| 6344 &instructions_writer, | 6341 &instructions_writer); |
| 6345 false /* vm_isolate_is_symbolic */); | |
| 6346 writer.WriteFullSnapshot(); | 6342 writer.WriteFullSnapshot(); |
| 6347 *vm_isolate_snapshot_size = writer.VmIsolateSnapshotSize(); | 6343 *vm_isolate_snapshot_size = writer.VmIsolateSnapshotSize(); |
| 6348 *isolate_snapshot_size = writer.IsolateSnapshotSize(); | 6344 *isolate_snapshot_size = writer.IsolateSnapshotSize(); |
| 6349 *instructions_blob_size = instructions_writer.InstructionsBlobSize(); | 6345 *instructions_blob_size = instructions_writer.InstructionsBlobSize(); |
| 6350 *rodata_blob_size = instructions_writer.RodataBlobSize(); | 6346 *rodata_blob_size = instructions_writer.RodataBlobSize(); |
| 6351 | 6347 |
| 6352 return Api::Success(); | 6348 return Api::Success(); |
| 6353 } | 6349 } |
| 6354 | 6350 |
| 6355 | 6351 |
| 6356 DART_EXPORT bool Dart_IsRunningPrecompiledCode() { | 6352 DART_EXPORT bool Dart_IsRunningPrecompiledCode() { |
| 6357 return Snapshot::IncludesCode(Dart::snapshot_kind()); | 6353 return Snapshot::IncludesCode(Dart::snapshot_kind()); |
| 6358 } | 6354 } |
| 6359 | 6355 |
| 6360 | 6356 |
| 6361 DART_EXPORT bool Dart_IsPrecompiledRuntime() { | 6357 DART_EXPORT bool Dart_IsPrecompiledRuntime() { |
| 6362 #if defined(DART_PRECOMPILED_RUNTIME) | 6358 #if defined(DART_PRECOMPILED_RUNTIME) |
| 6363 return true; | 6359 return true; |
| 6364 #else | 6360 #else |
| 6365 return false; | 6361 return false; |
| 6366 #endif | 6362 #endif |
| 6367 } | 6363 } |
| 6368 | 6364 |
| 6369 } // namespace dart | 6365 } // namespace dart |
| OLD | NEW |