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

Unified Diff: pkg/compiler/lib/src/js_backend/codegen/task.dart

Issue 718043004: cps-ir: Only use fallback compiler for platform functions. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 fe6ecc60cdad334bbc8f8b46c22f5192d6a4a202..1573e82dc7499e08e76082a2fea01f54b266e8c0 100644
--- a/pkg/compiler/lib/src/js_backend/codegen/task.dart
+++ b/pkg/compiler/lib/src/js_backend/codegen/task.dart
@@ -28,30 +28,28 @@ import '../../js_backend/codegen/codegen.dart';
import '../../ssa/ssa.dart' as ssa;
class CspFunctionCompiler implements FunctionCompiler {
-
- // TODO(sigurdm): Assign this.
- Tracer tracer;
-
- String get name => 'CPS Ir pipeline';
-
final IrBuilderTask irBuilderTask;
-
final ConstantSystem constantSystem;
-
final Compiler compiler;
- // Remember to update dart-doc of [compile] when this field is removed.
+ // TODO(karlklose,sigurm): remove and update dart-doc of [compile].
final FunctionCompiler fallbackCompiler;
+ // TODO(sigurdm): Assign this.
+ Tracer tracer;
+
CspFunctionCompiler(Compiler compiler, JavaScriptBackend backend)
: irBuilderTask = new IrBuilderTask(compiler),
fallbackCompiler = new ssa.SsaFunctionCompiler(backend),
constantSystem = backend.constantSystem,
compiler = compiler;
+ 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.
+ /// features not implemented it will fall back to the ssa pipeline (for
+ /// platform code) or will cancel compilation (for user code).
js.Fun compile(CodegenWorkItem work) {
AstElement element = work.element;
return compiler.withCurrentElement(element, () {
@@ -65,9 +63,15 @@ class CspFunctionCompiler implements FunctionCompiler {
treeFunction = optimizeTreeIR(treeFunction);
return compileToJavaScript(work, treeFunction);
} on CodegenBailout catch (e) {
- compiler.log('Falling back to SSA compiler for $element'
- ' (${e.message})');
- return fallbackCompiler.compile(work);
+ if (element.library.isPlatformLibrary) {
+ compiler.log('Falling back to SSA compiler for $element'
+ ' (${e.message})');
+ return fallbackCompiler.compile(work);
+ } else {
+ String message = "Unable to compile $element with the new compiler.\n"
+ " Reason: ${e.message}";
+ compiler.internalError(element, message);
+ }
}
});
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698