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

Unified Diff: pkg/compiler/lib/src/ssa/codegen.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/codegen.dart
diff --git a/pkg/compiler/lib/src/ssa/codegen.dart b/pkg/compiler/lib/src/ssa/codegen.dart
index 5cd48daf59a16f2166c19f568c28ee24c6327130..c53de9316ca87bd1f77a4122c7b5d8edcda14614 100644
--- a/pkg/compiler/lib/src/ssa/codegen.dart
+++ b/pkg/compiler/lib/src/ssa/codegen.dart
@@ -2893,26 +2893,7 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
.getCheckedModeHelper(type, typeCast: node.isCastTypeCheck);
}
- if (helper == null) {
- assert(type.isFunctionType);
- assert(node.usesMethodOnType);
-
- String name = node.isCastTypeCheck ? '_asCheck' : '_assertCheck';
- HInstruction reifiedType = node.inputs[0];
- HInstruction checkedInput = node.inputs[1];
- use(reifiedType);
- js.Expression receiver = pop();
- use(checkedInput);
- Selector selector = new Selector.call(
- new Name(name, helpers.jsHelperLibrary), CallStructure.ONE_ARG);
- registry.registerDynamicUse(
- new DynamicUse(selector, reifiedType.instructionType));
- js.Name methodLiteral = backend.namer.invocationName(selector);
- push(js.js('#.#(#)', [receiver, methodLiteral, pop()]));
- } else {
- assert(!node.usesMethodOnType);
- push(helper.generateCall(this, node));
- }
+ push(helper.generateCall(this, node));
}
void visitTypeKnown(HTypeKnown node) {
@@ -2920,52 +2901,6 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
assert(false);
}
- void visitFunctionType(HFunctionType node) {
- FunctionType type = node.dartType;
- int inputCount = 0;
- use(node.inputs[inputCount++]);
- js.Expression returnType = pop();
-
- List<js.Expression> parameterTypes = <js.Expression>[];
- for (var _ in type.parameterTypes) {
- use(node.inputs[inputCount++]);
- parameterTypes.add(pop());
- }
-
- List<js.Expression> optionalParameterTypes = <js.Expression>[];
- for (var _ in type.optionalParameterTypes) {
- use(node.inputs[inputCount++]);
- optionalParameterTypes.add(pop());
- }
-
- List<js.Property> namedParameters = <js.Property>[];
- for (var _ in type.namedParameters) {
- use(node.inputs[inputCount++]);
- js.Expression name = pop();
- use(node.inputs[inputCount++]);
- namedParameters.add(new js.Property(name, pop()));
- }
-
- if (namedParameters.isEmpty) {
- var arguments = [returnType];
- if (!parameterTypes.isEmpty || !optionalParameterTypes.isEmpty) {
- arguments.add(new js.ArrayInitializer(parameterTypes));
- }
- if (!optionalParameterTypes.isEmpty) {
- arguments.add(new js.ArrayInitializer(optionalParameterTypes));
- }
- push(js.js('#(#)', [accessHelper(helpers.buildFunctionType), arguments]));
- } else {
- var arguments = [
- returnType,
- new js.ArrayInitializer(parameterTypes),
- new js.ObjectInitializer(namedParameters)
- ];
- push(js.js(
- '#(#)', [accessHelper(helpers.buildNamedFunctionType), arguments]));
- }
- }
-
void visitTypeInfoReadRaw(HTypeInfoReadRaw node) {
use(node.inputs[0]);
js.Expression receiver = pop();
@@ -3048,76 +2983,6 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
});
}
- void visitReadTypeVariable(HReadTypeVariable node) {
- TypeVariableEntity element = node.dartType.element;
- FunctionEntity helperElement = helpers.convertRtiToRuntimeType;
- registry.registerStaticUse(
- new StaticUse.staticInvoke(helperElement, CallStructure.ONE_ARG));
-
- use(node.inputs[0]);
- if (node.hasReceiver) {
- if (backend.interceptorData.isInterceptorClass(element.typeDeclaration)) {
- int index = element.index;
- js.Expression receiver = pop();
- js.Expression helper =
- backend.emitter.staticFunctionAccess(helperElement);
- js.Expression rtiFieldName = backend.namer.rtiFieldJsName;
- push(js.js(r'#(#.# && #.#[#])', [
- helper,
- receiver,
- rtiFieldName,
- receiver,
- rtiFieldName,
- js.js.number(index)
- ]));
- } else {
- backend.emitter.registerReadTypeVariable(element);
- push(js.js(
- '#.#()', [pop(), backend.namer.nameForReadTypeVariable(element)]));
- }
- } else {
- push(js.js('#(#)',
- [backend.emitter.staticFunctionAccess(helperElement), pop()]));
- }
- }
-
- void visitInterfaceType(HInterfaceType node) {
- List<js.Expression> typeArguments = <js.Expression>[];
- for (HInstruction type in node.inputs) {
- use(type);
- typeArguments.add(pop());
- }
- InterfaceType type = node.dartType;
- ClassEntity cls = type.element;
- var arguments = [backend.emitter.typeAccess(cls)];
- if (!typeArguments.isEmpty) {
- arguments.add(new js.ArrayInitializer(typeArguments));
- }
- push(js.js('#(#)', [
- accessHelper(helpers.buildInterfaceType, arguments.length),
- arguments
- ]));
- }
-
- void visitVoidType(HVoidType node) {
- push(js.js('#()', accessHelper(helpers.getVoidRuntimeType)));
- }
-
- void visitDynamicType(HDynamicType node) {
- push(js.js('#()', accessHelper(helpers.getDynamicRuntimeType)));
- }
-
- js.PropertyAccess accessHelper(FunctionEntity helper,
- [int argumentCount = 0]) {
- if (helper == null) {
- // For mocked-up tests.
- return js.js('(void 0).dummy');
- }
- registry.registerStaticUse(new StaticUse.staticInvoke(
- helper, new CallStructure.unnamed(argumentCount)));
- return backend.emitter.staticFunctionAccess(helper);
- }
-
@override
void visitRef(HRef node) {
visit(node.value);

Powered by Google App Engine
This is Rietveld 408576698