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

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

Issue 2863073003: Access NativeData only through ClosedWorld (Closed)
Patch Set: Created 3 years, 7 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.dart ('k') | pkg/compiler/lib/src/ssa/graph_builder.dart » ('j') | 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 'dart:math' as math; 5 import 'dart:math' as math;
6 import 'dart:collection' show Queue; 6 import 'dart:collection' show Queue;
7 import '../common.dart'; 7 import '../common.dart';
8 import '../common/codegen.dart' show CodegenRegistry, CodegenWorkItem; 8 import '../common/codegen.dart' show CodegenRegistry, CodegenWorkItem;
9 import '../common/tasks.dart' show CompilerTask; 9 import '../common/tasks.dart' show CompilerTask;
10 import '../constants/constant_system.dart'; 10 import '../constants/constant_system.dart';
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 return measure(() { 73 return measure(() {
74 backend.tracer.traceGraph("codegen", graph); 74 backend.tracer.traceGraph("codegen", graph);
75 SourceInformation sourceInformation = sourceInformationFactory 75 SourceInformation sourceInformation = sourceInformationFactory
76 .createBuilderForContext(work.resolvedAst) 76 .createBuilderForContext(work.resolvedAst)
77 .buildDeclaration(work.resolvedAst); 77 .buildDeclaration(work.resolvedAst);
78 SsaCodeGenerator codegen = new SsaCodeGenerator( 78 SsaCodeGenerator codegen = new SsaCodeGenerator(
79 backend.compiler.options, 79 backend.compiler.options,
80 backend.emitter, 80 backend.emitter,
81 backend.nativeCodegenEnqueuer, 81 backend.nativeCodegenEnqueuer,
82 backend.checkedModeHelpers, 82 backend.checkedModeHelpers,
83 backend.nativeData,
84 backend.interceptorData, 83 backend.interceptorData,
85 backend.oneShotInterceptorData, 84 backend.oneShotInterceptorData,
86 backend.rtiSubstitutions, 85 backend.rtiSubstitutions,
87 backend.rtiEncoder, 86 backend.rtiEncoder,
88 backend.namer, 87 backend.namer,
89 backend.superMemberData, 88 backend.superMemberData,
90 closedWorld, 89 closedWorld,
91 work); 90 work);
92 codegen.visitGraph(graph); 91 codegen.visitGraph(graph);
93 return new js.Fun(codegen.parameters, codegen.body) 92 return new js.Fun(codegen.parameters, codegen.body)
94 .withSourceInformation(sourceInformation); 93 .withSourceInformation(sourceInformation);
95 }); 94 });
96 } 95 }
97 96
98 js.Expression generateMethod( 97 js.Expression generateMethod(
99 CodegenWorkItem work, HGraph graph, ClosedWorld closedWorld) { 98 CodegenWorkItem work, HGraph graph, ClosedWorld closedWorld) {
100 return measure(() { 99 return measure(() {
101 MethodElement element = work.element; 100 MethodElement element = work.element;
102 if (element.asyncMarker != AsyncMarker.SYNC) { 101 if (element.asyncMarker != AsyncMarker.SYNC) {
103 work.registry.registerAsyncMarker(element.asyncMarker); 102 work.registry.registerAsyncMarker(element.asyncMarker);
104 } 103 }
105 SsaCodeGenerator codegen = new SsaCodeGenerator( 104 SsaCodeGenerator codegen = new SsaCodeGenerator(
106 backend.compiler.options, 105 backend.compiler.options,
107 backend.emitter, 106 backend.emitter,
108 backend.nativeCodegenEnqueuer, 107 backend.nativeCodegenEnqueuer,
109 backend.checkedModeHelpers, 108 backend.checkedModeHelpers,
110 backend.nativeData,
111 backend.interceptorData, 109 backend.interceptorData,
112 backend.oneShotInterceptorData, 110 backend.oneShotInterceptorData,
113 backend.rtiSubstitutions, 111 backend.rtiSubstitutions,
114 backend.rtiEncoder, 112 backend.rtiEncoder,
115 backend.namer, 113 backend.namer,
116 backend.superMemberData, 114 backend.superMemberData,
117 closedWorld, 115 closedWorld,
118 work); 116 work);
119 codegen.visitGraph(graph); 117 codegen.visitGraph(graph);
120 backend.tracer.traceGraph("codegen", graph); 118 backend.tracer.traceGraph("codegen", graph);
(...skipping 25 matching lines...) Expand all
146 /** 144 /**
147 * Whether we are currently generating expressions instead of statements. 145 * Whether we are currently generating expressions instead of statements.
148 * This includes declarations, which are generated as expressions. 146 * This includes declarations, which are generated as expressions.
149 */ 147 */
150 bool isGeneratingExpression = false; 148 bool isGeneratingExpression = false;
151 149
152 final CompilerOptions _options; 150 final CompilerOptions _options;
153 final CodeEmitterTask _emitter; 151 final CodeEmitterTask _emitter;
154 final native.NativeCodegenEnqueuer _nativeEnqueuer; 152 final native.NativeCodegenEnqueuer _nativeEnqueuer;
155 final CheckedModeHelpers _checkedModeHelpers; 153 final CheckedModeHelpers _checkedModeHelpers;
156 final NativeData _nativeData;
157 final InterceptorData _interceptorData; 154 final InterceptorData _interceptorData;
158 final OneShotInterceptorData _oneShotInterceptorData; 155 final OneShotInterceptorData _oneShotInterceptorData;
159 final RuntimeTypesSubstitutions _rtiSubstitutions; 156 final RuntimeTypesSubstitutions _rtiSubstitutions;
160 final RuntimeTypesEncoder _rtiEncoder; 157 final RuntimeTypesEncoder _rtiEncoder;
161 final Namer _namer; 158 final Namer _namer;
162 final SuperMemberData _superMemberData; 159 final SuperMemberData _superMemberData;
163 final ClosedWorld _closedWorld; 160 final ClosedWorld _closedWorld;
164 final CodegenWorkItem _work; 161 final CodegenWorkItem _work;
165 162
166 final Set<HInstruction> generateAtUseSite; 163 final Set<HInstruction> generateAtUseSite;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 SubGraph subGraph; 201 SubGraph subGraph;
205 202
206 // Pending blocks than need to be visited as part of current subgraph. 203 // Pending blocks than need to be visited as part of current subgraph.
207 Queue<HBasicBlock> blockQueue; 204 Queue<HBasicBlock> blockQueue;
208 205
209 SsaCodeGenerator( 206 SsaCodeGenerator(
210 this._options, 207 this._options,
211 this._emitter, 208 this._emitter,
212 this._nativeEnqueuer, 209 this._nativeEnqueuer,
213 this._checkedModeHelpers, 210 this._checkedModeHelpers,
214 this._nativeData,
215 this._interceptorData, 211 this._interceptorData,
216 this._oneShotInterceptorData, 212 this._oneShotInterceptorData,
217 this._rtiSubstitutions, 213 this._rtiSubstitutions,
218 this._rtiEncoder, 214 this._rtiEncoder,
219 this._namer, 215 this._namer,
220 this._superMemberData, 216 this._superMemberData,
221 this._closedWorld, 217 this._closedWorld,
222 this._work, 218 this._work,
223 {SourceInformation sourceInformation}) 219 {SourceInformation sourceInformation})
224 : declaredLocals = new Set<String>(), 220 : declaredLocals = new Set<String>(),
225 collectedVariableDeclarations = new Set<String>(), 221 collectedVariableDeclarations = new Set<String>(),
226 currentContainer = new js.Block.empty(), 222 currentContainer = new js.Block.empty(),
227 parameters = <js.Parameter>[], 223 parameters = <js.Parameter>[],
228 expressionStack = <js.Expression>[], 224 expressionStack = <js.Expression>[],
229 oldContainerStack = <js.Block>[], 225 oldContainerStack = <js.Block>[],
230 generateAtUseSite = new Set<HInstruction>(), 226 generateAtUseSite = new Set<HInstruction>(),
231 controlFlowOperators = new Set<HInstruction>(), 227 controlFlowOperators = new Set<HInstruction>(),
232 breakAction = new Map<Entity, EntityAction>(), 228 breakAction = new Map<Entity, EntityAction>(),
233 continueAction = new Map<Entity, EntityAction>(); 229 continueAction = new Map<Entity, EntityAction>();
234 230
235 CodegenRegistry get _registry => _work.registry; 231 CodegenRegistry get _registry => _work.registry;
236 232
237 CommonElements get _commonElements => _closedWorld.commonElements; 233 CommonElements get _commonElements => _closedWorld.commonElements;
238 234
239 ConstantSystem get _constantSystem => _closedWorld.constantSystem; 235 ConstantSystem get _constantSystem => _closedWorld.constantSystem;
240 236
237 NativeData get _nativeData => _closedWorld.nativeData;
238
241 bool isGenerateAtUseSite(HInstruction instruction) { 239 bool isGenerateAtUseSite(HInstruction instruction) {
242 return generateAtUseSite.contains(instruction); 240 return generateAtUseSite.contains(instruction);
243 } 241 }
244 242
245 bool hasNonBitOpUser(HInstruction instruction, Set<HPhi> phiSet) { 243 bool hasNonBitOpUser(HInstruction instruction, Set<HPhi> phiSet) {
246 for (HInstruction user in instruction.usedBy) { 244 for (HInstruction user in instruction.usedBy) {
247 if (user is HPhi) { 245 if (user is HPhi) {
248 if (!phiSet.contains(user)) { 246 if (!phiSet.contains(user)) {
249 phiSet.add(user); 247 phiSet.add(user);
250 if (hasNonBitOpUser(user, phiSet)) return true; 248 if (hasNonBitOpUser(user, phiSet)) return true;
(...skipping 2788 matching lines...) Expand 10 before | Expand all | Expand 10 after
3039 return _closedWorld.anyStrictSubclassOf(cls, (ClassEntity subclass) { 3037 return _closedWorld.anyStrictSubclassOf(cls, (ClassEntity subclass) {
3040 return !_rtiSubstitutions.isTrivialSubstitution(subclass, cls); 3038 return !_rtiSubstitutions.isTrivialSubstitution(subclass, cls);
3041 }); 3039 });
3042 } 3040 }
3043 3041
3044 @override 3042 @override
3045 void visitRef(HRef node) { 3043 void visitRef(HRef node) {
3046 visit(node.value); 3044 visit(node.value);
3047 } 3045 }
3048 } 3046 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/ssa/builder.dart ('k') | pkg/compiler/lib/src/ssa/graph_builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698