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

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

Issue 16944004: Change how we deal with manual inlining of argument error and NSM when propagating types. This chan… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 6 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
Index: sdk/lib/_internal/compiler/implementation/ssa/codegen.dart
===================================================================
--- sdk/lib/_internal/compiler/implementation/ssa/codegen.dart (revision 23949)
+++ sdk/lib/_internal/compiler/implementation/ssa/codegen.dart (working copy)
@@ -2421,8 +2421,14 @@
js.Expression generateTest(HCheck node) {
HInstruction input = node.checkedInput;
+ TypeMask receiver = input.instructionType.computeMask(compiler);
+ TypeMask mask = node.instructionType.computeMask(compiler);
+ bool turnIntoNullCheck = mask.nullable() == receiver;
js.Expression test;
- if (node.isInteger()) {
+ if (turnIntoNullCheck) {
+ use(input);
+ test = new js.Binary("==", pop(), new js.LiteralNull());
+ } else if (node.isInteger()) {
// input is !int
checkInt(input, '!==');
test = pop();
@@ -2486,7 +2492,7 @@
new js.Binary('||', objectTest, notIndexingTest);
test = new js.Binary('&&', stringTest, notObjectOrIndexingTest);
} else {
- compiler.internalError('Unexpected type guard', instruction: input);
+ compiler.internalError('Unexpected check', instruction: input);
}
return test;
}

Powered by Google App Engine
This is Rietveld 408576698