OLD | NEW |
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 2572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2583 Element element = type.element; | 2583 Element element = type.element; |
2584 TypeMask mask = new TypeMask.subtype(element, compiler.world); | 2584 TypeMask mask = new TypeMask.subtype(element, compiler.world); |
2585 return new HTypeKnown.pinned(mask, original); | 2585 return new HTypeKnown.pinned(mask, original); |
2586 } | 2586 } |
2587 | 2587 |
2588 HInstruction _checkType(HInstruction original, DartType type, int kind) { | 2588 HInstruction _checkType(HInstruction original, DartType type, int kind) { |
2589 assert(compiler.enableTypeAssertions); | 2589 assert(compiler.enableTypeAssertions); |
2590 assert(type != null); | 2590 assert(type != null); |
2591 type = localsHandler.substInContext(type); | 2591 type = localsHandler.substInContext(type); |
2592 HInstruction other = buildTypeConversion(original, type, kind); | 2592 HInstruction other = buildTypeConversion(original, type, kind); |
2593 registry?.registerIsCheck(type); | 2593 registry?.registerTypeUse(new TypeUse.isCheck(type)); |
2594 return other; | 2594 return other; |
2595 } | 2595 } |
2596 | 2596 |
2597 HInstruction potentiallyCheckOrTrustType(HInstruction original, DartType type, | 2597 HInstruction potentiallyCheckOrTrustType(HInstruction original, DartType type, |
2598 { int kind: HTypeConversion.CHECKED_MODE_CHECK }) { | 2598 { int kind: HTypeConversion.CHECKED_MODE_CHECK }) { |
2599 if (type == null) return original; | 2599 if (type == null) return original; |
2600 HInstruction checkedOrTrusted = original; | 2600 HInstruction checkedOrTrusted = original; |
2601 if (compiler.trustTypeAnnotations) { | 2601 if (compiler.trustTypeAnnotations) { |
2602 checkedOrTrusted = _trustType(original, type); | 2602 checkedOrTrusted = _trustType(original, type); |
2603 } else if (compiler.enableTypeAssertions) { | 2603 } else if (compiler.enableTypeAssertions) { |
(...skipping 6544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9148 if (unaliased is TypedefType) throw 'unable to unalias $type'; | 9148 if (unaliased is TypedefType) throw 'unable to unalias $type'; |
9149 unaliased.accept(this, builder); | 9149 unaliased.accept(this, builder); |
9150 } | 9150 } |
9151 | 9151 |
9152 void visitDynamicType(DynamicType type, SsaBuilder builder) { | 9152 void visitDynamicType(DynamicType type, SsaBuilder builder) { |
9153 JavaScriptBackend backend = builder.compiler.backend; | 9153 JavaScriptBackend backend = builder.compiler.backend; |
9154 ClassElement cls = backend.helpers.DynamicRuntimeType; | 9154 ClassElement cls = backend.helpers.DynamicRuntimeType; |
9155 builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld))); | 9155 builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld))); |
9156 } | 9156 } |
9157 } | 9157 } |
OLD | NEW |