Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(54)

Side by Side Diff: runtime/vm/dart_api_impl.cc

Issue 2405393002: Use a single file for app snapshots. (Closed)
Patch Set: gen_snapshot Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/clustered_snapshot.cc ('k') | runtime/vm/snapshot.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 6305 matching lines...) Expand 10 before | Expand all | Expand 10 after
6316 6316
6317 DART_EXPORT Dart_Handle Dart_Precompile( 6317 DART_EXPORT Dart_Handle Dart_Precompile(
6318 Dart_QualifiedFunctionName entry_points[], 6318 Dart_QualifiedFunctionName entry_points[],
6319 bool reset_fields) { 6319 bool reset_fields) {
6320 UNREACHABLE(); 6320 UNREACHABLE();
6321 return 0; 6321 return 0;
6322 } 6322 }
6323 6323
6324 6324
6325 DART_EXPORT Dart_Handle Dart_CreatePrecompiledSnapshotAssembly( 6325 DART_EXPORT Dart_Handle Dart_CreatePrecompiledSnapshotAssembly(
6326 uint8_t** vm_isolate_snapshot_buffer,
6327 intptr_t* vm_isolate_snapshot_size,
6328 uint8_t** isolate_snapshot_buffer,
6329 intptr_t* isolate_snapshot_size,
6330 uint8_t** assembly_buffer, 6326 uint8_t** assembly_buffer,
6331 intptr_t* assembly_size) { 6327 intptr_t* assembly_size) {
6332 UNREACHABLE(); 6328 UNREACHABLE();
6333 return 0; 6329 return 0;
6334 } 6330 }
6335 6331
6336 6332
6337 DART_EXPORT Dart_Handle Dart_CreatePrecompiledSnapshotBlob( 6333 DART_EXPORT Dart_Handle Dart_CreatePrecompiledSnapshotBlob(
6338 uint8_t** vm_isolate_snapshot_buffer, 6334 uint8_t** vm_isolate_snapshot_buffer,
6339 intptr_t* vm_isolate_snapshot_size, 6335 intptr_t* vm_isolate_snapshot_size,
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
6371 reset_fields)); 6367 reset_fields));
6372 if (!error.IsNull()) { 6368 if (!error.IsNull()) {
6373 return Api::NewHandle(T, error.raw()); 6369 return Api::NewHandle(T, error.raw());
6374 } 6370 }
6375 return Api::Success(); 6371 return Api::Success();
6376 #endif 6372 #endif
6377 } 6373 }
6378 6374
6379 6375
6380 DART_EXPORT Dart_Handle Dart_CreatePrecompiledSnapshotAssembly( 6376 DART_EXPORT Dart_Handle Dart_CreatePrecompiledSnapshotAssembly(
6381 uint8_t** vm_isolate_snapshot_buffer,
6382 intptr_t* vm_isolate_snapshot_size,
6383 uint8_t** isolate_snapshot_buffer,
6384 intptr_t* isolate_snapshot_size,
6385 uint8_t** assembly_buffer, 6377 uint8_t** assembly_buffer,
6386 intptr_t* assembly_size) { 6378 intptr_t* assembly_size) {
6387 #if defined(TARGET_ARCH_IA32) 6379 #if defined(TARGET_ARCH_IA32)
6388 return Api::NewError("Precompilation is not supported on IA32."); 6380 return Api::NewError("Precompilation is not supported on IA32.");
6389 #elif defined(TARGET_ARCH_DBC) 6381 #elif defined(TARGET_ARCH_DBC)
6390 return Api::NewError("Precompilation is not supported on DBC."); 6382 return Api::NewError("Precompilation is not supported on DBC.");
6391 #else 6383 #else
6392 API_TIMELINE_DURATION; 6384 API_TIMELINE_DURATION;
6393 DARTSCOPE(Thread::Current()); 6385 DARTSCOPE(Thread::Current());
6394 Isolate* I = T->isolate(); 6386 Isolate* I = T->isolate();
6395 if (I->compilation_allowed()) { 6387 if (I->compilation_allowed()) {
6396 return Api::NewError("Isolate is not precompiled. " 6388 return Api::NewError("Isolate is not precompiled. "
6397 "Did you forget to call Dart_Precompile?"); 6389 "Did you forget to call Dart_Precompile?");
6398 } 6390 }
6399 ASSERT(FLAG_load_deferred_eagerly); 6391 ASSERT(FLAG_load_deferred_eagerly);
6400 if (vm_isolate_snapshot_buffer == NULL) {
6401 RETURN_NULL_ERROR(vm_isolate_snapshot_buffer);
6402 }
6403 if (vm_isolate_snapshot_size == NULL) {
6404 RETURN_NULL_ERROR(vm_isolate_snapshot_size);
6405 }
6406 if (isolate_snapshot_buffer == NULL) {
6407 RETURN_NULL_ERROR(isolate_snapshot_buffer);
6408 }
6409 if (isolate_snapshot_size == NULL) {
6410 RETURN_NULL_ERROR(isolate_snapshot_size);
6411 }
6412 if (assembly_buffer == NULL) { 6392 if (assembly_buffer == NULL) {
6413 RETURN_NULL_ERROR(assembly_buffer); 6393 RETURN_NULL_ERROR(assembly_buffer);
6414 } 6394 }
6415 if (assembly_size == NULL) { 6395 if (assembly_size == NULL) {
6416 RETURN_NULL_ERROR(assembly_size); 6396 RETURN_NULL_ERROR(assembly_size);
6417 } 6397 }
6418 6398
6419 NOT_IN_PRODUCT(TimelineDurationScope tds2(T, Timeline::GetIsolateStream(), 6399 NOT_IN_PRODUCT(TimelineDurationScope tds2(T, Timeline::GetIsolateStream(),
6420 "WriteAppAOTSnapshot")); 6400 "WriteAppAOTSnapshot"));
6421 AssemblyInstructionsWriter instructions_writer(assembly_buffer, 6401 AssemblyInstructionsWriter instructions_writer(assembly_buffer,
6422 ApiReallocate, 6402 ApiReallocate,
6423 2 * MB /* initial_size */); 6403 2 * MB /* initial_size */);
6404 uint8_t* vm_isolate_snapshot_buffer = NULL;
6405 uint8_t* isolate_snapshot_buffer = NULL;
6424 FullSnapshotWriter writer(Snapshot::kAppNoJIT, 6406 FullSnapshotWriter writer(Snapshot::kAppNoJIT,
6425 vm_isolate_snapshot_buffer, 6407 &vm_isolate_snapshot_buffer,
6426 isolate_snapshot_buffer, 6408 &isolate_snapshot_buffer,
6427 ApiReallocate, 6409 ApiReallocate,
6428 &instructions_writer); 6410 &instructions_writer);
6429 6411
6430 writer.WriteFullSnapshot(); 6412 writer.WriteFullSnapshot();
6431 *vm_isolate_snapshot_size = writer.VmIsolateSnapshotSize();
6432 *isolate_snapshot_size = writer.IsolateSnapshotSize();
6433 *assembly_size = instructions_writer.AssemblySize(); 6413 *assembly_size = instructions_writer.AssemblySize();
6434 6414
6435 return Api::Success(); 6415 return Api::Success();
6436 #endif 6416 #endif
6437 } 6417 }
6438 6418
6439 6419
6440 DART_EXPORT Dart_Handle Dart_CreatePrecompiledSnapshotBlob( 6420 DART_EXPORT Dart_Handle Dart_CreatePrecompiledSnapshotBlob(
6441 uint8_t** vm_isolate_snapshot_buffer, 6421 uint8_t** vm_isolate_snapshot_buffer,
6442 intptr_t* vm_isolate_snapshot_size, 6422 intptr_t* vm_isolate_snapshot_size,
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
6621 6601
6622 DART_EXPORT bool Dart_IsPrecompiledRuntime() { 6602 DART_EXPORT bool Dart_IsPrecompiledRuntime() {
6623 #if defined(DART_PRECOMPILED_RUNTIME) 6603 #if defined(DART_PRECOMPILED_RUNTIME)
6624 return true; 6604 return true;
6625 #else 6605 #else
6626 return false; 6606 return false;
6627 #endif 6607 #endif
6628 } 6608 }
6629 6609
6630 } // namespace dart 6610 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/clustered_snapshot.cc ('k') | runtime/vm/snapshot.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698