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

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

Issue 813013002: Don't try to compile platform libraries with the new backend. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /// Generate code using the cps-based IR pipeline. 5 /// Generate code using the cps-based IR pipeline.
6 library code_generator_task; 6 library code_generator_task;
7 7
8 import 'glue.dart'; 8 import 'glue.dart';
9 import 'codegen.dart'; 9 import 'codegen.dart';
10 import 'unsugar.dart'; 10 import 'unsugar.dart';
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 String get name => 'CPS Ir pipeline'; 57 String get name => 'CPS Ir pipeline';
58 58
59 /// Generates JavaScript code for `work.element`. First tries to use the 59 /// Generates JavaScript code for `work.element`. First tries to use the
60 /// Cps Ir -> tree ir -> js pipeline, and if that fails due to language 60 /// Cps Ir -> tree ir -> js pipeline, and if that fails due to language
61 /// features not implemented it will fall back to the ssa pipeline (for 61 /// features not implemented it will fall back to the ssa pipeline (for
62 /// platform code) or will cancel compilation (for user code). 62 /// platform code) or will cancel compilation (for user code).
63 js.Fun compile(CodegenWorkItem work) { 63 js.Fun compile(CodegenWorkItem work) {
64 types = new TypeMaskSystem(compiler); 64 types = new TypeMaskSystem(compiler);
65 AstElement element = work.element; 65 AstElement element = work.element;
66 return compiler.withCurrentElement(element, () { 66 return compiler.withCurrentElement(element, () {
67 if (element.library.isPlatformLibrary) {
68 compiler.log('Using SSA compiler for platform element $element');
69 return fallbackCompiler.compile(work);
70 }
67 try { 71 try {
68 if (tracer != null) { 72 if (tracer != null) {
69 tracer.traceCompilation(element.name, null); 73 tracer.traceCompilation(element.name, null);
70 } 74 }
71 cps.FunctionDefinition cpsFunction = compileToCpsIR(element); 75 cps.FunctionDefinition cpsFunction = compileToCpsIR(element);
72 cpsFunction = optimizeCpsIR(cpsFunction); 76 cpsFunction = optimizeCpsIR(cpsFunction);
73 tree_ir.FunctionDefinition treeFunction = compileToTreeIR(cpsFunction); 77 tree_ir.FunctionDefinition treeFunction = compileToTreeIR(cpsFunction);
74 treeFunction = optimizeTreeIR(treeFunction); 78 treeFunction = optimizeTreeIR(treeFunction);
75 return compileToJavaScript(work, treeFunction); 79 return compileToJavaScript(work, treeFunction);
76 } on CodegenBailout catch (e) { 80 } on CodegenBailout catch (e) {
77 if (element.library.isPlatformLibrary) { 81 String message = "Unable to compile $element with the new compiler.\n"
78 compiler.log('Falling back to SSA compiler for $element' 82 " Reason: ${e.message}";
79 ' (${e.message})'); 83 compiler.internalError(element, message);
80 return fallbackCompiler.compile(work);
81 } else {
82 String message = "Unable to compile $element with the new compiler.\n"
83 " Reason: ${e.message}";
84 compiler.internalError(element, message);
85 }
86 } 84 }
87 }); 85 });
88 } 86 }
89 87
90 void giveUp(String reason) { 88 void giveUp(String reason) {
91 throw new CodegenBailout(null, reason); 89 throw new CodegenBailout(null, reason);
92 } 90 }
93 91
94 void traceGraph(String title, var irObject) { 92 void traceGraph(String title, var irObject) {
95 if (tracer != null) { 93 if (tracer != null) {
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 endSourcePosition = 227 endSourcePosition =
230 new TokenSourceFileLocation(sourceFile, endToken, name); 228 new TokenSourceFileLocation(sourceFile, endToken, name);
231 } 229 }
232 return node.withPosition(sourcePosition, endSourcePosition); 230 return node.withPosition(sourcePosition, endSourcePosition);
233 } 231 }
234 232
235 SourceFile sourceFileOfElement(Element element) { 233 SourceFile sourceFileOfElement(Element element) {
236 return element.implementation.compilationUnit.script.file; 234 return element.implementation.compilationUnit.script.file;
237 } 235 }
238 } 236 }
OLDNEW
« 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