[scanner] Replace KeywordState

As bechmarked with the AOT compiles of `scanner_benchmark.dart`
called with
`pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart --bytes`:

```
    N           Min           Max        Median           Avg        Stddev
x  25     138.56434     144.23326     142.64174     142.51626     1.2207074
+  25     148.45681     157.02163     156.44878     155.88958     1.7051997
Difference at 95.0% confidence
        13.3733 +/- 0.843454
        9.38372% +/- 0.59183%
        (Student's t, pooled s = 1.48287)
```

And compiling the CFE from December with the CFE, statistics on 25 runs
each, run with `--cache --silent` (so 2 x 50 runs each) (in AOT mode):

```
msec task-clock:u: -0.9684% +/- 0.3536% (-58.65 +/- 21.42)
page-faults:u: -0.1051% +/- 0.0818% (-125.36 +/- 97.49)
cycles:u: -1.0001% +/- 0.3225% (-252905081.28 +/- 81554799.59)
instructions:u: -0.5915% +/- 0.0007% (-181426590.44 +/- 209346.28)
seconds time elapsed: -0.9657% +/- 0.3525% (-0.06 +/- 0.02)
seconds user: -1.1336% +/- 0.4333% (-0.07 +/- 0.03)

msec task-clock:u: -1.3115% +/- 0.3364% (-79.48 +/- 20.39)
page-faults:u: -0.1900% +/- 0.0774% (-226.72 +/- 92.37)
L1-icache-load-misses: 0.4990% +/- 0.2072% (2422435.64 +/- 1006075.94)
LLC-loads: -2.3896% +/- 0.1707% (-1179245.64 +/- 84228.28)
LLC-load-misses: -1.9244% +/- 0.2041% (-639169.84 +/- 67791.64)
seconds time elapsed: -1.3128% +/- 0.3374% (-0.08 +/- 0.02)
seconds user: -1.3311% +/- 0.4183% (-0.08 +/- 0.02)
```

Combined the 3 CLs ending here gives this result when compiling
the CFE from December with the CFE, statistics on 25 runs each,
run with `--cache --silent` (so 2 x 50 runs each) (in AOT mode):

```
msec task-clock:u: -1.7681% +/- 0.3034% (-106.37 +/- 18.25)
page-faults:u: -0.1834% +/- 0.0863% (-218.80 +/- 103.00)
cycles:u: -1.8163% +/- 0.2668% (-456090610.64 +/- 66985831.74)
instructions:u: -1.1851% +/- 0.0007% (-365653999.24 +/- 220539.29)
branch-misses:u: -2.8468% +/- 1.0580% (-2611811.72 +/- 970666.69)
seconds time elapsed: -1.7687% +/- 0.3026% (-0.11 +/- 0.02)
seconds user: -1.9723% +/- 0.4480% (-0.11 +/- 0.03)

msec task-clock:u: -1.7787% +/- 0.3042% (-107.07 +/- 18.31)
page-faults:u: -0.2413% +/- 0.1050% (-288.12 +/- 125.39)
L1-icache-load-misses: 0.5218% +/- 0.1599% (2523027.12 +/- 773363.93)
LLC-loads: -2.2917% +/- 0.1613% (-1125147.16 +/- 79181.20)
LLC-load-misses: -2.0256% +/- 0.2667% (-670484.64 +/- 88293.18)
seconds time elapsed: -1.7793% +/- 0.3036% (-0.11 +/- 0.02)
seconds user: -1.7392% +/- 0.3752% (-0.10 +/- 0.02)
```

And for the scanner benchmark, in AOT mode, called with
`pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart --bytes` for bytes per microsecond:

```
    N           Min           Max        Median           Avg        Stddev
x  25     114.87867     117.70322     117.10106        116.85    0.67188864
+  25       153.512     156.99315     156.38671     155.95981    0.98376554
Difference at 95.0% confidence
        39.1098 +/- 0.479146
        33.4701% +/- 0.410053%
        (Student's t, pooled s = 0.842386)
```

Change-Id: Ica6d47d92ab0fb4c3a06aa6686b8c71f52a6aef8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/407480
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
4 files changed
tree: bf53fec04bd7ceb1aa939ee3fdb37fce90e4b832
  1. .dart_tool/
  2. .github/
  3. benchmarks/
  4. build/
  5. docs/
  6. pkg/
  7. runtime/
  8. samples/
  9. sdk/
  10. tests/
  11. third_party/
  12. tools/
  13. utils/
  14. .clang-format
  15. .gitattributes
  16. .gitconfig
  17. .gitignore
  18. .gn
  19. .mailmap
  20. .style.yapf
  21. AUTHORS
  22. BUILD.gn
  23. CHANGELOG.md
  24. codereview.settings
  25. CONTRIBUTING.md
  26. DEPS
  27. LICENSE
  28. OWNERS
  29. PATENT_GRANT
  30. PRESUBMIT.py
  31. README.dart-sdk
  32. README.md
  33. sdk.code-workspace
  34. sdk_args.gni
  35. sdk_packages.yaml
  36. SECURITY.md
  37. WATCHLISTS
README.md

Dart

An approachable, portable, and productive language for high-quality apps on any platform

Dart is:

  • Approachable: Develop with a strongly typed programming language that is consistent, concise, and offers modern language features like null safety and patterns.

  • Portable: Compile to ARM, x64, or RISC-V machine code for mobile, desktop, and backend. Compile to JavaScript or WebAssembly for the web.

  • Productive: Make changes iteratively: use hot reload to see the result instantly in your running app. Diagnose app issues using DevTools.

Dart's flexible compiler technology lets you run Dart code in different ways, depending on your target platform and goals:

  • Dart Native: For programs targeting devices (mobile, desktop, server, and more), Dart Native includes both a Dart VM with JIT (just-in-time) compilation and an AOT (ahead-of-time) compiler for producing machine code.

  • Dart Web: For programs targeting the web, Dart Web includes both a development time compiler (dartdevc) and a production time compiler (dart2js).

Dart platforms illustration

License & patents

Dart is free and open source.

See LICENSE and PATENT_GRANT.

Using Dart

Visit dart.dev to learn more about the language, tools, and to find codelabs.

Browse pub.dev for more packages and libraries contributed by the community and the Dart team.

Our API reference documentation is published at api.dart.dev, based on the stable release. (We also publish docs from our beta and dev channels, as well as from the primary development branch).

Building Dart

If you want to build Dart yourself, here is a guide to getting the source, preparing your machine to build the SDK, and building.

There are more documents in our repo at docs.

Contributing to Dart

The easiest way to contribute to Dart is to file issues.

You can also contribute patches, as described in Contributing.

Roadmap

Future plans for Dart are included in the combined Dart and Flutter roadmap on the Flutter wiki.