| 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);
|
| + }
|
| }
|
| });
|
| }
|
|
|