| Index: dart/sdk/lib/_internal/compiler/implementation/js_emitter/type_test_emitter.dart
|
| diff --git a/dart/sdk/lib/_internal/compiler/implementation/js_emitter/type_test_emitter.dart b/dart/sdk/lib/_internal/compiler/implementation/js_emitter/type_test_emitter.dart
|
| index 0d521bb0abbcb526c371a0b2283cdb008b700e67..d92cacfeabcd901591f6b892df4c09a474b850a1 100644
|
| --- a/dart/sdk/lib/_internal/compiler/implementation/js_emitter/type_test_emitter.dart
|
| +++ b/dart/sdk/lib/_internal/compiler/implementation/js_emitter/type_test_emitter.dart
|
| @@ -53,11 +53,6 @@ class TypeTestEmitter extends CodeEmitterHelper {
|
| builder.addProperty(namer.operatorIs(other), js('true'));
|
| }
|
|
|
| - void generateIsFunctionTypeTest(FunctionType type) {
|
| - String operator = namer.operatorIsType(type);
|
| - builder.addProperty(operator, new jsAst.LiteralBool(true));
|
| - }
|
| -
|
| void generateFunctionTypeSignature(Element method, FunctionType type) {
|
| assert(method.isImplementation);
|
| jsAst.Expression thisAccess = new jsAst.This();
|
| @@ -94,7 +89,7 @@ class TypeTestEmitter extends CodeEmitterHelper {
|
| }
|
|
|
| generateIsTestsOn(classElement, generateIsTest,
|
| - generateIsFunctionTypeTest, generateFunctionTypeSignature,
|
| + generateFunctionTypeSignature,
|
| generateSubstitution);
|
| }
|
|
|
| @@ -107,7 +102,6 @@ class TypeTestEmitter extends CodeEmitterHelper {
|
| */
|
| void generateIsTestsOn(ClassElement cls,
|
| void emitIsTest(Element element),
|
| - FunctionTypeTestEmitter emitIsFunctionTypeTest,
|
| FunctionTypeSignatureEmitter emitFunctionTypeSignature,
|
| SubstitutionEmitter emitSubstitution) {
|
| if (checkedClasses.contains(cls)) {
|
| @@ -176,7 +170,7 @@ class TypeTestEmitter extends CodeEmitterHelper {
|
| getFunctionTypeChecksOn(callType);
|
| generateFunctionTypeTests(
|
| call, callType, functionTypeChecks,
|
| - emitFunctionTypeSignature, emitIsFunctionTypeTest);
|
| + emitFunctionTypeSignature);
|
| }
|
| }
|
|
|
| @@ -250,38 +244,14 @@ class TypeTestEmitter extends CodeEmitterHelper {
|
| Element method,
|
| FunctionType methodType,
|
| Map<FunctionType, bool> functionTypeChecks,
|
| - FunctionTypeSignatureEmitter emitFunctionTypeSignature,
|
| - FunctionTypeTestEmitter emitIsFunctionTypeTest) {
|
| - bool hasDynamicFunctionTypeCheck = false;
|
| - int neededPredicates = 0;
|
| - functionTypeChecks.forEach((FunctionType functionType, bool knownSubtype) {
|
| - if (!knownSubtype) {
|
| - registerDynamicFunctionTypeCheck(functionType);
|
| - hasDynamicFunctionTypeCheck = true;
|
| - } else if (!backend.rti.isSimpleFunctionType(functionType)) {
|
| - // Simple function types are always checked using predicates and should
|
| - // not provoke generation of signatures.
|
| - neededPredicates++;
|
| - }
|
| - });
|
| - bool alwaysUseSignature = false;
|
| - if (hasDynamicFunctionTypeCheck ||
|
| - neededPredicates > MAX_FUNCTION_TYPE_PREDICATES) {
|
| - emitFunctionTypeSignature(method, methodType);
|
| - alwaysUseSignature = true;
|
| - }
|
| + FunctionTypeSignatureEmitter emitFunctionTypeSignature) {
|
| +
|
| + // TODO(ahe): We should be able to remove this forEach loop.
|
| functionTypeChecks.forEach((FunctionType functionType, bool knownSubtype) {
|
| - if (knownSubtype) {
|
| - if (backend.rti.isSimpleFunctionType(functionType)) {
|
| - // Simple function types are always checked using predicates.
|
| - emitIsFunctionTypeTest(functionType);
|
| - } else if (alwaysUseSignature) {
|
| - registerDynamicFunctionTypeCheck(functionType);
|
| - } else {
|
| - emitIsFunctionTypeTest(functionType);
|
| - }
|
| - }
|
| + registerDynamicFunctionTypeCheck(functionType);
|
| });
|
| +
|
| + emitFunctionTypeSignature(method, methodType);
|
| }
|
|
|
| void registerDynamicFunctionTypeCheck(FunctionType functionType) {
|
|
|