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

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

Issue 2196693003: DBC: Fail cleanly when attempting to create an AOT or JIT app snapshot. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 4 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
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 6218 matching lines...) Expand 10 before | Expand all | Expand 10 after
6229 return 0; 6229 return 0;
6230 } 6230 }
6231 6231
6232 #else // DART_PRECOMPILER 6232 #else // DART_PRECOMPILER
6233 6233
6234 DART_EXPORT Dart_Handle Dart_Precompile( 6234 DART_EXPORT Dart_Handle Dart_Precompile(
6235 Dart_QualifiedFunctionName entry_points[], 6235 Dart_QualifiedFunctionName entry_points[],
6236 bool reset_fields) { 6236 bool reset_fields) {
6237 #if defined(TARGET_ARCH_IA32) 6237 #if defined(TARGET_ARCH_IA32)
6238 return Api::NewError("Precompilation is not supported on IA32."); 6238 return Api::NewError("Precompilation is not supported on IA32.");
6239 #elif defined(TARGET_ARCH_DBC)
6240 return Api::NewError("Precompilation is not supported on DBC.");
6239 #else 6241 #else
6240 API_TIMELINE_BEGIN_END; 6242 API_TIMELINE_BEGIN_END;
6241 DARTSCOPE(Thread::Current()); 6243 DARTSCOPE(Thread::Current());
6242 if (!FLAG_precompiled_mode) { 6244 if (!FLAG_precompiled_mode) {
6243 return Api::NewError("Flag --precompilation was not specified."); 6245 return Api::NewError("Flag --precompilation was not specified.");
6244 } 6246 }
6245 Dart_Handle result = Api::CheckAndFinalizePendingClasses(T); 6247 Dart_Handle result = Api::CheckAndFinalizePendingClasses(T);
6246 if (::Dart_IsError(result)) { 6248 if (::Dart_IsError(result)) {
6247 return result; 6249 return result;
6248 } 6250 }
6249 CHECK_CALLBACK_STATE(T); 6251 CHECK_CALLBACK_STATE(T);
6250 const Error& error = Error::Handle(Precompiler::CompileAll(entry_points, 6252 const Error& error = Error::Handle(Precompiler::CompileAll(entry_points,
6251 reset_fields)); 6253 reset_fields));
6252 if (!error.IsNull()) { 6254 if (!error.IsNull()) {
6253 return Api::NewHandle(T, error.raw()); 6255 return Api::NewHandle(T, error.raw());
6254 } 6256 }
6255 return Api::Success(); 6257 return Api::Success();
6256 #endif 6258 #endif
6257 } 6259 }
6258 6260
6259 6261
6260 DART_EXPORT Dart_Handle Dart_CreatePrecompiledSnapshotAssembly( 6262 DART_EXPORT Dart_Handle Dart_CreatePrecompiledSnapshotAssembly(
6261 uint8_t** vm_isolate_snapshot_buffer, 6263 uint8_t** vm_isolate_snapshot_buffer,
6262 intptr_t* vm_isolate_snapshot_size, 6264 intptr_t* vm_isolate_snapshot_size,
6263 uint8_t** isolate_snapshot_buffer, 6265 uint8_t** isolate_snapshot_buffer,
6264 intptr_t* isolate_snapshot_size, 6266 intptr_t* isolate_snapshot_size,
6265 uint8_t** assembly_buffer, 6267 uint8_t** assembly_buffer,
6266 intptr_t* assembly_size) { 6268 intptr_t* assembly_size) {
6267 #if defined(TARGET_ARCH_IA32) 6269 #if defined(TARGET_ARCH_IA32)
6268 return Api::NewError("Snapshots with code are not supported on IA32."); 6270 return Api::NewError("Precompilation is not supported on IA32.");
6271 #elif defined(TARGET_ARCH_DBC)
6272 return Api::NewError("Precompilation is not supported on DBC.");
6269 #else 6273 #else
6270 API_TIMELINE_DURATION; 6274 API_TIMELINE_DURATION;
6271 DARTSCOPE(Thread::Current()); 6275 DARTSCOPE(Thread::Current());
6272 Isolate* I = T->isolate(); 6276 Isolate* I = T->isolate();
6273 if (I->compilation_allowed()) { 6277 if (I->compilation_allowed()) {
6274 return Api::NewError("Isolate is not precompiled. " 6278 return Api::NewError("Isolate is not precompiled. "
6275 "Did you forget to call Dart_Precompile?"); 6279 "Did you forget to call Dart_Precompile?");
6276 } 6280 }
6277 ASSERT(FLAG_load_deferred_eagerly); 6281 ASSERT(FLAG_load_deferred_eagerly);
6278 if (vm_isolate_snapshot_buffer == NULL) { 6282 if (vm_isolate_snapshot_buffer == NULL) {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
6318 DART_EXPORT Dart_Handle Dart_CreatePrecompiledSnapshotBlob( 6322 DART_EXPORT Dart_Handle Dart_CreatePrecompiledSnapshotBlob(
6319 uint8_t** vm_isolate_snapshot_buffer, 6323 uint8_t** vm_isolate_snapshot_buffer,
6320 intptr_t* vm_isolate_snapshot_size, 6324 intptr_t* vm_isolate_snapshot_size,
6321 uint8_t** isolate_snapshot_buffer, 6325 uint8_t** isolate_snapshot_buffer,
6322 intptr_t* isolate_snapshot_size, 6326 intptr_t* isolate_snapshot_size,
6323 uint8_t** instructions_blob_buffer, 6327 uint8_t** instructions_blob_buffer,
6324 intptr_t* instructions_blob_size, 6328 intptr_t* instructions_blob_size,
6325 uint8_t** rodata_blob_buffer, 6329 uint8_t** rodata_blob_buffer,
6326 intptr_t* rodata_blob_size) { 6330 intptr_t* rodata_blob_size) {
6327 #if defined(TARGET_ARCH_IA32) 6331 #if defined(TARGET_ARCH_IA32)
6328 return Api::NewError("Snapshots with code are not supported on IA32."); 6332 return Api::NewError("Precompilation is not supported on IA32.");
6333 #elif defined(TARGET_ARCH_DBC)
6334 return Api::NewError("Precompilation is not supported on DBC.");
6329 #else 6335 #else
6330 API_TIMELINE_DURATION; 6336 API_TIMELINE_DURATION;
6331 DARTSCOPE(Thread::Current()); 6337 DARTSCOPE(Thread::Current());
6332 Isolate* I = T->isolate(); 6338 Isolate* I = T->isolate();
6333 if (I->compilation_allowed()) { 6339 if (I->compilation_allowed()) {
6334 return Api::NewError("Isolate is not precompiled. " 6340 return Api::NewError("Isolate is not precompiled. "
6335 "Did you forget to call Dart_Precompile?"); 6341 "Did you forget to call Dart_Precompile?");
6336 } 6342 }
6337 ASSERT(FLAG_load_deferred_eagerly); 6343 ASSERT(FLAG_load_deferred_eagerly);
6338 if (vm_isolate_snapshot_buffer == NULL) { 6344 if (vm_isolate_snapshot_buffer == NULL) {
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
6420 uint8_t** vm_isolate_snapshot_buffer, 6426 uint8_t** vm_isolate_snapshot_buffer,
6421 intptr_t* vm_isolate_snapshot_size, 6427 intptr_t* vm_isolate_snapshot_size,
6422 uint8_t** isolate_snapshot_buffer, 6428 uint8_t** isolate_snapshot_buffer,
6423 intptr_t* isolate_snapshot_size, 6429 intptr_t* isolate_snapshot_size,
6424 uint8_t** instructions_blob_buffer, 6430 uint8_t** instructions_blob_buffer,
6425 intptr_t* instructions_blob_size, 6431 intptr_t* instructions_blob_size,
6426 uint8_t** rodata_blob_buffer, 6432 uint8_t** rodata_blob_buffer,
6427 intptr_t* rodata_blob_size) { 6433 intptr_t* rodata_blob_size) {
6428 #if defined(TARGET_ARCH_IA32) 6434 #if defined(TARGET_ARCH_IA32)
6429 return Api::NewError("Snapshots with code are not supported on IA32."); 6435 return Api::NewError("Snapshots with code are not supported on IA32.");
6436 #elif defined(TARGET_ARCH_DBC)
6437 return Api::NewError("Snapshots with code are not supported on DBC.");
6430 #else 6438 #else
6431 API_TIMELINE_DURATION; 6439 API_TIMELINE_DURATION;
6432 DARTSCOPE(Thread::Current()); 6440 DARTSCOPE(Thread::Current());
6433 Isolate* I = T->isolate(); 6441 Isolate* I = T->isolate();
6434 if (!FLAG_load_deferred_eagerly) { 6442 if (!FLAG_load_deferred_eagerly) {
6435 return Api::NewError( 6443 return Api::NewError(
6436 "Creating full snapshots requires --load_deferred_eagerly"); 6444 "Creating full snapshots requires --load_deferred_eagerly");
6437 } 6445 }
6438 if (vm_isolate_snapshot_buffer == NULL) { 6446 if (vm_isolate_snapshot_buffer == NULL) {
6439 RETURN_NULL_ERROR(vm_isolate_snapshot_buffer); 6447 RETURN_NULL_ERROR(vm_isolate_snapshot_buffer);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
6495 6503
6496 DART_EXPORT bool Dart_IsPrecompiledRuntime() { 6504 DART_EXPORT bool Dart_IsPrecompiledRuntime() {
6497 #if defined(DART_PRECOMPILED_RUNTIME) 6505 #if defined(DART_PRECOMPILED_RUNTIME)
6498 return true; 6506 return true;
6499 #else 6507 #else
6500 return false; 6508 return false;
6501 #endif 6509 #endif
6502 } 6510 }
6503 6511
6504 } // namespace dart 6512 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/intermediate_language_dbc.cc » ('j') | runtime/vm/intermediate_language_dbc.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698