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

Side by Side Diff: pkg/compiler/lib/src/ssa/graph_builder.dart

Issue 2808683003: Remove most direct uses of 'backend' and 'compiler' in GraphBuilder. (Closed)
Patch Set: Created 3 years, 8 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
« no previous file with comments | « pkg/compiler/lib/src/ssa/builder_kernel.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 '../constants/constant_system.dart';
6 import '../common/codegen.dart' show CodegenRegistry; 7 import '../common/codegen.dart' show CodegenRegistry;
7 import '../common_elements.dart'; 8 import '../common_elements.dart';
8 import '../compiler.dart'; 9 import '../compiler.dart';
9 import '../diagnostics/diagnostic_listener.dart'; 10 import '../diagnostics/diagnostic_listener.dart';
10 import '../elements/elements.dart'; 11 import '../elements/elements.dart';
11 import '../elements/entities.dart' show Entity, Local; 12 import '../elements/entities.dart' show Entity, Local;
12 import '../elements/resolution_types.dart'; 13 import '../elements/resolution_types.dart';
14 import '../js_backend/backend_helpers.dart';
15 import '../js_backend/backend_usage.dart';
16 import '../js_backend/constant_handler_javascript.dart';
13 import '../js_backend/js_backend.dart'; 17 import '../js_backend/js_backend.dart';
18 import '../js_backend/native_data.dart';
19 import '../js_backend/js_interop_analysis.dart';
20 import '../js_backend/interceptor_data.dart';
21 import '../js_backend/mirrors_data.dart';
22 import '../js_emitter/code_emitter_task.dart';
14 import '../options.dart'; 23 import '../options.dart';
15 import '../resolution/tree_elements.dart'; 24 import '../resolution/tree_elements.dart';
16 import '../types/types.dart'; 25 import '../types/types.dart';
17 import '../world.dart' show ClosedWorld; 26 import '../world.dart' show ClosedWorld;
18 import 'jump_handler.dart'; 27 import 'jump_handler.dart';
19 import 'locals_handler.dart'; 28 import 'locals_handler.dart';
20 import 'nodes.dart'; 29 import 'nodes.dart';
21 import 'type_builder.dart'; 30 import 'type_builder.dart';
22 31
23 /// Base class for objects that build up an SSA graph. 32 /// Base class for objects that build up an SSA graph.
(...skipping 24 matching lines...) Expand all
48 ClosedWorld get closedWorld; 57 ClosedWorld get closedWorld;
49 58
50 CommonMasks get commonMasks => closedWorld.commonMasks; 59 CommonMasks get commonMasks => closedWorld.commonMasks;
51 60
52 DiagnosticReporter get reporter => backend.reporter; 61 DiagnosticReporter get reporter => backend.reporter;
53 62
54 CompilerOptions get options => compiler.options; 63 CompilerOptions get options => compiler.options;
55 64
56 CommonElements get commonElements => closedWorld.commonElements; 65 CommonElements get commonElements => closedWorld.commonElements;
57 66
67 CodeEmitterTask get emitter => backend.emitter;
68
58 GlobalTypeInferenceResults get globalInferenceResults => 69 GlobalTypeInferenceResults get globalInferenceResults =>
59 compiler.globalInference.results; 70 compiler.globalInference.results;
60 71
61 ClosureTask get closureToClassMapper => compiler.closureToClassMapper; 72 ClosureTask get closureToClassMapper => compiler.closureToClassMapper;
62 73
74 NativeData get nativeData => backend.nativeData;
75
76 InterceptorData get interceptorData => backend.interceptorData;
77
78 BackendUsage get backendUsage => backend.backendUsage;
79
80 Namer get namer => backend.namer;
81
82 RuntimeTypesNeed get rtiNeed => backend.rtiNeed;
83
84 JavaScriptConstantCompiler get constants => backend.constants;
85
86 ConstantSystem get constantSystem => constants.constantSystem;
87
88 BackendHelpers get helpers => backend.helpers;
89
90 RuntimeTypesEncoder get rtiEncoder => backend.rtiEncoder;
91
92 FunctionInlineCache get inlineCache => backend.inlineCache;
93
94 MirrorsData get mirrorsData => backend.mirrorsData;
95
96 JsInteropAnalysis get jsInteropAnalysis => backend.jsInteropAnalysis;
97
63 /// Used to track the locals while building the graph. 98 /// Used to track the locals while building the graph.
64 LocalsHandler localsHandler; 99 LocalsHandler localsHandler;
65 100
66 /// A stack of instructions. 101 /// A stack of instructions.
67 /// 102 ///
68 /// We build the SSA graph by simulating a stack machine. 103 /// We build the SSA graph by simulating a stack machine.
69 List<HInstruction> stack = <HInstruction>[]; 104 List<HInstruction> stack = <HInstruction>[];
70 105
71 /// The count of nested loops we are currently building. 106 /// The count of nested loops we are currently building.
72 /// 107 ///
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 // TODO(karlklose): this is needed to avoid a bug where the resolved type is 243 // TODO(karlklose): this is needed to avoid a bug where the resolved type is
209 // not stored on a type annotation in the closure translator. Remove when 244 // not stored on a type annotation in the closure translator. Remove when
210 // fixed. 245 // fixed.
211 bool hasDirectLocal(Local local) { 246 bool hasDirectLocal(Local local) {
212 return !localsHandler.isAccessedDirectly(local) || 247 return !localsHandler.isAccessedDirectly(local) ||
213 localsHandler.directLocals[local] != null; 248 localsHandler.directLocals[local] != null;
214 } 249 }
215 250
216 HInstruction callSetRuntimeTypeInfoWithTypeArguments(ResolutionDartType type, 251 HInstruction callSetRuntimeTypeInfoWithTypeArguments(ResolutionDartType type,
217 List<HInstruction> rtiInputs, HInstruction newObject) { 252 List<HInstruction> rtiInputs, HInstruction newObject) {
218 if (!backend.rtiNeed.classNeedsRti(type.element)) { 253 if (!rtiNeed.classNeedsRti(type.element)) {
219 return newObject; 254 return newObject;
220 } 255 }
221 256
222 HInstruction typeInfo = new HTypeInfoExpression( 257 HInstruction typeInfo = new HTypeInfoExpression(
223 TypeInfoExpressionKind.INSTANCE, 258 TypeInfoExpressionKind.INSTANCE,
224 (type.element as ClassElement).thisType, 259 (type.element as ClassElement).thisType,
225 rtiInputs, 260 rtiInputs,
226 closedWorld.commonMasks.dynamicType); 261 closedWorld.commonMasks.dynamicType);
227 add(typeInfo); 262 add(typeInfo);
228 return callSetRuntimeTypeInfo(typeInfo, newObject); 263 return callSetRuntimeTypeInfo(typeInfo, newObject);
229 } 264 }
230 265
231 /// Called when control flow is about to change, in which case we need to 266 /// Called when control flow is about to change, in which case we need to
232 /// specify special successors if we are already in a try/catch/finally block. 267 /// specify special successors if we are already in a try/catch/finally block.
233 void handleInTryStatement() { 268 void handleInTryStatement() {
234 if (!inTryStatement) return; 269 if (!inTryStatement) return;
235 HBasicBlock block = close(new HExitTry()); 270 HBasicBlock block = close(new HExitTry());
236 HBasicBlock newBlock = graph.addNewBlock(); 271 HBasicBlock newBlock = graph.addNewBlock();
237 block.addSuccessor(newBlock); 272 block.addSuccessor(newBlock);
238 open(newBlock); 273 open(newBlock);
239 } 274 }
240 275
241 HInstruction callSetRuntimeTypeInfo( 276 HInstruction callSetRuntimeTypeInfo(
242 HInstruction typeInfo, HInstruction newObject); 277 HInstruction typeInfo, HInstruction newObject);
243 278
244 /// The element for which this SSA builder is being used. 279 /// The element for which this SSA builder is being used.
245 Element get targetElement; 280 Element get targetElement;
246 TypeBuilder get typeBuilder; 281 TypeBuilder get typeBuilder;
247 } 282 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/ssa/builder_kernel.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698