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

Unified Diff: runtime/vm/dart_api_impl.cc

Issue 1407393005: Get tools/test.py --noopt green. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/tests/vm/vm.status ('k') | runtime/vm/flow_graph_compiler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/dart_api_impl.cc
diff --git a/runtime/vm/dart_api_impl.cc b/runtime/vm/dart_api_impl.cc
index 85ea50999155c8a81f5db89c49814ea0fa981711..cd5c085a4c068cb9b788b8f6ab3a996dd9063624 100644
--- a/runtime/vm/dart_api_impl.cc
+++ b/runtime/vm/dart_api_impl.cc
@@ -52,6 +52,7 @@ namespace dart {
DECLARE_FLAG(bool, load_deferred_eagerly);
+DECLARE_FLAG(bool, precompilation);
DECLARE_FLAG(bool, print_class_table);
DECLARE_FLAG(bool, verify_handles);
#if defined(DART_NO_SNAPSHOT)
@@ -1280,6 +1281,9 @@ DART_EXPORT char* Dart_Initialize(
Dart_FileWriteCallback file_write,
Dart_FileCloseCallback file_close,
Dart_EntropySource entropy_source) {
+ if ((instructions_snapshot != NULL) && !FLAG_precompilation) {
+ return strdup("Flag --precompilation was not specified.");
+ }
const char* err_msg = Dart::InitOnce(vm_isolate_snapshot,
instructions_snapshot,
create, interrupt, unhandled, shutdown,
@@ -3780,6 +3784,11 @@ DART_EXPORT Dart_Handle Dart_New(Dart_Handle type,
CURRENT_FUNC);
}
Class& cls = Class::Handle(Z, type_obj.type_class());
+#if defined(DEBUG)
+ if (!cls.is_allocated() && Dart::IsRunningPrecompiledCode()) {
+ return Api::NewError("Precompilation dropped '%s'", cls.ToCString());
+ }
+#endif
TypeArguments& type_arguments =
TypeArguments::Handle(Z, type_obj.arguments());
@@ -3930,6 +3939,11 @@ DART_EXPORT Dart_Handle Dart_Allocate(Dart_Handle type) {
RETURN_TYPE_ERROR(Z, type, Type);
}
const Class& cls = Class::Handle(Z, type_obj.type_class());
+#if defined(DEBUG)
+ if (!cls.is_allocated() && Dart::IsRunningPrecompiledCode()) {
+ return Api::NewError("Precompilation dropped '%s'", cls.ToCString());
+ }
+#endif
const Error& error = Error::Handle(Z, cls.EnsureIsFinalized(T));
if (!error.IsNull()) {
// An error occurred, return error object.
@@ -3955,6 +3969,11 @@ DART_EXPORT Dart_Handle Dart_AllocateWithNativeFields(
RETURN_NULL_ERROR(native_fields);
}
const Class& cls = Class::Handle(Z, type_obj.type_class());
+#if defined(DEBUG)
+ if (!cls.is_allocated() && Dart::IsRunningPrecompiledCode()) {
+ return Api::NewError("Precompilation dropped '%s'", cls.ToCString());
+ }
+#endif
const Error& error = Error::Handle(Z, cls.EnsureIsFinalized(T));
if (!error.IsNull()) {
// An error occurred, return error object.
@@ -5991,6 +6010,9 @@ DART_EXPORT Dart_Handle Dart_Precompile(
Dart_QualifiedFunctionName entry_points[],
bool reset_fields) {
DARTSCOPE(Thread::Current());
+ if (!FLAG_precompilation) {
+ return Dart_NewApiError("Flag --precompilation was not specified.");
+ }
Dart_Handle result = Api::CheckAndFinalizePendingClasses(I);
if (::Dart_IsError(result)) {
return result;
@@ -6014,6 +6036,10 @@ DART_EXPORT Dart_Handle Dart_CreatePrecompiledSnapshot(
intptr_t* instructions_snapshot_size) {
ASSERT(FLAG_load_deferred_eagerly);
DARTSCOPE(Thread::Current());
+ if (I->compilation_allowed()) {
+ return Dart_NewApiError("Isolate is not precompiled. "
+ "Did you forget to call Dart_Precompile?");
+ }
if (vm_isolate_snapshot_buffer == NULL) {
RETURN_NULL_ERROR(vm_isolate_snapshot_buffer);
}
« no previous file with comments | « runtime/tests/vm/vm.status ('k') | runtime/vm/flow_graph_compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698