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

Side by Side Diff: lib/compiler/implementation/ssa/nodes.dart

Issue 10383065: Start creating a MemberSet abstraction, and use it to fold getters/setters into field accesses. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 interface HVisitor<R> { 5 interface HVisitor<R> {
6 R visitAdd(HAdd node); 6 R visitAdd(HAdd node);
7 R visitBitAnd(HBitAnd node); 7 R visitBitAnd(HBitAnd node);
8 R visitBitNot(HBitNot node); 8 R visitBitNot(HBitNot node);
9 R visitBitOr(HBitOr node); 9 R visitBitOr(HBitOr node);
10 R visitBitXor(HBitXor node); 10 R visitBitXor(HBitXor node);
(...skipping 1194 matching lines...) Expand 10 before | Expand all | Expand 10 after
1205 } 1205 }
1206 1206
1207 int typeCode() => 4; 1207 int typeCode() => 4;
1208 bool typeEquals(other) => other is HInvokeInterceptor; 1208 bool typeEquals(other) => other is HInvokeInterceptor;
1209 bool dataEquals(HInvokeInterceptor other) { 1209 bool dataEquals(HInvokeInterceptor other) {
1210 return getter == other.getter && name == other.name; 1210 return getter == other.getter && name == other.name;
1211 } 1211 }
1212 } 1212 }
1213 1213
1214 class HFieldGet extends HInstruction { 1214 class HFieldGet extends HInstruction {
1215 final Element element; 1215 final SourceString name;
1216 HFieldGet(Element this.element, HInstruction receiver) 1216 HFieldGet(this.name, HInstruction receiver)
1217 : super(<HInstruction>[receiver]); 1217 : super(<HInstruction>[receiver]);
1218 HFieldGet.fromActivation(Element this.element) : super(<HInstruction>[]); 1218 HFieldGet.fromActivation(this.name) : super(<HInstruction>[]);
1219 1219
1220 HInstruction get receiver() => inputs.length == 1 ? inputs[0] : null; 1220 HInstruction get receiver() => inputs.length == 1 ? inputs[0] : null;
1221 accept(HVisitor visitor) => visitor.visitFieldGet(this); 1221 accept(HVisitor visitor) => visitor.visitFieldGet(this);
1222
1223 void prepareGvn() {
1224 clearAllSideEffects();
1225 }
1226
1227 int typeCode() => 27;
1228 bool typeEquals(other) => other is HFieldGet;
1229 bool dataEquals(HFieldGet other) => name == other.name;
1222 } 1230 }
1223 1231
1224 class HFieldSet extends HInstruction { 1232 class HFieldSet extends HInstruction {
1225 final Element element; 1233 final SourceString name;
1226 HFieldSet(Element this.element, HInstruction receiver, HInstruction value) 1234 HFieldSet(this.name, HInstruction receiver, HInstruction value)
1227 : super(<HInstruction>[receiver, value]); 1235 : super(<HInstruction>[receiver, value]);
1228 HFieldSet.fromActivation(Element this.element, HInstruction value) 1236 HFieldSet.fromActivation(this.name, HInstruction value)
1229 : super(<HInstruction>[value]); 1237 : super(<HInstruction>[value]);
1230 1238
1231 HInstruction get receiver() => inputs.length == 2 ? inputs[0] : null; 1239 HInstruction get receiver() => inputs.length == 2 ? inputs[0] : null;
1232 HInstruction get value() => inputs.length == 2 ? inputs[1] : inputs[0]; 1240 HInstruction get value() => inputs.length == 2 ? inputs[1] : inputs[0];
1233 accept(HVisitor visitor) => visitor.visitFieldSet(this); 1241 accept(HVisitor visitor) => visitor.visitFieldSet(this);
1234 1242
1235 void prepareGvn() { 1243 void prepareGvn() {
1236 // TODO(ngeoffray): implement more fine grain side effects. 1244 // TODO(ngeoffray): implement more fine grain side effects.
1237 setAllSideEffects(); 1245 setAllSideEffects();
1238 } 1246 }
(...skipping 1215 matching lines...) Expand 10 before | Expand all | Expand 10 after
2454 this.catchBlock, 2462 this.catchBlock,
2455 this.finallyBlock); 2463 this.finallyBlock);
2456 2464
2457 HBasicBlock get start() => body.start; 2465 HBasicBlock get start() => body.start;
2458 HBasicBlock get end() => 2466 HBasicBlock get end() =>
2459 finallyBlock === null ? catchBlock.end : finallyBlock.end; 2467 finallyBlock === null ? catchBlock.end : finallyBlock.end;
2460 2468
2461 bool accept(HStatementInformationVisitor visitor) => 2469 bool accept(HStatementInformationVisitor visitor) =>
2462 visitor.visitTryInfo(this); 2470 visitor.visitTryInfo(this);
2463 } 2471 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/ssa/codegen.dart ('k') | lib/compiler/implementation/ssa/optimize.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698