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

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 1191 matching lines...) Expand 10 before | Expand all | Expand 10 after
1202 } 1202 }
1203 1203
1204 int typeCode() => 4; 1204 int typeCode() => 4;
1205 bool typeEquals(other) => other is HInvokeInterceptor; 1205 bool typeEquals(other) => other is HInvokeInterceptor;
1206 bool dataEquals(HInvokeInterceptor other) { 1206 bool dataEquals(HInvokeInterceptor other) {
1207 return getter == other.getter && name == other.name; 1207 return getter == other.getter && name == other.name;
1208 } 1208 }
1209 } 1209 }
1210 1210
1211 class HFieldGet extends HInstruction { 1211 class HFieldGet extends HInstruction {
1212 final Element element; 1212 final SourceString name;
1213 HFieldGet(Element this.element, HInstruction receiver) 1213 HFieldGet(SourceString this.name, HInstruction receiver)
1214 : super(<HInstruction>[receiver]); 1214 : super(<HInstruction>[receiver]);
1215 HFieldGet.fromActivation(Element this.element) : super(<HInstruction>[]); 1215 HFieldGet.fromActivation(SourceString this.name) : super(<HInstruction>[]);
1216 1216
1217 HInstruction get receiver() => inputs.length == 1 ? inputs[0] : null; 1217 HInstruction get receiver() => inputs.length == 1 ? inputs[0] : null;
1218 accept(HVisitor visitor) => visitor.visitFieldGet(this); 1218 accept(HVisitor visitor) => visitor.visitFieldGet(this);
1219
1220 void prepareGvn() {
1221 clearAllSideEffects();
1222 }
1223
1224 int typeCode() => 27;
1225 bool typeEquals(other) => other is HFieldGet;
1226 bool dataEquals(HFieldGet other) => name == other.name;
1219 } 1227 }
1220 1228
1221 class HFieldSet extends HInstruction { 1229 class HFieldSet extends HInstruction {
1222 final Element element; 1230 final SourceString name;
1223 HFieldSet(Element this.element, HInstruction receiver, HInstruction value) 1231 HFieldSet(SourceString this.name, HInstruction receiver, HInstruction value)
1224 : super(<HInstruction>[receiver, value]); 1232 : super(<HInstruction>[receiver, value]);
1225 HFieldSet.fromActivation(Element this.element, HInstruction value) 1233 HFieldSet.fromActivation(SourceString this.name, HInstruction value)
kasperl 2012/05/09 08:04:23 I think the spec has been updated to "infer" the t
ngeoffray 2012/05/09 10:07:58 OK, I removed the type on these constructors.
1226 : super(<HInstruction>[value]); 1234 : super(<HInstruction>[value]);
1227 1235
1228 HInstruction get receiver() => inputs.length == 2 ? inputs[0] : null; 1236 HInstruction get receiver() => inputs.length == 2 ? inputs[0] : null;
1229 HInstruction get value() => inputs.length == 2 ? inputs[1] : inputs[0]; 1237 HInstruction get value() => inputs.length == 2 ? inputs[1] : inputs[0];
1230 accept(HVisitor visitor) => visitor.visitFieldSet(this); 1238 accept(HVisitor visitor) => visitor.visitFieldSet(this);
1231 1239
1232 void prepareGvn() { 1240 void prepareGvn() {
1233 // TODO(ngeoffray): implement more fine grain side effects. 1241 // TODO(ngeoffray): implement more fine grain side effects.
1234 setAllSideEffects(); 1242 setAllSideEffects();
1235 } 1243 }
(...skipping 1213 matching lines...) Expand 10 before | Expand all | Expand 10 after
2449 this.catchBlock, 2457 this.catchBlock,
2450 this.finallyBlock); 2458 this.finallyBlock);
2451 2459
2452 HBasicBlock get start() => body.start; 2460 HBasicBlock get start() => body.start;
2453 HBasicBlock get end() => 2461 HBasicBlock get end() =>
2454 finallyBlock === null ? catchBlock.end : finallyBlock.end; 2462 finallyBlock === null ? catchBlock.end : finallyBlock.end;
2455 2463
2456 bool accept(HStatementInformationVisitor visitor) => 2464 bool accept(HStatementInformationVisitor visitor) =>
2457 visitor.visitTryInfo(this); 2465 visitor.visitTryInfo(this);
2458 } 2466 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698