Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(705)

Unified Diff: sdk/lib/_internal/compiler/implementation/ssa/types_propagation.dart

Issue 36073002: Separate HTypeConversion checked type from output type. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/ssa/nodes.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/compiler/implementation/ssa/types_propagation.dart
diff --git a/sdk/lib/_internal/compiler/implementation/ssa/types_propagation.dart b/sdk/lib/_internal/compiler/implementation/ssa/types_propagation.dart
index e3a107b5abc90afdae0ffa1329418bcfa668b437..600d7a97249db5add8abf76ea85ab7bb0f74b1ad 100644
--- a/sdk/lib/_internal/compiler/implementation/ssa/types_propagation.dart
+++ b/sdk/lib/_internal/compiler/implementation/ssa/types_propagation.dart
@@ -140,21 +140,21 @@ class SsaTypePropagator extends HBaseVisitor implements OptimizationPhase {
}
HType visitTypeConversion(HTypeConversion instruction) {
- HType oldType = instruction.instructionType;
- // Do not change a checked mode check.
- if (instruction.isCheckedModeCheck) return oldType;
- // We must make sure a type conversion for receiver or argument check
- // does not try to do an int check, because an int check is not enough.
- // We only do an int check if the input is integer or null.
- HInstruction checked = instruction.checkedInput;
- if (oldType.isNumber()
- && !oldType.isDouble()
- && checked.isIntegerOrNull()) {
- return HType.INTEGER;
- } else if (oldType.isInteger() && !checked.isIntegerOrNull()) {
- return HType.NUMBER;
+ HType inputType = instruction.checkedInput.instructionType;
+ HType checkedType = instruction.checkedType;
+ if (instruction.isArgumentTypeCheck || instruction.isReceiverTypeCheck) {
+ // We must make sure a type conversion for receiver or argument check
+ // does not try to do an int check, because an int check is not enough.
+ // We only do an int check if the input is integer or null.
+ if (checkedType.isNumber()
+ && !checkedType.isDouble()
+ && inputType.isIntegerOrNull()) {
+ instruction.checkedType = HType.INTEGER;
+ } else if (checkedType.isInteger() && !inputType.isIntegerOrNull()) {
+ instruction.checkedType = HType.NUMBER;
+ }
}
- return oldType;
+ return checkedType.intersection(inputType, compiler);
}
HType visitTypeKnown(HTypeKnown instruction) {
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/ssa/nodes.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698