Skip to content

Commit

Permalink
[dart2js] types_propagation - handle HAsCheckSimple
Browse files Browse the repository at this point in the history
Change-Id: I4bd01b5a06b407fee2418e43c2196746afbe5a64
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127741
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
  • Loading branch information
rakudrama authored and commit-bot@chromium.org committed Dec 9, 2019
1 parent 20ec71d commit 2a1fadb
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions pkg/compiler/lib/src/ssa/types_propagation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -502,9 +502,19 @@ class SsaTypePropagator extends HBaseVisitor implements OptimizationPhase {

@override
AbstractValue visitAsCheck(HAsCheck instruction) {
HInstruction input = instruction.checkedInput;
return _narrowAsCheck(instruction, instruction.checkedInput,
instruction.checkedType.abstractValue);
}

@override
AbstractValue visitAsCheckSimple(HAsCheckSimple instruction) {
return _narrowAsCheck(instruction, instruction.checkedInput,
instruction.checkedType.abstractValue);
}

AbstractValue _narrowAsCheck(
HInstruction instruction, HInstruction input, AbstractValue checkedType) {
AbstractValue inputType = input.instructionType;
AbstractValue checkedType = instruction.checkedType.abstractValue;
AbstractValue outputType =
abstractValueDomain.intersection(checkedType, inputType);
outputType = _numericFixup(outputType, inputType, checkedType);
Expand Down

0 comments on commit 2a1fadb

Please sign in to comment.