Skip to content

Commit e402732

Browse files
sigmundchcommit-bot@chromium.org
authored andcommitted
Improve documentation of the -O flag
TBR=sra@google.com,vsm@google.com Change-Id: Ib42647ab59313bdfa49df73c25282d0d734d6462 Reviewed-on: https://dart-review.googlesource.com/68140 Reviewed-by: Sigmund Cherem <sigmund@google.com> Commit-Queue: Sigmund Cherem <sigmund@google.com>
1 parent b04def9 commit e402732

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

pkg/compiler/lib/src/dart2js.dart

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -706,7 +706,9 @@ Supported options:
706706
707707
-O3
708708
Enables optimizations that respect the language semantics only on
709-
programs that don't ever throw any subtype of `Error`. To use this
709+
programs that don't ever throw any subtype of `Error`. These
710+
optimizations improve the generated code, but they may cause programs to
711+
behave unexpectedly if this assumption is not met. To use this
710712
option, we recommend that you properly test your application first
711713
without it, and ensure that no subtype of `Error` (such as `TypeError`)
712714
is ever thrown.
@@ -725,10 +727,12 @@ Supported options:
725727
-O3
726728
--trust-primitives
727729
728-
In the future, new safe optimizations may be added on any level, and
729-
optimizations that only work on some programs may move up from one level to
730-
the next (for instance, we may move `omit-implicit-checks` to the O3 level
731-
in the future).
730+
While some of the individual optimizations and flags may change with time,
731+
we intend to keep the -O* flags stable. New safe optimizations may be added
732+
on any level, and optimizations that only work on some programs may move up
733+
from one level to the next (for instance, once alternative safe
734+
optimizations are implemented, `omit-implicit-checks` may be removed of may
735+
move to the O4 level).
732736
733737
The following individual options are included in some of the -O optimization
734738
levels above. They help reduce the size of the generated code, but they may

0 commit comments

Comments
 (0)