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

Unified Diff: frog/leg/ssa/bailout.dart

Issue 9372107: A return and a throw should empty the environment. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/language/src/ReturnInLoopTest.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: frog/leg/ssa/bailout.dart
===================================================================
--- frog/leg/ssa/bailout.dart (revision 4468)
+++ frog/leg/ssa/bailout.dart (working copy)
@@ -37,15 +37,14 @@
}
List<HInstruction> buildAndSetLast(HInstruction instruction) {
- remove(instruction);
floitsch 2012/02/22 17:22:32 keep.
List<HInstruction> result = new List<HInstruction>.from(lives);
result.addLast(instruction);
- add(instruction);
return result;
}
bool isEmpty() => lives.isEmpty();
bool contains(HInstruction instruction) => lives.contains(instruction);
+ void clear() => lives.clear();
}
/**
@@ -200,9 +199,17 @@
// Deal with all kinds of control flow instructions. In case we add
// a new one, we will hit an internal error.
void visitExit(HExit exit) {}
- void visitReturn(HReturn instruction) {}
- void visitThrow(HThrow instruction) {}
+ void visitReturn(HReturn instruction) {
+ environment.clear();
+ visitInstruction(instruction);
+ }
+
+ void visitThrow(HThrow instruction) {
+ environment.clear();
+ visitInstruction(instruction);
+ }
+
void visitControlFlow(HControlFlow instruction) {
compiler.internalError('Control flow instructions already dealt with.',
instruction: instruction);
@@ -217,8 +224,8 @@
SsaTypeGuardBuilder(Compiler compiler) : super(compiler);
- HInstruction tryInsertTypeGuard(HInstruction instruction,
- HInstruction insertionPoint) {
+ void tryInsertTypeGuard(HInstruction instruction,
+ HInstruction insertionPoint) {
// If we found a type for the instruction, but the instruction
// does not know if it produces that type, add a type guard.
if (instruction.type.isKnown() && !instruction.hasExpectedType()) {
« no previous file with comments | « no previous file | tests/language/src/ReturnInLoopTest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698