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

Unified Diff: pkg/compiler/lib/src/cps_ir/cps_ir_builder_visitor.dart

Issue 716823002: Set up a stub pipline for using the new cps-based ir to generate js. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Move IrEnabled to compiler 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 | « pkg/compiler/lib/src/compiler.dart ('k') | pkg/compiler/lib/src/dart2jslib.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/cps_ir/cps_ir_builder_visitor.dart
diff --git a/pkg/compiler/lib/src/cps_ir/cps_ir_builder_visitor.dart b/pkg/compiler/lib/src/cps_ir/cps_ir_builder_visitor.dart
index b7ac48ed878caffb5d9ab201c12dc28fb7209306..227bfc34d4ac61052b855e6e0fed7e622ecc0312 100644
--- a/pkg/compiler/lib/src/cps_ir/cps_ir_builder_visitor.dart
+++ b/pkg/compiler/lib/src/cps_ir/cps_ir_builder_visitor.dart
@@ -33,40 +33,33 @@ class IrBuilderTask extends CompilerTask {
ir.FunctionDefinition getIr(Element element) => nodes[element.implementation];
- void buildNodes({bool useNewBackend: false}) {
- if (!irEnabled(useNewBackend: useNewBackend)) return;
+ ir.FunctionDefinition buildNode(AstElement element) {
+ if (!canBuild(element)) return null;
+ TreeElements elementsMapping = element.resolvedAst.elements;
+ element = element.implementation;
+ return compiler.withCurrentElement(element, () {
+ SourceFile sourceFile = elementSourceFile(element);
+ IrBuilderVisitor builder =
+ new IrBuilderVisitor(elementsMapping, compiler, sourceFile);
+ ir.FunctionDefinition function;
+ function = builder.buildFunction(element);
+
+ return function;
+ });
+ }
+
+ void buildNodes() {
measure(() {
Set<Element> resolved = compiler.enqueuer.resolution.resolvedElements;
resolved.forEach((AstElement element) {
- if (canBuild(element)) {
- TreeElements elementsMapping = element.resolvedAst.elements;
- element = element.implementation;
- compiler.withCurrentElement(element, () {
- SourceFile sourceFile = elementSourceFile(element);
- IrBuilderVisitor builder =
- new IrBuilderVisitor(elementsMapping, compiler, sourceFile);
- ir.FunctionDefinition function;
- function = builder.buildFunction(element);
-
- if (function != null) {
- nodes[element] = function;
- compiler.tracer.traceCompilation(element.name, null);
- compiler.tracer.traceGraph("IR Builder", function);
- }
- });
+ ir.FunctionDefinition functionDefinition = buildNode(element);
+ if (functionDefinition != null) {
+ nodes[element] = functionDefinition;
}
});
});
}
- bool irEnabled({bool useNewBackend: false}) {
- // TODO(sigurdm,kmillikin): Support checked-mode checks.
- return (useNewBackend || const bool.fromEnvironment('USE_NEW_BACKEND')) &&
- compiler.backend is DartBackend &&
- !compiler.enableTypeAssertions &&
- !compiler.enableConcreteTypeInference;
- }
-
bool canBuild(Element element) {
FunctionElement function = element.asFunctionElement();
// TODO(kmillikin,sigurdm): support lazy field initializers.
« no previous file with comments | « pkg/compiler/lib/src/compiler.dart ('k') | pkg/compiler/lib/src/dart2jslib.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698