| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 import '../closure.dart'; | 5 import '../closure.dart'; |
| 6 import '../common.dart'; | 6 import '../common.dart'; |
| 7 import '../common/codegen.dart' show CodegenRegistry; | 7 import '../common/codegen.dart' show CodegenRegistry; |
| 8 import '../compiler.dart'; | 8 import '../compiler.dart'; |
| 9 import '../constants/constant_system.dart'; | 9 import '../constants/constant_system.dart'; |
| 10 import '../elements/resolution_types.dart'; | 10 import '../elements/resolution_types.dart'; |
| 11 import '../elements/elements.dart'; | 11 import '../elements/elements.dart'; |
| 12 import '../io/source_information.dart'; | 12 import '../io/source_information.dart'; |
| 13 import '../js_backend/js_backend.dart'; | 13 import '../js_backend/js_backend.dart'; |
| 14 import '../resolution/tree_elements.dart'; |
| 14 import '../tree/tree.dart' as ast; | 15 import '../tree/tree.dart' as ast; |
| 15 import '../types/types.dart'; | 16 import '../types/types.dart'; |
| 16 import '../universe/call_structure.dart' show CallStructure; | 17 import '../universe/call_structure.dart' show CallStructure; |
| 17 import '../universe/use.dart' show TypeUse; | 18 import '../universe/use.dart' show TypeUse; |
| 18 import '../world.dart' show ClosedWorld; | 19 import '../world.dart' show ClosedWorld; |
| 19 import 'jump_handler.dart'; | 20 import 'jump_handler.dart'; |
| 20 import 'locals_handler.dart'; | 21 import 'locals_handler.dart'; |
| 21 import 'nodes.dart'; | 22 import 'nodes.dart'; |
| 22 import 'ssa_branch_builder.dart'; | 23 import 'ssa_branch_builder.dart'; |
| 23 import 'type_builder.dart'; | 24 import 'type_builder.dart'; |
| 24 | 25 |
| 25 /// Base class for objects that build up an SSA graph. | 26 /// Base class for objects that build up an SSA graph. |
| 26 /// | 27 /// |
| 27 /// This contains helpers for building the graph and tracking information about | 28 /// This contains helpers for building the graph and tracking information about |
| 28 /// the current state of the graph being built. | 29 /// the current state of the graph being built. |
| 29 abstract class GraphBuilder { | 30 abstract class GraphBuilder { |
| 30 /// Holds the resulting SSA graph. | 31 /// Holds the resulting SSA graph. |
| 31 final HGraph graph = new HGraph(); | 32 final HGraph graph = new HGraph(); |
| 32 | 33 |
| 33 // TODO(het): remove this | 34 // TODO(het): remove this |
| 34 /// A reference to the compiler. | 35 /// A reference to the compiler. |
| 35 Compiler compiler; | 36 Compiler compiler; |
| 36 | 37 |
| 37 /// The JavaScript backend we are targeting in this compilation. | 38 /// The JavaScript backend we are targeting in this compilation. |
| 38 JavaScriptBackend get backend; | 39 JavaScriptBackend get backend; |
| 39 | 40 |
| 41 /// The tree elements for the element being built into an SSA graph. |
| 42 TreeElements get elements; |
| 43 |
| 40 CodegenRegistry get registry; | 44 CodegenRegistry get registry; |
| 41 | 45 |
| 42 ClosedWorld get closedWorld; | 46 ClosedWorld get closedWorld; |
| 43 | 47 |
| 44 CommonMasks get commonMasks => closedWorld.commonMasks; | 48 CommonMasks get commonMasks => closedWorld.commonMasks; |
| 45 | 49 |
| 46 GlobalTypeInferenceResults get globalInferenceResults => | 50 GlobalTypeInferenceResults get globalInferenceResults => |
| 47 compiler.globalInference.results; | 51 compiler.globalInference.results; |
| 48 | 52 |
| 49 /// Used to track the locals while building the graph. | 53 /// Used to track the locals while building the graph. |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 if (unaliased is ResolutionTypedefType) throw 'unable to unalias $type'; | 331 if (unaliased is ResolutionTypedefType) throw 'unable to unalias $type'; |
| 328 unaliased.accept(this, builder); | 332 unaliased.accept(this, builder); |
| 329 } | 333 } |
| 330 | 334 |
| 331 void visitDynamicType(ResolutionDynamicType type, GraphBuilder builder) { | 335 void visitDynamicType(ResolutionDynamicType type, GraphBuilder builder) { |
| 332 JavaScriptBackend backend = builder.compiler.backend; | 336 JavaScriptBackend backend = builder.compiler.backend; |
| 333 ClassElement cls = backend.helpers.DynamicRuntimeType; | 337 ClassElement cls = backend.helpers.DynamicRuntimeType; |
| 334 builder.push(new HDynamicType(type, new TypeMask.exact(cls, closedWorld))); | 338 builder.push(new HDynamicType(type, new TypeMask.exact(cls, closedWorld))); |
| 335 } | 339 } |
| 336 } | 340 } |
| OLD | NEW |