ac6588ba60
dartifyRaw type-checks are currently a bunch of if cases where the check is done in JS. Instead of going back and forth between runtimes, we can do the checks in JS and return an enum value. - Replaces the if cases with a externRefType method that returns an integer that maps to some static const values. Dart enums are slower so consts are preferred. Speeds up type-checks by 4-5x and dartifyRaw by 1.1-1.8x for common types using some quick local benchmarks. Also moves the array check up as it's more common and groups the typed array checks together. - Reuses the externRefType helper in dartify so we don't type-check the same value twice. - Moves some tests from basic_test.dart to jsify_dartify_test.dart and adds more type-checks, casts to assert types, cleans up property getters, and adds a few missing cases. Change-Id: Ia5fb9bfef6f9e212ea8da27362b0b4efb4cbf2fa Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/379144 Commit-Queue: Srujan Gaddam <srujzs@google.com> Reviewed-by: Martin Kustermann <kustermann@google.com>