Chromium Code Reviews| 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 # Setting BIN_DIR this way is ugly, but is needed to handle the case where | 6 # Unlike $0, $BASH_SOURCE points to the absolute path of this file. |
| 7 # dart-sdk/bin has been symlinked to. On MacOS, readlink doesn't work | 7 PROG_NAME="$BASH_SOURCE" |
| 8 # with this case. | |
| 9 BIN_DIR="$(cd "${0%/*}" ; pwd -P)" | |
| 10 | 8 |
| 11 unset COLORS | 9 # Handle the case where dart-sdk/bin/dart2js has been symlinked to. |
| 10 while [ -h "${PROG_NAME}" ]; do | |
| 11 # On Mac OS, readlink -f doesn't work. | |
| 12 PROG_NAME="$(readlink "${PROG_NAME}")" | |
| 13 done | |
| 14 | |
| 15 # Handle the case where dart-sdk/bin has been symlinked to. | |
| 16 BIN_DIR="$(cd "${PROG_NAME%/*}" ; pwd -P)" | |
| 17 while [ -h "${BIN_DIR}" ]; do | |
| 18 # On Mac OS, readlink -f doesn't work. | |
| 19 BIN_DIR="$(readlink "${BIN_DIR}")" | |
| 20 done | |
|
kustermann
2012/11/28 08:53:50
Since you do this procedure two times (following s
ahe
2012/11/28 11:53:25
Done.
| |
| 21 | |
| 22 SDK_DIR="$(cd "${BIN_DIR}/.." ; pwd -P)" | |
| 23 | |
| 24 DART2JS="$SDK_DIR/lib/_internal/compiler/implementation/dart2js.dart" | |
| 25 DART="$BIN_DIR/dart" | |
| 26 | |
| 27 unset EXTRA_OPTIONS | |
| 28 declare -a EXTRA_OPTIONS | |
| 29 | |
| 12 if test -t 1; then | 30 if test -t 1; then |
| 13 # Stdout is a terminal. | 31 # Stdout is a terminal. |
| 14 if test 8 -le `tput colors`; then | 32 if test 8 -le `tput colors`; then |
| 15 # Stdout has at least 8 colors, so enable colors. | 33 # Stdout has at least 8 colors, so enable colors. |
| 16 COLORS="--enable-diagnostic-colors" | 34 EXTRA_OPTIONS[${#EXTRA_OPTIONS[@]}]='--enable-diagnostic-colors' |
| 17 fi | 35 fi |
| 18 fi | 36 fi |
| 19 | 37 |
| 20 unset SNAPSHOT | 38 unset EXTRA_VM_OPTIONS |
| 21 if test -f "$BIN_DIR/../lib/_internal/compiler/implementation/dart2js.dart.snaps hot"; then | 39 declare -a EXTRA_VM_OPTIONS |
| 40 | |
| 41 SNAPSHOT="$SDK_DIR/_internal/compiler/implementation/dart2js.dart.snapshot" | |
| 42 if test -f "$SNAPSHOT"; then | |
| 22 # 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. |
| 23 echo Using snapshot "$BIN_DIR/../lib/_internal/compiler/implementation/dart2js .dart.snapshot" 1>&2 | 44 echo Using snapshot "$SNAPSHOT" 1>&2 |
| 24 SNAPSHOT="--use_script_snapshot=$BIN_DIR/../lib/_internal/compiler/implementat ion/dart2js.dart.snapshot" | 45 EXTRA_VM_OPTIONS[${#EXTRA_VM_OPTIONS[@]}]="--use_script_snapshot=$SNAPSHOT" |
| 25 fi | 46 fi |
| 26 exec "$BIN_DIR"/dart --no_use_inlining --heap_growth_rate=32 $SNAPSHOT "$BIN_DIR /../lib/_internal/compiler/implementation/dart2js.dart" $COLORS "$@" | 47 |
| 48 # Tell the VM to grow the heap more aggressively. This should only | |
| 49 # be necessary temporarily until the VM is better at detecting how | |
| 50 # applications use memory. | |
| 51 # TODO(ahe): Remove this option (http://dartbug.com/6495). | |
| 52 EXTRA_VM_OPTIONS[${#EXTRA_VM_OPTIONS[@]}]='--heap_growth_rate=512' | |
|
ricow1
2012/11/27 18:28:35
This seems almost insane - I think the default max
ahe
2012/11/28 11:53:25
The flag is documented as:
heap_growth_rate: 4 (T
| |
| 53 | |
| 54 # Tell the VM to don't bother inlining methods. So far it isn't | |
|
ricow1
2012/11/27 18:28:35
The comment could be misunderstood as saying that
ahe
2012/11/28 11:53:25
Done.
| |
| 55 # paying off but the VM team is working on fixing that. | |
| 56 # TODO(ahe): Remove this option (http://dartbug.com/6495). | |
| 57 EXTRA_VM_OPTIONS[${#EXTRA_VM_OPTIONS[@]}]='--no_use_inlining' | |
| 58 | |
| 59 case $0 in | |
| 60 *_developer) | |
| 61 EXTRA_VM_OPTIONS[${#EXTRA_VM_OPTIONS[@]}]='--checked' | |
| 62 ;; | |
| 63 esac | |
| 64 | |
| 65 exec "$DART" "${EXTRA_VM_OPTIONS[@]}" "$DART2JS" "${EXTRA_OPTIONS[@]}" "$@" | |
| OLD | NEW |