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

Unified Diff: pkg/compiler/lib/src/ssa/graph_builder.dart

Issue 2722753002: Remove HRuntimeType implementation (Closed)
Patch Set: Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: pkg/compiler/lib/src/ssa/graph_builder.dart
diff --git a/pkg/compiler/lib/src/ssa/graph_builder.dart b/pkg/compiler/lib/src/ssa/graph_builder.dart
index 0af3064f171e78fae6d45512ef6b4488362f9302..ac49027592b6b8152b177ffa8ce8669ed038ba95 100644
--- a/pkg/compiler/lib/src/ssa/graph_builder.dart
+++ b/pkg/compiler/lib/src/ssa/graph_builder.dart
@@ -189,14 +189,6 @@ abstract class GraphBuilder {
return new HSubExpressionBlockInformation(expression);
}
- HInstruction buildFunctionType(ResolutionFunctionType type) {
- type.accept(new ReifiedTypeRepresentationBuilder(closedWorld), this);
- return pop();
- }
-
- HInstruction buildFunctionTypeConversion(
- HInstruction original, ResolutionDartType type, int kind);
-
/// Returns the current source element.
///
/// The returned element is a declaration element.
@@ -242,105 +234,3 @@ abstract class GraphBuilder {
Element get targetElement;
TypeBuilder get typeBuilder;
}
-
-class ReifiedTypeRepresentationBuilder
- implements DartTypeVisitor<dynamic, GraphBuilder> {
- final ClosedWorld closedWorld;
-
- ReifiedTypeRepresentationBuilder(this.closedWorld);
-
- void visit(ResolutionDartType type, GraphBuilder builder) =>
- type.accept(this, builder);
-
- void visitVoidType(ResolutionVoidType type, GraphBuilder builder) {
- ClassElement cls = builder.backend.helpers.VoidRuntimeType;
- builder.push(new HVoidType(type, new TypeMask.exact(cls, closedWorld)));
- }
-
- void visitTypeVariableType(
- ResolutionTypeVariableType type, GraphBuilder builder) {
- ClassElement cls = builder.backend.helpers.RuntimeType;
- TypeMask instructionType = new TypeMask.subclass(cls, closedWorld);
-
- // TODO(floitsch): this hack maps type variables of generic function
- // typedefs to dynamic. For example: `typedef F = Function<T>(T)`.
- if (type is MethodTypeVariableType) {
- visitDynamicType(const ResolutionDynamicType(), builder);
- return;
- }
-
- if (!builder.sourceElement.enclosingElement.isClosure &&
- builder.sourceElement.isInstanceMember) {
- HInstruction receiver = builder.localsHandler.readThis();
- builder.push(new HReadTypeVariable(type, receiver, instructionType));
- } else {
- builder.push(new HReadTypeVariable.noReceiver(
- type,
- builder.typeBuilder
- .addTypeVariableReference(type, builder.sourceElement),
- instructionType));
- }
- }
-
- void visitFunctionType(ResolutionFunctionType type, GraphBuilder builder) {
- type.returnType.accept(this, builder);
- HInstruction returnType = builder.pop();
- List<HInstruction> inputs = <HInstruction>[returnType];
-
- for (ResolutionDartType parameter in type.parameterTypes) {
- parameter.accept(this, builder);
- inputs.add(builder.pop());
- }
-
- for (ResolutionDartType parameter in type.optionalParameterTypes) {
- parameter.accept(this, builder);
- inputs.add(builder.pop());
- }
-
- List<ResolutionDartType> namedParameterTypes = type.namedParameterTypes;
- List<String> names = type.namedParameters;
- for (int index = 0; index < names.length; index++) {
- ast.DartString dartString = new ast.DartString.literal(names[index]);
- inputs.add(
- builder.graph.addConstantString(dartString, builder.closedWorld));
- namedParameterTypes[index].accept(this, builder);
- inputs.add(builder.pop());
- }
-
- ClassElement cls = builder.backend.helpers.RuntimeFunctionType;
- builder.push(
- new HFunctionType(inputs, type, new TypeMask.exact(cls, closedWorld)));
- }
-
- void visitMalformedType(MalformedType type, GraphBuilder builder) {
- visitDynamicType(const ResolutionDynamicType(), builder);
- }
-
- void visitInterfaceType(ResolutionInterfaceType type, GraphBuilder builder) {
- List<HInstruction> inputs = <HInstruction>[];
- for (ResolutionDartType typeArgument in type.typeArguments) {
- typeArgument.accept(this, builder);
- inputs.add(builder.pop());
- }
- ClassElement cls;
- if (type.typeArguments.isEmpty) {
- cls = builder.backend.helpers.RuntimeTypePlain;
- } else {
- cls = builder.backend.helpers.RuntimeTypeGeneric;
- }
- builder.push(
- new HInterfaceType(inputs, type, new TypeMask.exact(cls, closedWorld)));
- }
-
- void visitTypedefType(ResolutionTypedefType type, GraphBuilder builder) {
- ResolutionDartType unaliased = type.unaliased;
- if (unaliased is ResolutionTypedefType) throw 'unable to unalias $type';
- unaliased.accept(this, builder);
- }
-
- void visitDynamicType(ResolutionDynamicType type, GraphBuilder builder) {
- JavaScriptBackend backend = builder.compiler.backend;
- ClassElement cls = backend.helpers.DynamicRuntimeType;
- builder.push(new HDynamicType(type, new TypeMask.exact(cls, closedWorld)));
- }
-}

Powered by Google App Engine
This is Rietveld 408576698