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

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

Issue 1343783002: dart2js ssa: Avoid tracking too much in load elimination (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 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/optimize.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 part of ssa; 5 part of ssa;
6 6
7 abstract class HVisitor<R> { 7 abstract class HVisitor<R> {
8 R visitAdd(HAdd node); 8 R visitAdd(HAdd node);
9 R visitAwait(HAwait node); 9 R visitAwait(HAwait node);
10 R visitBitAnd(HBitAnd node); 10 R visitBitAnd(HBitAnd node);
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 assert(instruction != list.first); 123 assert(instruction != list.first);
124 } 124 }
125 } 125 }
126 126
127 currentBlock = node; 127 currentBlock = node;
128 visitInstructionList(node); 128 visitInstructionList(node);
129 } 129 }
130 } 130 }
131 131
132 class HGraph { 132 class HGraph {
133 Element element; // Used for debug printing.
133 HBasicBlock entry; 134 HBasicBlock entry;
134 HBasicBlock exit; 135 HBasicBlock exit;
135 HThis thisInstruction; 136 HThis thisInstruction;
136 /// Receiver parameter, set for methods using interceptor calling convention. 137 /// Receiver parameter, set for methods using interceptor calling convention.
137 HParameterValue explicitReceiverParameter; 138 HParameterValue explicitReceiverParameter;
138 bool isRecursiveMethod = false; 139 bool isRecursiveMethod = false;
139 bool calledInLoop = false; 140 bool calledInLoop = false;
140 final List<HBasicBlock> blocks; 141 final List<HBasicBlock> blocks = <HBasicBlock>[];
141 142
142 // We canonicalize all constants used within a graph so we do not 143 // We canonicalize all constants used within a graph so we do not
143 // have to worry about them for global value numbering. 144 // have to worry about them for global value numbering.
144 Map<ConstantValue, HConstant> constants; 145 Map<ConstantValue, HConstant> constants = new Map<ConstantValue, HConstant>();
145 146
146 HGraph() 147 HGraph() {
147 : blocks = new List<HBasicBlock>(),
148 constants = new Map<ConstantValue, HConstant>() {
149 entry = addNewBlock(); 148 entry = addNewBlock();
150 // The exit block will be added later, so it has an id that is 149 // The exit block will be added later, so it has an id that is
151 // after all others in the system. 150 // after all others in the system.
152 exit = new HBasicBlock(); 151 exit = new HBasicBlock();
153 } 152 }
154 153
155 void addBlock(HBasicBlock block) { 154 void addBlock(HBasicBlock block) {
156 int id = blocks.length; 155 int id = blocks.length;
157 block.id = id; 156 block.id = id;
158 blocks.add(block); 157 blocks.add(block);
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 } 254 }
256 } 255 }
257 } 256 }
258 } 257 }
259 258
260 bool isValid() { 259 bool isValid() {
261 HValidator validator = new HValidator(); 260 HValidator validator = new HValidator();
262 validator.visitGraph(this); 261 validator.visitGraph(this);
263 return validator.isValid; 262 return validator.isValid;
264 } 263 }
264
265 toString() => 'HGraph($element)';
265 } 266 }
266 267
267 class HBaseVisitor extends HGraphVisitor implements HVisitor { 268 class HBaseVisitor extends HGraphVisitor implements HVisitor {
268 HBasicBlock currentBlock; 269 HBasicBlock currentBlock;
269 270
270 visitBasicBlock(HBasicBlock node) { 271 visitBasicBlock(HBasicBlock node) {
271 currentBlock = node; 272 currentBlock = node;
272 273
273 HInstruction instruction = node.first; 274 HInstruction instruction = node.first;
274 while (instruction != null) { 275 while (instruction != null) {
(...skipping 1601 matching lines...) Expand 10 before | Expand all | Expand 10 after
1876 /// type arguments. See also [SsaFromAstMixin.currentInlinedInstantiations]. 1877 /// type arguments. See also [SsaFromAstMixin.currentInlinedInstantiations].
1877 List<DartType> instantiatedTypes; 1878 List<DartType> instantiatedTypes;
1878 1879
1879 HForeignNew(this.element, TypeMask type, List<HInstruction> inputs, 1880 HForeignNew(this.element, TypeMask type, List<HInstruction> inputs,
1880 [this.instantiatedTypes]) 1881 [this.instantiatedTypes])
1881 : super(type, inputs); 1882 : super(type, inputs);
1882 1883
1883 accept(HVisitor visitor) => visitor.visitForeignNew(this); 1884 accept(HVisitor visitor) => visitor.visitForeignNew(this);
1884 1885
1885 bool get isAllocation => true; 1886 bool get isAllocation => true;
1887
1888 String toString() => 'HForeignNew($element)';
1886 } 1889 }
1887 1890
1888 abstract class HInvokeBinary extends HInstruction { 1891 abstract class HInvokeBinary extends HInstruction {
1889 final Selector selector; 1892 final Selector selector;
1890 HInvokeBinary( 1893 HInvokeBinary(
1891 HInstruction left, HInstruction right, this.selector, TypeMask type) 1894 HInstruction left, HInstruction right, this.selector, TypeMask type)
1892 : super(<HInstruction>[left, right], type) { 1895 : super(<HInstruction>[left, right], type) {
1893 sideEffects.clearAllSideEffects(); 1896 sideEffects.clearAllSideEffects();
1894 sideEffects.clearAllDependencies(); 1897 sideEffects.clearAllDependencies();
1895 setUseGvn(); 1898 setUseGvn();
(...skipping 1426 matching lines...) Expand 10 before | Expand all | Expand 10 after
3322 class HDynamicType extends HRuntimeType { 3325 class HDynamicType extends HRuntimeType {
3323 HDynamicType(DynamicType dartType, TypeMask instructionType) 3326 HDynamicType(DynamicType dartType, TypeMask instructionType)
3324 : super(const <HInstruction>[], dartType, instructionType); 3327 : super(const <HInstruction>[], dartType, instructionType);
3325 3328
3326 accept(HVisitor visitor) => visitor.visitDynamicType(this); 3329 accept(HVisitor visitor) => visitor.visitDynamicType(this);
3327 3330
3328 int typeCode() => HInstruction.DYNAMIC_TYPE_TYPECODE; 3331 int typeCode() => HInstruction.DYNAMIC_TYPE_TYPECODE;
3329 3332
3330 bool typeEquals(HInstruction other) => other is HDynamicType; 3333 bool typeEquals(HInstruction other) => other is HDynamicType;
3331 } 3334 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/ssa/builder.dart ('k') | pkg/compiler/lib/src/ssa/optimize.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698