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 SsaCodeGeneratorTask generator; | 8 SsaCodeGeneratorTask generator; |
9 SsaBuilderTask builder; | 9 SsaBuilderTask builder; |
10 SsaOptimizerTask optimizer; | 10 SsaOptimizerTask optimizer; |
(...skipping 3424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3435 return new HIs.compound(type, expression, call, backend.boolType); | 3435 return new HIs.compound(type, expression, call, backend.boolType); |
3436 } else if (type.isMalformed) { | 3436 } else if (type.isMalformed) { |
3437 ErroneousElement element = type.element; | 3437 ErroneousElement element = type.element; |
3438 generateTypeError(node, element.message); | 3438 generateTypeError(node, element.message); |
3439 HInstruction call = pop(); | 3439 HInstruction call = pop(); |
3440 return new HIs.compound(type, expression, call, backend.boolType); | 3440 return new HIs.compound(type, expression, call, backend.boolType); |
3441 } else { | 3441 } else { |
3442 if (backend.hasDirectCheckFor(type)) { | 3442 if (backend.hasDirectCheckFor(type)) { |
3443 return new HIs.direct(type, expression, backend.boolType); | 3443 return new HIs.direct(type, expression, backend.boolType); |
3444 } | 3444 } |
3445 // TODO(johnniwinther): Avoid interceptor if unneeded. | 3445 // The interceptor is not always needed. It is removed by optimization |
| 3446 // when the receiver type or tested type permit. |
3446 return new HIs.raw( | 3447 return new HIs.raw( |
3447 type, expression, invokeInterceptor(expression), backend.boolType); | 3448 type, expression, invokeInterceptor(expression), backend.boolType); |
3448 } | 3449 } |
3449 } | 3450 } |
3450 | 3451 |
3451 HInstruction buildFunctionType(FunctionType type) { | 3452 HInstruction buildFunctionType(FunctionType type) { |
3452 type.accept(new TypeBuilder(compiler.world), this); | 3453 type.accept(new TypeBuilder(compiler.world), this); |
3453 return pop(); | 3454 return pop(); |
3454 } | 3455 } |
3455 | 3456 |
(...skipping 3214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6670 if (unaliased is TypedefType) throw 'unable to unalias $type'; | 6671 if (unaliased is TypedefType) throw 'unable to unalias $type'; |
6671 unaliased.accept(this, builder); | 6672 unaliased.accept(this, builder); |
6672 } | 6673 } |
6673 | 6674 |
6674 void visitDynamicType(DynamicType type, SsaBuilder builder) { | 6675 void visitDynamicType(DynamicType type, SsaBuilder builder) { |
6675 JavaScriptBackend backend = builder.compiler.backend; | 6676 JavaScriptBackend backend = builder.compiler.backend; |
6676 ClassElement cls = backend.findHelper('DynamicRuntimeType'); | 6677 ClassElement cls = backend.findHelper('DynamicRuntimeType'); |
6677 builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld))); | 6678 builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld))); |
6678 } | 6679 } |
6679 } | 6680 } |
OLD | NEW |