Chromium Code Reviews| Index: dart/sdk/bin/dart2js |
| diff --git a/dart/sdk/bin/dart2js b/dart/sdk/bin/dart2js |
| index dfa5228d0a399e9cb19f409570a0dc9a5909cf63..ff9f5605aafe8779be8d7eb373065d9aef6bafa5 100755 |
| --- a/dart/sdk/bin/dart2js |
| +++ b/dart/sdk/bin/dart2js |
| @@ -3,24 +3,63 @@ |
| # for details. All rights reserved. Use of this source code is governed by a |
| # BSD-style license that can be found in the LICENSE file. |
| -# Setting BIN_DIR this way is ugly, but is needed to handle the case where |
| -# dart-sdk/bin has been symlinked to. On MacOS, readlink doesn't work |
| -# with this case. |
| -BIN_DIR="$(cd "${0%/*}" ; pwd -P)" |
| +# Unlike $0, $BASH_SOURCE points to the absolute path of this file. |
| +PROG_NAME="$BASH_SOURCE" |
| + |
| +# Handle the case where dart-sdk/bin/dart2js has been symlinked to. |
| +while [ -h "${PROG_NAME}" ]; do |
| + # On Mac OS, readlink -f doesn't work. |
| + PROG_NAME="$(readlink "${PROG_NAME}")" |
| +done |
| + |
| +# Handle the case where dart-sdk/bin has been symlinked to. |
| +BIN_DIR="$(cd "${PROG_NAME%/*}" ; pwd -P)" |
| +while [ -h "${BIN_DIR}" ]; do |
| + # On Mac OS, readlink -f doesn't work. |
| + BIN_DIR="$(readlink "${BIN_DIR}")" |
| +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.
|
| + |
| +SDK_DIR="$(cd "${BIN_DIR}/.." ; pwd -P)" |
| + |
| +DART2JS="$SDK_DIR/lib/_internal/compiler/implementation/dart2js.dart" |
| +DART="$BIN_DIR/dart" |
| + |
| +unset EXTRA_OPTIONS |
| +declare -a EXTRA_OPTIONS |
| -unset COLORS |
| if test -t 1; then |
| # Stdout is a terminal. |
| if test 8 -le `tput colors`; then |
| # Stdout has at least 8 colors, so enable colors. |
| - COLORS="--enable-diagnostic-colors" |
| + EXTRA_OPTIONS[${#EXTRA_OPTIONS[@]}]='--enable-diagnostic-colors' |
| fi |
| fi |
| -unset SNAPSHOT |
| -if test -f "$BIN_DIR/../lib/_internal/compiler/implementation/dart2js.dart.snapshot"; then |
| +unset EXTRA_VM_OPTIONS |
| +declare -a EXTRA_VM_OPTIONS |
| + |
| +SNAPSHOT="$SDK_DIR/_internal/compiler/implementation/dart2js.dart.snapshot" |
| +if test -f "$SNAPSHOT"; then |
| # TODO(ahe): Remove the following line when we are relatively sure it works. |
| - echo Using snapshot "$BIN_DIR/../lib/_internal/compiler/implementation/dart2js.dart.snapshot" 1>&2 |
| - SNAPSHOT="--use_script_snapshot=$BIN_DIR/../lib/_internal/compiler/implementation/dart2js.dart.snapshot" |
| + echo Using snapshot "$SNAPSHOT" 1>&2 |
| + EXTRA_VM_OPTIONS[${#EXTRA_VM_OPTIONS[@]}]="--use_script_snapshot=$SNAPSHOT" |
| fi |
| -exec "$BIN_DIR"/dart --no_use_inlining --heap_growth_rate=32 $SNAPSHOT "$BIN_DIR/../lib/_internal/compiler/implementation/dart2js.dart" $COLORS "$@" |
| + |
| +# Tell the VM to grow the heap more aggressively. This should only |
| +# be necessary temporarily until the VM is better at detecting how |
| +# applications use memory. |
| +# TODO(ahe): Remove this option (http://dartbug.com/6495). |
| +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
|
| + |
| +# 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.
|
| +# paying off but the VM team is working on fixing that. |
| +# TODO(ahe): Remove this option (http://dartbug.com/6495). |
| +EXTRA_VM_OPTIONS[${#EXTRA_VM_OPTIONS[@]}]='--no_use_inlining' |
| + |
| +case $0 in |
| + *_developer) |
| + EXTRA_VM_OPTIONS[${#EXTRA_VM_OPTIONS[@]}]='--checked' |
| + ;; |
| +esac |
| + |
| +exec "$DART" "${EXTRA_VM_OPTIONS[@]}" "$DART2JS" "${EXTRA_OPTIONS[@]}" "$@" |