| OLD | NEW |
| 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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 } | 144 } |
| 145 | 145 |
| 146 void dumpTypedIR(cps.FunctionDefinition cpsNode, | 146 void dumpTypedIR(cps.FunctionDefinition cpsNode, |
| 147 TypePropagator typePropagator) { | 147 TypePropagator typePropagator) { |
| 148 if (PRINT_TYPED_IR_FILTER != null && | 148 if (PRINT_TYPED_IR_FILTER != null && |
| 149 PRINT_TYPED_IR_FILTER.matchAsPrefix(cpsNode.element.name) != null) { | 149 PRINT_TYPED_IR_FILTER.matchAsPrefix(cpsNode.element.name) != null) { |
| 150 String printType(nodeOrRef, String s) { | 150 String printType(nodeOrRef, String s) { |
| 151 cps.Node node = nodeOrRef is cps.Reference | 151 cps.Node node = nodeOrRef is cps.Reference |
| 152 ? nodeOrRef.definition | 152 ? nodeOrRef.definition |
| 153 : nodeOrRef; | 153 : nodeOrRef; |
| 154 var type = typePropagator.getType(node); | 154 return node is cps.Variable && node.type != null |
| 155 return type == null ? s : "$s:${formatTypeMask(type.type)}"; | 155 ? '$s:${formatTypeMask(node.type)}' |
| 156 : s; |
| 156 } | 157 } |
| 157 DEBUG_MODE = true; | 158 DEBUG_MODE = true; |
| 158 print(new SExpressionStringifier(printType).visit(cpsNode)); | 159 print(new SExpressionStringifier(printType).visit(cpsNode)); |
| 159 } | 160 } |
| 160 } | 161 } |
| 161 | 162 |
| 162 static bool checkCpsIntegrity(cps.FunctionDefinition node) { | 163 static bool checkCpsIntegrity(cps.FunctionDefinition node) { |
| 163 new CheckCpsIntegrity().check(node); | 164 new CheckCpsIntegrity().check(node); |
| 164 return true; // So this can be used from assert(). | 165 return true; // So this can be used from assert(). |
| 165 } | 166 } |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 // TODO(sigurdm): Make a better list of tasks. | 243 // TODO(sigurdm): Make a better list of tasks. |
| 243 return <CompilerTask>[irBuilderTask]..addAll(fallbackCompiler.tasks); | 244 return <CompilerTask>[irBuilderTask]..addAll(fallbackCompiler.tasks); |
| 244 } | 245 } |
| 245 | 246 |
| 246 js.Node attachPosition(js.Node node, AstElement element) { | 247 js.Node attachPosition(js.Node node, AstElement element) { |
| 247 return node.withSourceInformation( | 248 return node.withSourceInformation( |
| 248 sourceInformationFactory.createBuilderForContext(element) | 249 sourceInformationFactory.createBuilderForContext(element) |
| 249 .buildDeclaration(element)); | 250 .buildDeclaration(element)); |
| 250 } | 251 } |
| 251 } | 252 } |
| OLD | NEW |