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

Side by Side Diff: pkg/compiler/lib/src/inferrer/type_graph_inferrer.dart

Issue 2991313002: Split ast based parts from InferrerEngineImpl (Closed)
Patch Set: Created 3 years, 4 months 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
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 library type_graph_inferrer; 5 library type_graph_inferrer;
6 6
7 import 'dart:collection' show Queue; 7 import 'dart:collection' show Queue;
8 8
9 import '../compiler.dart' show Compiler; 9 import '../compiler.dart' show Compiler;
10 import '../elements/elements.dart'; 10 import '../elements/elements.dart';
11 import '../elements/entities.dart'; 11 import '../elements/entities.dart';
12 import '../tree/tree.dart' as ast show Node; 12 import '../tree/tree.dart' as ast show Node;
13 import '../types/masks.dart' 13 import '../types/masks.dart'
14 show CommonMasks, ContainerTypeMask, MapTypeMask, TypeMask; 14 show CommonMasks, ContainerTypeMask, MapTypeMask, TypeMask;
15 import '../types/types.dart' show TypesInferrer; 15 import '../types/types.dart' show TypesInferrer;
16 import '../universe/selector.dart' show Selector; 16 import '../universe/selector.dart' show Selector;
17 import '../world.dart' show ClosedWorld, ClosedWorldRefiner; 17 import '../world.dart' show ClosedWorld, ClosedWorldRefiner;
18 import 'ast_inferrer_engine.dart';
18 import 'inferrer_engine.dart'; 19 import 'inferrer_engine.dart';
19 import 'type_graph_nodes.dart'; 20 import 'type_graph_nodes.dart';
20 21
21 /** 22 /**
22 * A work queue for the inferrer. It filters out nodes that are tagged as 23 * A work queue for the inferrer. It filters out nodes that are tagged as
23 * [TypeInformation.doNotEnqueue], as well as ensures through 24 * [TypeInformation.doNotEnqueue], as well as ensures through
24 * [TypeInformation.inQueue] that a node is in the queue only once at 25 * [TypeInformation.inQueue] that a node is in the queue only once at
25 * a time. 26 * a time.
26 */ 27 */
27 class WorkQueue { 28 class WorkQueue {
(...skipping 30 matching lines...) Expand all
58 TypeGraphInferrer(this.compiler, this.closedWorld, this.closedWorldRefiner); 59 TypeGraphInferrer(this.compiler, this.closedWorld, this.closedWorldRefiner);
59 60
60 String get name => 'Graph inferrer'; 61 String get name => 'Graph inferrer';
61 62
62 CommonMasks get commonMasks => closedWorld.commonMasks; 63 CommonMasks get commonMasks => closedWorld.commonMasks;
63 64
64 TypeMask get _dynamicType => commonMasks.dynamicType; 65 TypeMask get _dynamicType => commonMasks.dynamicType;
65 66
66 void analyzeMain(FunctionEntity main) { 67 void analyzeMain(FunctionEntity main) {
67 inferrer = 68 inferrer =
68 new InferrerEngineImpl(compiler, closedWorld, closedWorldRefiner, main); 69 new AstInferrerEngine(compiler, closedWorld, closedWorldRefiner, main);
69 inferrer.runOverAllElements(); 70 inferrer.runOverAllElements();
70 } 71 }
71 72
72 TypeMask getReturnTypeOfMember(MemberElement element) { 73 TypeMask getReturnTypeOfMember(MemberElement element) {
73 if (compiler.disableTypeInference) return _dynamicType; 74 if (compiler.disableTypeInference) return _dynamicType;
74 // Currently, closure calls return dynamic. 75 // Currently, closure calls return dynamic.
75 if (element is! MethodElement) return _dynamicType; 76 if (element is! MethodElement) return _dynamicType;
76 return inferrer.types.getInferredTypeOfMember(element).type; 77 return inferrer.types.getInferredTypeOfMember(element).type;
77 } 78 }
78 79
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 if (compiler.disableTypeInference) return false; 149 if (compiler.disableTypeInference) return false;
149 MemberTypeInformation info = 150 MemberTypeInformation info =
150 inferrer.types.getInferredTypeOfMember(element); 151 inferrer.types.getInferredTypeOfMember(element);
151 return info.isCalledOnce(); 152 return info.isCalledOnce();
152 } 153 }
153 154
154 void clear() { 155 void clear() {
155 inferrer.clear(); 156 inferrer.clear();
156 } 157 }
157 } 158 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/inferrer/inferrer_engine.dart ('k') | pkg/compiler/lib/src/inferrer/type_graph_nodes.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698