Chromium Code Reviews| 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 3543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3554 // to the runtime type information for type variables as instructions. | 3554 // to the runtime type information for type variables as instructions. |
| 3555 if (type.isTypeVariable) { | 3555 if (type.isTypeVariable) { |
| 3556 return buildLiteralList(<HInstruction>[addTypeVariableReference(type)]); | 3556 return buildLiteralList(<HInstruction>[addTypeVariableReference(type)]); |
| 3557 } else { | 3557 } else { |
| 3558 assert(type.element.isClass); | 3558 assert(type.element.isClass); |
| 3559 InterfaceType interface = type; | 3559 InterfaceType interface = type; |
| 3560 List<HInstruction> inputs = <HInstruction>[]; | 3560 List<HInstruction> inputs = <HInstruction>[]; |
| 3561 bool first = true; | 3561 bool first = true; |
| 3562 List<js.Expression> templates = <js.Expression>[]; | 3562 List<js.Expression> templates = <js.Expression>[]; |
| 3563 for (DartType argument in interface.typeArguments) { | 3563 for (DartType argument in interface.typeArguments) { |
| 3564 templates.add(rti.getTypeRepresentationWithPlaceholders(argument, (varia ble) { | 3564 templates.add(rti.getTypeRepresentationWithPlaceholders(argument, (varia ble) { |
|
floitsch
2015/05/20 13:48:18
long line.
herhut
2015/05/20 14:27:59
Done.
| |
| 3565 HInstruction runtimeType = addTypeVariableReference(variable); | 3565 HInstruction runtimeType = addTypeVariableReference(variable); |
| 3566 inputs.add(runtimeType); | 3566 inputs.add(runtimeType); |
| 3567 })); | 3567 }, firstPlaceholderIndex : inputs.length)); |
|
floitsch
2015/05/20 13:48:18
No space after "firstPlaceholderIndex".
I would p
herhut
2015/05/20 14:27:59
This constructs a template with holes and the corr
| |
| 3568 } | 3568 } |
| 3569 // TODO(sra): This is a fresh template each time. We can't let the | 3569 // TODO(sra): This is a fresh template each time. We can't let the |
| 3570 // template manager build them. | 3570 // template manager build them. |
| 3571 js.Template code = new js.Template(null, | 3571 js.Template code = new js.Template(null, |
| 3572 new js.ArrayInitializer(templates)); | 3572 new js.ArrayInitializer(templates)); |
| 3573 HInstruction representation = | 3573 HInstruction representation = |
| 3574 new HForeignCode(code, backend.readableArrayType, inputs, | 3574 new HForeignCode(code, backend.readableArrayType, inputs, |
| 3575 nativeBehavior: native.NativeBehavior.PURE_ALLOCATION); | 3575 nativeBehavior: native.NativeBehavior.PURE_ALLOCATION); |
| 3576 return representation; | 3576 return representation; |
| 3577 } | 3577 } |
| (...skipping 4086 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7664 if (unaliased is TypedefType) throw 'unable to unalias $type'; | 7664 if (unaliased is TypedefType) throw 'unable to unalias $type'; |
| 7665 unaliased.accept(this, builder); | 7665 unaliased.accept(this, builder); |
| 7666 } | 7666 } |
| 7667 | 7667 |
| 7668 void visitDynamicType(DynamicType type, SsaBuilder builder) { | 7668 void visitDynamicType(DynamicType type, SsaBuilder builder) { |
| 7669 JavaScriptBackend backend = builder.compiler.backend; | 7669 JavaScriptBackend backend = builder.compiler.backend; |
| 7670 ClassElement cls = backend.findHelper('DynamicRuntimeType'); | 7670 ClassElement cls = backend.findHelper('DynamicRuntimeType'); |
| 7671 builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld))); | 7671 builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld))); |
| 7672 } | 7672 } |
| 7673 } | 7673 } |
| OLD | NEW |