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

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: Fix issues with last 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
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..b3af93804662c439460fa1194c687cc95d117809 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,38 +33,39 @@ 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() {
+ if (!irEnabled()) return;
floitsch 2014/11/13 14:30:55 We should not call `buildNodes` if we aren't inter
sigurdm 2014/11/13 14:43:41 Done.
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}) {
+ bool irEnabled() {
// TODO(sigurdm,kmillikin): Support checked-mode checks.
- return (useNewBackend || const bool.fromEnvironment('USE_NEW_BACKEND')) &&
- compiler.backend is DartBackend &&
- !compiler.enableTypeAssertions &&
- !compiler.enableConcreteTypeInference;
+ return compiler.backend is DartBackend &&
+ !compiler.enableTypeAssertions &&
floitsch 2014/11/13 14:30:55 These checks should probably go to the compiler to
sigurdm 2014/11/13 14:43:41 TODO added
+ !compiler.enableConcreteTypeInference;
}
bool canBuild(Element element) {

Powered by Google App Engine
This is Rietveld 408576698