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

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

Issue 2410303008: Revert "Use a single file for app snapshots." (Closed)
Patch Set: 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,
6326 uint8_t** assembly_buffer, 6330 uint8_t** assembly_buffer,
6327 intptr_t* assembly_size) { 6331 intptr_t* assembly_size) {
6328 UNREACHABLE(); 6332 UNREACHABLE();
6329 return 0; 6333 return 0;
6330 } 6334 }
6331 6335
6332 6336
6333 DART_EXPORT Dart_Handle Dart_CreatePrecompiledSnapshotBlob( 6337 DART_EXPORT Dart_Handle Dart_CreatePrecompiledSnapshotBlob(
6334 uint8_t** vm_isolate_snapshot_buffer, 6338 uint8_t** vm_isolate_snapshot_buffer,
6335 intptr_t* vm_isolate_snapshot_size, 6339 intptr_t* vm_isolate_snapshot_size,
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
6367 reset_fields)); 6371 reset_fields));
6368 if (!error.IsNull()) { 6372 if (!error.IsNull()) {
6369 return Api::NewHandle(T, error.raw()); 6373 return Api::NewHandle(T, error.raw());
6370 } 6374 }
6371 return Api::Success(); 6375 return Api::Success();
6372 #endif 6376 #endif
6373 } 6377 }
6374 6378
6375 6379
6376 DART_EXPORT Dart_Handle Dart_CreatePrecompiledSnapshotAssembly( 6380 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,
6377 uint8_t** assembly_buffer, 6385 uint8_t** assembly_buffer,
6378 intptr_t* assembly_size) { 6386 intptr_t* assembly_size) {
6379 #if defined(TARGET_ARCH_IA32) 6387 #if defined(TARGET_ARCH_IA32)
6380 return Api::NewError("Precompilation is not supported on IA32."); 6388 return Api::NewError("Precompilation is not supported on IA32.");
6381 #elif defined(TARGET_ARCH_DBC) 6389 #elif defined(TARGET_ARCH_DBC)
6382 return Api::NewError("Precompilation is not supported on DBC."); 6390 return Api::NewError("Precompilation is not supported on DBC.");
6383 #else 6391 #else
6384 API_TIMELINE_DURATION; 6392 API_TIMELINE_DURATION;
6385 DARTSCOPE(Thread::Current()); 6393 DARTSCOPE(Thread::Current());
6386 Isolate* I = T->isolate(); 6394 Isolate* I = T->isolate();
6387 if (I->compilation_allowed()) { 6395 if (I->compilation_allowed()) {
6388 return Api::NewError("Isolate is not precompiled. " 6396 return Api::NewError("Isolate is not precompiled. "
6389 "Did you forget to call Dart_Precompile?"); 6397 "Did you forget to call Dart_Precompile?");
6390 } 6398 }
6391 ASSERT(FLAG_load_deferred_eagerly); 6399 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 }
6392 if (assembly_buffer == NULL) { 6412 if (assembly_buffer == NULL) {
6393 RETURN_NULL_ERROR(assembly_buffer); 6413 RETURN_NULL_ERROR(assembly_buffer);
6394 } 6414 }
6395 if (assembly_size == NULL) { 6415 if (assembly_size == NULL) {
6396 RETURN_NULL_ERROR(assembly_size); 6416 RETURN_NULL_ERROR(assembly_size);
6397 } 6417 }
6398 6418
6399 NOT_IN_PRODUCT(TimelineDurationScope tds2(T, Timeline::GetIsolateStream(), 6419 NOT_IN_PRODUCT(TimelineDurationScope tds2(T, Timeline::GetIsolateStream(),
6400 "WriteAppAOTSnapshot")); 6420 "WriteAppAOTSnapshot"));
6401 AssemblyInstructionsWriter instructions_writer(assembly_buffer, 6421 AssemblyInstructionsWriter instructions_writer(assembly_buffer,
6402 ApiReallocate, 6422 ApiReallocate,
6403 2 * MB /* initial_size */); 6423 2 * MB /* initial_size */);
6404 uint8_t* vm_isolate_snapshot_buffer = NULL;
6405 uint8_t* isolate_snapshot_buffer = NULL;
6406 FullSnapshotWriter writer(Snapshot::kAppNoJIT, 6424 FullSnapshotWriter writer(Snapshot::kAppNoJIT,
6407 &vm_isolate_snapshot_buffer, 6425 vm_isolate_snapshot_buffer,
6408 &isolate_snapshot_buffer, 6426 isolate_snapshot_buffer,
6409 ApiReallocate, 6427 ApiReallocate,
6410 &instructions_writer); 6428 &instructions_writer);
6411 6429
6412 writer.WriteFullSnapshot(); 6430 writer.WriteFullSnapshot();
6431 *vm_isolate_snapshot_size = writer.VmIsolateSnapshotSize();
6432 *isolate_snapshot_size = writer.IsolateSnapshotSize();
6413 *assembly_size = instructions_writer.AssemblySize(); 6433 *assembly_size = instructions_writer.AssemblySize();
6414 6434
6415 return Api::Success(); 6435 return Api::Success();
6416 #endif 6436 #endif
6417 } 6437 }
6418 6438
6419 6439
6420 DART_EXPORT Dart_Handle Dart_CreatePrecompiledSnapshotBlob( 6440 DART_EXPORT Dart_Handle Dart_CreatePrecompiledSnapshotBlob(
6421 uint8_t** vm_isolate_snapshot_buffer, 6441 uint8_t** vm_isolate_snapshot_buffer,
6422 intptr_t* vm_isolate_snapshot_size, 6442 intptr_t* vm_isolate_snapshot_size,
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
6601 6621
6602 DART_EXPORT bool Dart_IsPrecompiledRuntime() { 6622 DART_EXPORT bool Dart_IsPrecompiledRuntime() {
6603 #if defined(DART_PRECOMPILED_RUNTIME) 6623 #if defined(DART_PRECOMPILED_RUNTIME)
6604 return true; 6624 return true;
6605 #else 6625 #else
6606 return false; 6626 return false;
6607 #endif 6627 #endif
6608 } 6628 }
6609 6629
6610 } // namespace dart 6630 } // 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