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

Unified Diff: sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart

Issue 22903036: Use predicates to check simple function types. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments. Created 7 years, 4 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: sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart
diff --git a/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart b/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart
index 965822ea6c0c54cf5ca4370ebb5b6f15ecb59839..f1f7953b31ec098d928e1b9f4e819b9ed0ddde4f 100644
--- a/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart
+++ b/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart
@@ -2176,7 +2176,9 @@ class CodeEmitterTask extends CompilerTask {
if (!knownSubtype) {
registerDynamicFunctionTypeCheck(functionType);
hasDynamicFunctionTypeCheck = true;
- } else {
+ } else if (!backend.rti.isSimpleFunctionType(functionType)) {
+ // Simple function types are always checked using predicates and should
+ // not provoke generation of signatures.
neededPredicates++;
}
});
@@ -2188,7 +2190,10 @@ class CodeEmitterTask extends CompilerTask {
}
functionTypeChecks.forEach((FunctionType functionType, bool knownSubtype) {
if (knownSubtype) {
- if (alwaysUseSignature) {
+ if (backend.rti.isSimpleFunctionType(functionType)) {
+ // Simple function types are always checked using predicates.
+ emitIsFunctionTypeTest(functionType);
+ } else if (alwaysUseSignature) {
registerDynamicFunctionTypeCheck(functionType);
} else {
emitIsFunctionTypeTest(functionType);

Powered by Google App Engine
This is Rietveld 408576698