| OLD | NEW |
| 1 #!/bin/bash | 1 #!/bin/bash |
| 2 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 2 # Copyright (c) 2012, 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 function follow_links() { | 6 function follow_links() { |
| 7 while [ -h "$1" ]; do | 7 while [ -h "$1" ]; do |
| 8 # On Mac OS, readlink -f doesn't work. | 8 # On Mac OS, readlink -f doesn't work. |
| 9 1="$(readlink "$1")" | 9 1="$(readlink "$1")" |
| 10 done | 10 done |
| 11 echo "$1" | 11 echo "$1" |
| 12 } | 12 } |
| 13 | 13 |
| 14 # Unlike $0, $BASH_SOURCE points to the absolute path of this file. | 14 # Unlike $0, $BASH_SOURCE points to the absolute path of this file. |
| 15 PROG_NAME="$(follow_links "$BASH_SOURCE")" | 15 PROG_NAME="$(follow_links "$BASH_SOURCE")" |
| 16 | 16 |
| 17 # Handle the case where dart-sdk/bin has been symlinked to. | 17 # Handle the case where dart-sdk/bin has been symlinked to. |
| 18 BIN_DIR="$(follow_links "$(cd "${PROG_NAME%/*}" ; pwd -P)")" | 18 BIN_DIR="$(follow_links "$(cd "${PROG_NAME%/*}" ; pwd -P)")" |
| 19 | 19 |
| 20 SDK_DIR="$(cd "${BIN_DIR}/.." ; pwd -P)" | 20 SDK_DIR="$(cd "${BIN_DIR}/.." ; pwd -P)" |
| 21 | 21 |
| 22 DART2JS="$SDK_DIR/lib/_internal/compiler/implementation/dart2js.dart" | 22 DART2JS="$SDK_DIR/lib/_internal/compiler/implementation/dart2js.dart" |
| 23 |
| 23 DART="$BIN_DIR/dart" | 24 DART="$BIN_DIR/dart" |
| 24 | 25 |
| 26 SNAPSHOT="${DART2JS}.snapshot" |
| 27 |
| 25 unset EXTRA_OPTIONS | 28 unset EXTRA_OPTIONS |
| 26 declare -a EXTRA_OPTIONS | 29 declare -a EXTRA_OPTIONS |
| 27 | 30 |
| 28 if test -t 1; then | 31 if test -t 1; then |
| 29 # Stdout is a terminal. | 32 # Stdout is a terminal. |
| 30 if test 8 -le `tput colors`; then | 33 if test 8 -le `tput colors`; then |
| 31 # Stdout has at least 8 colors, so enable colors. | 34 # Stdout has at least 8 colors, so enable colors. |
| 32 EXTRA_OPTIONS[${#EXTRA_OPTIONS[@]}]='--enable-diagnostic-colors' | 35 EXTRA_OPTIONS[${#EXTRA_OPTIONS[@]}]='--enable-diagnostic-colors' |
| 33 fi | 36 fi |
| 34 fi | 37 fi |
| 35 | 38 |
| 36 unset EXTRA_VM_OPTIONS | 39 unset EXTRA_VM_OPTIONS |
| 37 declare -a EXTRA_VM_OPTIONS | 40 declare -a EXTRA_VM_OPTIONS |
| 38 | 41 |
| 39 SNAPSHOT="$SDK_DIR/_internal/compiler/implementation/dart2js.dart.snapshot" | |
| 40 if test -f "$SNAPSHOT"; then | 42 if test -f "$SNAPSHOT"; then |
| 41 # TODO(ahe): Remove the following line when we are relatively sure it works. | 43 # TODO(ahe): Remove the following line when we are relatively sure it works. |
| 42 echo Using snapshot "$SNAPSHOT" 1>&2 | 44 echo Using snapshot "$SNAPSHOT" 1>&2 |
| 43 EXTRA_VM_OPTIONS[${#EXTRA_VM_OPTIONS[@]}]="--use_script_snapshot=$SNAPSHOT" | 45 EXTRA_VM_OPTIONS[${#EXTRA_VM_OPTIONS[@]}]="--use_script_snapshot=$SNAPSHOT" |
| 44 fi | 46 fi |
| 45 | 47 |
| 46 # Tell the VM to grow the heap more aggressively. This should only | 48 # Tell the VM to grow the heap more aggressively. This should only |
| 47 # be necessary temporarily until the VM is better at detecting how | 49 # be necessary temporarily until the VM is better at detecting how |
| 48 # applications use memory. | 50 # applications use memory. |
| 49 # TODO(ahe): Remove this option (http://dartbug.com/6495). | 51 # TODO(ahe): Remove this option (http://dartbug.com/6495). |
| 50 EXTRA_VM_OPTIONS[${#EXTRA_VM_OPTIONS[@]}]='--heap_growth_rate=512' | 52 EXTRA_VM_OPTIONS[${#EXTRA_VM_OPTIONS[@]}]='--heap_growth_rate=512' |
| 51 | 53 |
| 52 # Tell the VM to don't bother inlining methods. So far inlining isn't | 54 # Tell the VM to don't bother inlining methods. So far inlining isn't |
| 53 # paying off but the VM team is working on fixing that. | 55 # paying off but the VM team is working on fixing that. |
| 54 # TODO(ahe): Remove this option (http://dartbug.com/6495). | 56 # TODO(ahe): Remove this option (http://dartbug.com/6495). |
| 55 EXTRA_VM_OPTIONS[${#EXTRA_VM_OPTIONS[@]}]='--no_use_inlining' | 57 EXTRA_VM_OPTIONS[${#EXTRA_VM_OPTIONS[@]}]='--no_use_inlining' |
| 56 | 58 |
| 57 case $0 in | 59 case $0 in |
| 58 *_developer) | 60 *_developer) |
| 59 EXTRA_VM_OPTIONS[${#EXTRA_VM_OPTIONS[@]}]='--checked' | 61 EXTRA_VM_OPTIONS[${#EXTRA_VM_OPTIONS[@]}]='--checked' |
| 60 ;; | 62 ;; |
| 61 esac | 63 esac |
| 62 | 64 |
| 63 exec "$DART" "${EXTRA_VM_OPTIONS[@]}" "$DART2JS" "${EXTRA_OPTIONS[@]}" "$@" | 65 exec "$DART" "${EXTRA_VM_OPTIONS[@]}" "$DART2JS" "${EXTRA_OPTIONS[@]}" "$@" |
| OLD | NEW |