Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/bin/bash | 1 #!/bin/bash |
| 2 # Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 2 # Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 3 # for details. All rights reserved. Use of this source code is governed by a | 3 # for details. All rights reserved. Use of this source code is governed by a |
| 4 # BSD-style license that can be found in the LICENSE file. | 4 # BSD-style license that can be found in the LICENSE file. |
| 5 | 5 |
| 6 # Run dartanalyzer.dart on the Dart VM. This script assumes the Dart SDK's | 6 # Run dartanalyzer.dart on the Dart VM. This script assumes the Dart SDK's |
| 7 # directory structure. | 7 # directory structure. |
| 8 | 8 |
| 9 function follow_links() { | 9 function follow_links() { |
| 10 file="$1" | 10 file="$1" |
| 11 while [ -h "$file" ]; do | 11 while [ -h "$file" ]; do |
| 12 # On Mac OS, readlink -f doesn't work. | 12 # On Mac OS, readlink -f doesn't work. |
| 13 file="$(readlink "$file")" | 13 file="$(readlink "$file")" |
| 14 done | 14 done |
| 15 echo "$file" | 15 echo "$file" |
| 16 } | 16 } |
| 17 | 17 |
| 18 # Unlike $0, $BASH_SOURCE points to the absolute path of this file. | 18 # Unlike $0, $BASH_SOURCE points to the absolute path of this file. |
| 19 PROG_NAME="$(follow_links "$BASH_SOURCE")" | 19 PROG_NAME="$(follow_links "$BASH_SOURCE")" |
| 20 | 20 |
| 21 # Handle the case where dart-sdk/bin has been symlinked to. | 21 # Handle the case where dart-sdk/bin has been symlinked to. |
| 22 BIN_DIR="$(cd "${PROG_NAME%/*}" ; pwd -P)" | 22 BIN_DIR="$(cd "${PROG_NAME%/*}" ; pwd -P)" |
| 23 SDK_DIR="$(cd "${BIN_DIR}/.." ; pwd -P)" | 23 SDK_DIR="$(cd "${BIN_DIR}/.." ; pwd -P)" |
| 24 | 24 |
| 25 SDK_ARG="--dart-sdk=$SDK_DIR" | 25 SDK_ARG="--dart-sdk=$SDK_DIR" |
| 26 | 26 |
| 27 DART="$BIN_DIR/dart" | |
| 28 | |
| 27 SNAPSHOT="$BIN_DIR/snapshots/dartanalyzer.dart.snapshot" | 29 SNAPSHOT="$BIN_DIR/snapshots/dartanalyzer.dart.snapshot" |
| 28 | 30 |
| 29 # We are running the snapshot in the built SDK. | 31 unset EXTRA_VM_OPTIONS |
| 30 DART="$BIN_DIR/dart" | 32 declare -a EXTRA_VM_OPTIONS |
| 31 exec "$DART" "$SNAPSHOT" "$SDK_ARG" "$@" | 33 |
| 34 # Set some optimization options that speed up analysis. | |
| 35 # TODO(paulberry): are these needed? Could the VM be improved so that | |
| 36 # they are unnecessary? | |
| 37 EXTRA_VM_OPTIONS+=("--heap_growth_rate=512") | |
|
Ivan Posva
2014/10/08 04:52:31
Please do not use any of these flags unless you kn
| |
| 38 EXTRA_VM_OPTIONS+=("--inlining_hotness=90") | |
| 39 EXTRA_VM_OPTIONS+=("--optimization_counter_threshold=5000") | |
| 40 | |
| 41 case $0 in | |
| 42 *_developer) | |
| 43 EXTRA_VM_OPTIONS+=('--checked') | |
| 44 ;; | |
| 45 esac | |
| 46 | |
| 47 # We allow extra vm options to be passed in through an environment variable. | |
| 48 if [[ $DART_VM_OPTIONS ]]; then | |
| 49 read -a OPTIONS <<< "$DART_VM_OPTIONS" | |
| 50 EXTRA_VM_OPTIONS+=("${OPTIONS[@]}") | |
| 51 fi | |
| 52 | |
| 53 if test -f "$SNAPSHOT"; then | |
| 54 exec "$DART" "${EXTRA_VM_OPTIONS[@]}" "$SNAPSHOT" "$SDK_ARG" "$@" | |
| 55 else | |
| 56 DART_ROOT="$(cd "${SDK_DIR}/.." ; pwd -P)" | |
| 57 | |
| 58 ANALYZER="$DART_ROOT/pkg/analyzer/bin/analyzer.dart" | |
| 59 | |
| 60 if [ -z "$DART_CONFIGURATION" ]; | |
| 61 then | |
| 62 DART_CONFIGURATION="ReleaseIA32" | |
| 63 fi | |
| 64 | |
| 65 if [[ `uname` == 'Darwin' ]]; then | |
| 66 BUILD_DIR="$DART_ROOT/xcodebuild/$DART_CONFIGURATION" | |
| 67 else | |
| 68 BUILD_DIR="$DART_ROOT/out/$DART_CONFIGURATION" | |
| 69 fi | |
| 70 | |
| 71 PACKAGE_ROOT="$BUILD_DIR/packages/" | |
| 72 | |
| 73 exec "$DART" "${EXTRA_VM_OPTIONS[@]}" "--package-root=$PACKAGE_ROOT" "$ANALYZE R" "$SDK_ARG" "$@" | |
| 74 fi | |
| OLD | NEW |