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

Side by Side Diff: pkg/compiler/lib/src/ssa/builder.dart

Issue 1402913003: Avoid creating invalid TypeMask.nonNullExact (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Cleanup Created 5 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of ssa; 5 part of ssa;
6 6
7 class SsaFunctionCompiler implements FunctionCompiler { 7 class SsaFunctionCompiler implements FunctionCompiler {
8 final SsaCodeGeneratorTask generator; 8 final SsaCodeGeneratorTask generator;
9 final SsaBuilderTask builder; 9 final SsaBuilderTask builder;
10 final SsaOptimizerTask optimizer; 10 final SsaOptimizerTask optimizer;
(...skipping 5711 matching lines...) Expand 10 before | Expand all | Expand 10 after
5722 {SourceInformation sourceInformation}) { 5722 {SourceInformation sourceInformation}) {
5723 5723
5724 // We prefer to not inline certain operations on indexables, 5724 // We prefer to not inline certain operations on indexables,
5725 // because the constant folder will handle them better and turn 5725 // because the constant folder will handle them better and turn
5726 // them into simpler instructions that allow further 5726 // them into simpler instructions that allow further
5727 // optimizations. 5727 // optimizations.
5728 bool isOptimizableOperationOnIndexable(Selector selector, Element element) { 5728 bool isOptimizableOperationOnIndexable(Selector selector, Element element) {
5729 bool isLength = selector.isGetter 5729 bool isLength = selector.isGetter
5730 && selector.name == "length"; 5730 && selector.name == "length";
5731 if (isLength || selector.isIndex) { 5731 if (isLength || selector.isIndex) {
5732 TypeMask type = new TypeMask.nonNullExact( 5732 return compiler.world.isSubtypeOf(
5733 element.enclosingClass.declaration, compiler.world); 5733 element.enclosingClass.declaration,
5734 return type.satisfies(backend.jsIndexableClass, compiler.world); 5734 backend.jsIndexableClass);
5735 } else if (selector.isIndexSet) { 5735 } else if (selector.isIndexSet) {
5736 TypeMask type = new TypeMask.nonNullExact( 5736 return compiler.world.isSubtypeOf(
5737 element.enclosingClass.declaration, compiler.world); 5737 element.enclosingClass.declaration,
5738 return type.satisfies(backend.jsMutableIndexableClass, compiler.world); 5738 backend.jsMutableIndexableClass);
5739 } else { 5739 } else {
5740 return false; 5740 return false;
5741 } 5741 }
5742 } 5742 }
5743 5743
5744 bool isOptimizableOperation(Selector selector, Element element) { 5744 bool isOptimizableOperation(Selector selector, Element element) {
5745 ClassElement cls = element.enclosingClass; 5745 ClassElement cls = element.enclosingClass;
5746 if (isOptimizableOperationOnIndexable(selector, element)) return true; 5746 if (isOptimizableOperationOnIndexable(selector, element)) return true;
5747 if (!backend.interceptedClasses.contains(cls)) return false; 5747 if (!backend.interceptedClasses.contains(cls)) return false;
5748 if (selector.isOperator) return true; 5748 if (selector.isOperator) return true;
(...skipping 3246 matching lines...) Expand 10 before | Expand all | Expand 10 after
8995 if (unaliased is TypedefType) throw 'unable to unalias $type'; 8995 if (unaliased is TypedefType) throw 'unable to unalias $type';
8996 unaliased.accept(this, builder); 8996 unaliased.accept(this, builder);
8997 } 8997 }
8998 8998
8999 void visitDynamicType(DynamicType type, SsaBuilder builder) { 8999 void visitDynamicType(DynamicType type, SsaBuilder builder) {
9000 JavaScriptBackend backend = builder.compiler.backend; 9000 JavaScriptBackend backend = builder.compiler.backend;
9001 ClassElement cls = backend.findHelper('DynamicRuntimeType'); 9001 ClassElement cls = backend.findHelper('DynamicRuntimeType');
9002 builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld))); 9002 builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld)));
9003 } 9003 }
9004 } 9004 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698