From b407fc48cab419ba3966844652cbe4e44288f7a1 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Thu, 3 Mar 2016 12:00:24 -0800 Subject: [PATCH] Dont include any of the machinery to generate a precompilation snapshot on the embedder VM --- sky/build/SnapshotterInvoke | 2 +- sky/engine/core/script/dart_init.cc | 27 +++++++++++++++++++-------- sky/shell/BUILD.gn | 9 +++++++-- 3 files changed, 27 insertions(+), 11 deletions(-) diff --git a/sky/build/SnapshotterInvoke b/sky/build/SnapshotterInvoke index 0909015d6df..35f174ade92 100755 --- a/sky/build/SnapshotterInvoke +++ b/sky/build/SnapshotterInvoke @@ -126,7 +126,7 @@ SnapshotProject() { # Note about "checked mode": Precompilation snapshots are never in checked # mode. The flag is also ignored by the standalone VM. So there is no sense # in generating the larger snapshot. For development purposes, a - # non-precompilation enabled VM is used. + # non-precompilation-enabled VM is used. RunCommand ${FLUTTER_ARCH_TOOLS_PATH}/Snapshotter \ --vm_isolate_snapshot=${derived_dir}/kDartVmIsolateSnapshotBuffer \ --isolate_snapshot=${derived_dir}/kDartIsolateSnapshotBuffer \ diff --git a/sky/engine/core/script/dart_init.cc b/sky/engine/core/script/dart_init.cc index dceac3bbd12..a4818ec98e2 100644 --- a/sky/engine/core/script/dart_init.cc +++ b/sky/engine/core/script/dart_init.cc @@ -66,10 +66,11 @@ Dart_Handle DartLibraryTagHandler(Dart_LibraryTag tag, namespace { -static const char* kDartArgs[] = { - "--enable_mirrors=false", +static const char* kDartProfilingArgs[] = { + // Dart assumes ARM devices are insufficiently powerful and sets the + // default profile period to 100Hz. This number is suitable for older + // Raspberry Pi devices but quite low for current smartphones. "--profile_period=1000", - "--background_compilation", #if (WTF_OS_IOS || WTF_OS_MACOSX) // On platforms where LLDB is the primary debugger, SIGPROF signals // overwhelm LLDB. @@ -77,8 +78,12 @@ static const char* kDartArgs[] = { #endif }; -static const char* kDartPrecompilationArgs[]{ - "--precompilation", +static const char *kDartMirrorsArgs[] = { + "--enable_mirrors=false", +}; + +static const char* kDartBackgroundCompilationArgs[] = { + "--background_compilation", }; static const char* kDartCheckedModeArgs[] = { @@ -318,10 +323,16 @@ void InitDartVM() { } Vector args; - args.append(kDartArgs, arraysize(kDartArgs)); + args.append(kDartProfilingArgs, arraysize(kDartProfilingArgs)); - if (IsRunningPrecompiledCode()) - args.append(kDartPrecompilationArgs, arraysize(kDartPrecompilationArgs)); + if (!IsRunningPrecompiledCode()) { + // The version of the VM setup to run precompiled code does not recognize + // the mirrors or the background compilation flags. They are never enabled. + // Make sure we dont pass in unrecognized flags. + args.append(kDartMirrorsArgs, arraysize(kDartMirrorsArgs)); + args.append(kDartBackgroundCompilationArgs, + arraysize(kDartBackgroundCompilationArgs)); + } if (enable_checked_mode) args.append(kDartCheckedModeArgs, arraysize(kDartCheckedModeArgs)); diff --git a/sky/shell/BUILD.gn b/sky/shell/BUILD.gn index a558b408437..0dfc170a4d9 100644 --- a/sky/shell/BUILD.gn +++ b/sky/shell/BUILD.gn @@ -30,11 +30,16 @@ source_set("common") { "ui_delegate.h", ] - public_deps = [ + if (is_ios && !use_ios_simulator) { + dart_deps = [ "//dart/runtime:libdart_precompiled_runtime" ] + } else { + dart_deps = [ "//dart/runtime:libdart" ] + } + + public_deps = dart_deps + [ "//base", "//base:i18n", "//build/config/sanitizers:deps", - "//dart/runtime:libdart", "//flow", "//mojo/common", "//mojo/data_pipe_utils",