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

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

Issue 10511008: Support overriding fields with fields. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased Created 8 years, 6 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 1203 matching lines...) Expand 10 before | Expand all | Expand 10 after
1214 } 1214 }
1215 } 1215 }
1216 1216
1217 int typeCode() => 4; 1217 int typeCode() => 4;
1218 bool typeEquals(other) => other is HInvokeInterceptor; 1218 bool typeEquals(other) => other is HInvokeInterceptor;
1219 bool dataEquals(HInvokeInterceptor other) { 1219 bool dataEquals(HInvokeInterceptor other) {
1220 return getter == other.getter && name == other.name; 1220 return getter == other.getter && name == other.name;
1221 } 1221 }
1222 } 1222 }
1223 1223
1224 class HFieldGet extends HInstruction { 1224 abstract class HFieldAccess extends HInstruction {
1225 // TODO(ngeoffray): Should [name] be an element? 1225 final Element element;
1226 final SourceString name; 1226
1227 HFieldAccess(this.element, List<HInstruction> inputs) : super(inputs);
1228
1229 bool isFromActivation() => element === null;
1230 }
1231
1232 class HFieldGet extends HFieldAccess {
1227 final bool isFinalOrConst; 1233 final bool isFinalOrConst;
1228 HFieldGet(this.name, HInstruction receiver, [this.isFinalOrConst = false]) 1234
1229 : super(<HInstruction>[receiver]); 1235 HFieldGet(Element element, HInstruction receiver,
1236 [this.isFinalOrConst = false])
1237 : super(element, <HInstruction>[receiver]);
1230 HFieldGet.fromActivation(receiver) : this(null, receiver); 1238 HFieldGet.fromActivation(receiver) : this(null, receiver);
1231 1239
1232 HInstruction get receiver() => inputs.length == 1 ? inputs[0] : null; 1240 HInstruction get receiver() => inputs.length == 1 ? inputs[0] : null;
1233 bool isFromActivation() => name === null;
1234 1241
1235 accept(HVisitor visitor) => visitor.visitFieldGet(this); 1242 accept(HVisitor visitor) => visitor.visitFieldGet(this);
1236 1243
1237 void prepareGvn() { 1244 void prepareGvn() {
1238 if (isFinalOrConst) { 1245 if (isFinalOrConst) {
1239 assert(!hasSideEffects()); 1246 assert(!hasSideEffects());
1240 setUseGvn(); 1247 setUseGvn();
1241 } else { 1248 } else {
1242 clearAllSideEffects(); 1249 clearAllSideEffects();
1243 } 1250 }
1244 } 1251 }
1245 1252
1246 int typeCode() => 27; 1253 int typeCode() => 27;
1247 bool typeEquals(other) => other is HFieldGet; 1254 bool typeEquals(other) => other is HFieldGet;
1248 bool dataEquals(HFieldGet other) => name == other.name; 1255 bool dataEquals(HFieldGet other) => element == other.element;
1249 } 1256 }
1250 1257
1251 class HFieldSet extends HInstruction { 1258 class HFieldSet extends HFieldAccess {
1252 final SourceString name; 1259 HFieldSet(Element element, HInstruction receiver, HInstruction value)
1253 HFieldSet(this.name, HInstruction receiver, HInstruction value) 1260 : super(element, <HInstruction>[receiver, value]);
1254 : super(<HInstruction>[receiver, value]);
1255 HFieldSet.fromActivation(receiver, value) 1261 HFieldSet.fromActivation(receiver, value)
1256 : this(null, receiver, value); 1262 : this(null, receiver, value);
1257 1263
1258 HInstruction get receiver() => inputs.length == 2 ? inputs[0] : null; 1264 HInstruction get receiver() => inputs.length == 2 ? inputs[0] : null;
1259 HInstruction get value() => inputs.length == 2 ? inputs[1] : inputs[0]; 1265 HInstruction get value() => inputs.length == 2 ? inputs[1] : inputs[0];
1260 accept(HVisitor visitor) => visitor.visitFieldSet(this); 1266 accept(HVisitor visitor) => visitor.visitFieldSet(this);
1261 bool isFromActivation() => name === null;
1262 1267
1263 void prepareGvn() { 1268 void prepareGvn() {
1264 // TODO(ngeoffray): implement more fine grain side effects. 1269 // TODO(ngeoffray): implement more fine grain side effects.
1265 setAllSideEffects(); 1270 setAllSideEffects();
1266 } 1271 }
1267 } 1272 }
1268 1273
1269 class HForeign extends HInstruction { 1274 class HForeign extends HInstruction {
1270 final DartString code; 1275 final DartString code;
1271 final HType foreignType; 1276 final HType foreignType;
(...skipping 1214 matching lines...) Expand 10 before | Expand all | Expand 10 after
2486 this.catchBlock, 2491 this.catchBlock,
2487 this.finallyBlock); 2492 this.finallyBlock);
2488 2493
2489 HBasicBlock get start() => body.start; 2494 HBasicBlock get start() => body.start;
2490 HBasicBlock get end() => 2495 HBasicBlock get end() =>
2491 finallyBlock === null ? catchBlock.end : finallyBlock.end; 2496 finallyBlock === null ? catchBlock.end : finallyBlock.end;
2492 2497
2493 bool accept(HStatementInformationVisitor visitor) => 2498 bool accept(HStatementInformationVisitor visitor) =>
2494 visitor.visitTryInfo(this); 2499 visitor.visitTryInfo(this);
2495 } 2500 }
OLDNEW
« no previous file with comments | « dart/lib/compiler/implementation/ssa/codegen.dart ('k') | dart/lib/compiler/implementation/ssa/optimize.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698