Index: pkg/compiler/lib/src/js_backend/codegen/task.dart |
diff --git a/pkg/compiler/lib/src/js_backend/codegen/task.dart b/pkg/compiler/lib/src/js_backend/codegen/task.dart |
index 93fe011ff425145658aa8d71b0fdca8fb7960f24..8374acb68fccdab905b6355c5b0e1d07dfe83096 100644 |
--- a/pkg/compiler/lib/src/js_backend/codegen/task.dart |
+++ b/pkg/compiler/lib/src/js_backend/codegen/task.dart |
@@ -57,20 +57,39 @@ class CpsFunctionCompiler implements FunctionCompiler { |
String get name => 'CPS Ir pipeline'; |
- /// Generates JavaScript code for `work.element`. First tries to use the |
- /// Cps Ir -> tree ir -> js pipeline, and if that fails due to language |
- /// features not implemented it will fall back to the ssa pipeline (for |
- /// platform code) or will cancel compilation (for user code). |
+ /// Generates JavaScript code for `work.element`. |
js.Fun compile(CodegenWorkItem work) { |
AstElement element = work.element; |
JavaScriptBackend backend = compiler.backend; |
return compiler.withCurrentElement(element, () { |
- if (element.library.isPlatformLibrary || |
- element.library == backend.interceptorsLibrary) { |
- compiler.log('Using SSA compiler for platform element $element'); |
- return fallbackCompiler.compile(work); |
- } |
try { |
+ ClassElement cls = element.enclosingClass; |
+ String name = element.name; |
+ String className = cls == null ? null : cls.name; |
+ LibraryElement library = element.library; |
+ String libraryName = library == null ? null : library.toString(); |
+ // TODO(karlklose): remove this fallback. |
+ // Fallback for a few functions that we know require try-finally and |
+ // switch. |
+ if (element.isNative || |
+ element.isPatched || |
+ libraryName == 'origin library(dart:typed_data)' || |
+ // Using switch or try-finally. |
+ library.isInternalLibrary && name == 'unwrapException' || |
+ library.isPlatformLibrary && className == 'IterableBase' || |
+ library.isInternalLibrary && className == 'Closure' || |
+ libraryName == 'origin library(dart:collection)' && |
+ name == 'mapToString' || |
+ libraryName == 'library(dart:html)' && name == 'sanitizeNode' || |
+ className == '_IsolateContext' || |
+ className == 'IsolateNatives' || |
+ className == '_Deserializer' || |
+ name == '_rootRun' || |
+ name == '_microtaskLoopEntry') { |
+ compiler.log('Using SSA compiler for platform element $element'); |
+ return fallbackCompiler.compile(work); |
+ } |
+ |
if (tracer != null) { |
tracer.traceCompilation(element.name, null); |
} |