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

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

Issue 10452029: Fix bug when a variable is used in try/catch and accessed trough HFieldGet and HFieldSet: reference… (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 1197 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 SourceString name; 1215 final SourceString name;
1216 HFieldGet(this.name, HInstruction receiver) 1216 HFieldGet(this.name, HInstruction receiver)
1217 : super(<HInstruction>[receiver]); 1217 : super(<HInstruction>[receiver]);
1218 HFieldGet.fromActivation(this.name) : super(<HInstruction>[]); 1218 HFieldGet.fromActivation(receiver) : this(null, receiver);
1219 1219
1220 HInstruction get receiver() => inputs.length == 1 ? inputs[0] : null; 1220 HInstruction get receiver() => inputs.length == 1 ? inputs[0] : null;
1221 bool isFromActivation() => name === null;
1222
1221 accept(HVisitor visitor) => visitor.visitFieldGet(this); 1223 accept(HVisitor visitor) => visitor.visitFieldGet(this);
1222 1224
1223 void prepareGvn() { 1225 void prepareGvn() {
1224 clearAllSideEffects(); 1226 clearAllSideEffects();
1225 } 1227 }
1226 1228
1227 int typeCode() => 27; 1229 int typeCode() => 27;
1228 bool typeEquals(other) => other is HFieldGet; 1230 bool typeEquals(other) => other is HFieldGet;
1229 bool dataEquals(HFieldGet other) => name == other.name; 1231 bool dataEquals(HFieldGet other) => name == other.name;
1230 } 1232 }
1231 1233
1232 class HFieldSet extends HInstruction { 1234 class HFieldSet extends HInstruction {
1233 final SourceString name; 1235 final SourceString name;
1234 HFieldSet(this.name, HInstruction receiver, HInstruction value) 1236 HFieldSet(this.name, HInstruction receiver, HInstruction value)
1235 : super(<HInstruction>[receiver, value]); 1237 : super(<HInstruction>[receiver, value]);
1236 HFieldSet.fromActivation(this.name, HInstruction value) 1238 HFieldSet.fromActivation(receiver, value)
1237 : super(<HInstruction>[value]); 1239 : this(null, receiver, value);
1238 1240
1239 HInstruction get receiver() => inputs.length == 2 ? inputs[0] : null; 1241 HInstruction get receiver() => inputs.length == 2 ? inputs[0] : null;
1240 HInstruction get value() => inputs.length == 2 ? inputs[1] : inputs[0]; 1242 HInstruction get value() => inputs.length == 2 ? inputs[1] : inputs[0];
1241 accept(HVisitor visitor) => visitor.visitFieldSet(this); 1243 accept(HVisitor visitor) => visitor.visitFieldSet(this);
1244 bool isFromActivation() => name === null;
1242 1245
1243 void prepareGvn() { 1246 void prepareGvn() {
1244 // TODO(ngeoffray): implement more fine grain side effects. 1247 // TODO(ngeoffray): implement more fine grain side effects.
1245 setAllSideEffects(); 1248 setAllSideEffects();
1246 } 1249 }
1247 } 1250 }
1248 1251
1249 class HForeign extends HInstruction { 1252 class HForeign extends HInstruction {
1250 final DartString code; 1253 final DartString code;
1251 final HType foreignType; 1254 final HType foreignType;
(...skipping 1215 matching lines...) Expand 10 before | Expand all | Expand 10 after
2467 this.catchBlock, 2470 this.catchBlock,
2468 this.finallyBlock); 2471 this.finallyBlock);
2469 2472
2470 HBasicBlock get start() => body.start; 2473 HBasicBlock get start() => body.start;
2471 HBasicBlock get end() => 2474 HBasicBlock get end() =>
2472 finallyBlock === null ? catchBlock.end : finallyBlock.end; 2475 finallyBlock === null ? catchBlock.end : finallyBlock.end;
2473 2476
2474 bool accept(HStatementInformationVisitor visitor) => 2477 bool accept(HStatementInformationVisitor visitor) =>
2475 visitor.visitTryInfo(this); 2478 visitor.visitTryInfo(this);
2476 } 2479 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698