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 955acd0eb592dca854a758a89f80aada66e079a7..68cdfa76a53dbe3d35f419bcd1d1f43a452ab34e 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)) { |
@@ -179,7 +173,7 @@ class TypeTestEmitter extends CodeEmitterHelper { |
getFunctionTypeChecksOn(callType); |
generateFunctionTypeTests( |
call, callType, functionTypeChecks, |
- emitFunctionTypeSignature, emitIsFunctionTypeTest); |
+ emitFunctionTypeSignature); |
} |
} |
@@ -253,36 +247,19 @@ class TypeTestEmitter extends CodeEmitterHelper { |
Element method, |
FunctionType methodType, |
Map<FunctionType, bool> functionTypeChecks, |
- FunctionTypeSignatureEmitter emitFunctionTypeSignature, |
- FunctionTypeTestEmitter emitIsFunctionTypeTest) { |
- bool hasDynamicFunctionTypeCheck = false; |
- int neededPredicates = 0; |
+ FunctionTypeSignatureEmitter emitFunctionTypeSignature) { |
functionTypeChecks.forEach((FunctionType functionType, bool knownSubtype) { |
if (!knownSubtype) { |
Johnni Winther
2013/12/03 10:33:16
Remove `if (!knownSubtype) {` and the loop below w
ahe
2013/12/05 14:24:23
Done.
|
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; |
- } |
+ |
+ // TODO(ahe): This method should only consist of the following line. |
+ emitFunctionTypeSignature(method, methodType); |
+ |
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); |
} |
}); |
} |