Skip to content

Unify implementation of 'is' and 'as' checks in VM #30571

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
alexmarkov opened this issue Aug 29, 2017 · 0 comments
Open

Unify implementation of 'is' and 'as' checks in VM #30571

alexmarkov opened this issue Aug 29, 2017 · 0 comments
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. type-code-health Internal changes to our tools and workflows to make them cleaner, simpler, or more maintainable

Comments

@alexmarkov
Copy link
Contributor

The implementation of 'is' and 'as' checks in Dart VM and the optimizations for these type checks is both duplicated and diverged. We can unify 'is' and 'as' checks to reduce code duplication and reuse certain optimizations for both kinds of checks.

See

void JitOptimizer::ReplaceWithInstanceOf(InstanceCallInstr* call) {

void JitOptimizer::ReplaceWithTypeCast(InstanceCallInstr* call) {

void AotOptimizer::ReplaceWithInstanceOf(InstanceCallInstr* call) {

void AotOptimizer::ReplaceWithTypeCast(InstanceCallInstr* call) {

@alexmarkov alexmarkov added area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. type-code-health Internal changes to our tools and workflows to make them cleaner, simpler, or more maintainable labels Aug 29, 2017
@mkustermann mkustermann assigned mkustermann and unassigned alexmarkov Oct 9, 2018
dart-bot pushed a commit that referenced this issue Oct 10, 2018
This makes explicit downcasts more efficient by re-using the
optimizations we already have for implicit downcasts.

For implicit/explicit as checks we use the symbol to distinguish which
exception to throw if the check fails.  So this does not actually
require unification of _CastError and _TypeError.

Issue #34582
Issue #30632
Issue #30571

Change-Id: I7b8818d2698e249c90a3e1b8790bad69ada649a9
Reviewed-on: https://dart-review.googlesource.com/c/78748
Commit-Queue: Martin Kustermann <[email protected]>
Reviewed-by: Alexander Markov <[email protected]>
Reviewed-by: Vyacheslav Egorov <[email protected]>
@mkustermann mkustermann removed their assignment Sep 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. type-code-health Internal changes to our tools and workflows to make them cleaner, simpler, or more maintainable
Projects
None yet
Development

No branches or pull requests

2 participants