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 2428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2439 original, representations); | 2439 original, representations); |
2440 } else if (type.isTypeVariable) { | 2440 } else if (type.isTypeVariable) { |
2441 TypeMask subtype = original.instructionType; | 2441 TypeMask subtype = original.instructionType; |
2442 HInstruction typeVariable = addTypeVariableReference(type); | 2442 HInstruction typeVariable = addTypeVariableReference(type); |
2443 return new HTypeConversion.withTypeRepresentation(type, kind, subtype, | 2443 return new HTypeConversion.withTypeRepresentation(type, kind, subtype, |
2444 original, typeVariable); | 2444 original, typeVariable); |
2445 } else if (type.isFunctionType) { | 2445 } else if (type.isFunctionType) { |
2446 String name = kind == HTypeConversion.CAST_TYPE_CHECK | 2446 String name = kind == HTypeConversion.CAST_TYPE_CHECK |
2447 ? '_asCheck' : '_assertCheck'; | 2447 ? '_asCheck' : '_assertCheck'; |
2448 | 2448 |
2449 List arguments = [buildFunctionType(type), original]; | 2449 List<HInstruction> arguments = |
| 2450 <HInstruction>[buildFunctionType(type), original]; |
2450 pushInvokeDynamic( | 2451 pushInvokeDynamic( |
2451 null, | 2452 null, |
2452 new Selector.call(name, backend.jsHelperLibrary, 1), | 2453 new Selector.call(name, backend.jsHelperLibrary, 1), |
2453 arguments); | 2454 arguments); |
2454 | 2455 |
2455 return new HTypeConversion(type, kind, original.instructionType, pop()); | 2456 return new HTypeConversion(type, kind, original.instructionType, pop()); |
2456 } else { | 2457 } else { |
2457 return original.convertType(compiler, type, kind); | 2458 return original.convertType(compiler, type, kind); |
2458 } | 2459 } |
2459 } | 2460 } |
(...skipping 5412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7872 if (unaliased is TypedefType) throw 'unable to unalias $type'; | 7873 if (unaliased is TypedefType) throw 'unable to unalias $type'; |
7873 unaliased.accept(this, builder); | 7874 unaliased.accept(this, builder); |
7874 } | 7875 } |
7875 | 7876 |
7876 void visitDynamicType(DynamicType type, SsaBuilder builder) { | 7877 void visitDynamicType(DynamicType type, SsaBuilder builder) { |
7877 JavaScriptBackend backend = builder.compiler.backend; | 7878 JavaScriptBackend backend = builder.compiler.backend; |
7878 ClassElement cls = backend.findHelper('DynamicRuntimeType'); | 7879 ClassElement cls = backend.findHelper('DynamicRuntimeType'); |
7879 builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld))); | 7880 builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld))); |
7880 } | 7881 } |
7881 } | 7882 } |
OLD | NEW |