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

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

Issue 9351020: Implement try/catch without finally, and without type checks. (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
Index: frog/leg/ssa/nodes.dart
===================================================================
--- frog/leg/ssa/nodes.dart (revision 3986)
+++ frog/leg/ssa/nodes.dart (working copy)
@@ -58,6 +58,7 @@
R visitThis(HThis node);
R visitThrow(HThrow node);
R visitTruncatingDivide(HTruncatingDivide node);
+ R visitTry(HTry node);
R visitTypeGuard(HTypeGuard node);
}
@@ -257,6 +258,7 @@
visitStore(HStore node) => visitInstruction(node);
visitThis(HThis node) => visitParameterValue(node);
visitThrow(HThrow node) => visitControlFlow(node);
+ visitTry(HTry node) => visitControlFlow(node);
visitTruncatingDivide(HTruncatingDivide node) => visitBinaryArithmetic(node);
visitTypeGuard(HTypeGuard node) => visitInstruction(node);
visitIs(HIs node) => visitInstruction(node);
@@ -1138,20 +1140,21 @@
}
class HFieldGet extends HInstruction {
- Element element;
+ final Element element;
HFieldGet(Element this.element, HInstruction receiver)
: super(<HInstruction>[receiver]);
- HFieldGet.fromActivation() : super(<HInstruction>[]);
+ HFieldGet.fromActivation(Element this.element) : super(<HInstruction>[]);
HInstruction get receiver() => inputs.length == 1 ? inputs[0] : null;
accept(HVisitor visitor) => visitor.visitFieldGet(this);
}
class HFieldSet extends HInstruction {
- Element element;
+ final Element element;
HFieldSet(Element this.element, HInstruction receiver, HInstruction value)
: super(<HInstruction>[receiver, value]);
- HFieldSet.fromActivation(HInstruction value) : super(<HInstruction>[value]);
+ HFieldSet.fromActivation(Element this.element, HInstruction value)
+ : super(<HInstruction>[value]);
HInstruction get receiver() => inputs.length == 2 ? inputs[0] : null;
HInstruction get value() => inputs.length == 2 ? inputs[1] : inputs[0];
@@ -1631,6 +1634,13 @@
accept(HVisitor visitor) => visitor.visitGoto(this);
}
+class HTry extends HControlFlow {
+ HBasicBlock finallyBlock;
+ HTry() : super(const <HInstruction>[]);
+ toString() => 'try';
+ accept(HVisitor visitor) => visitor.visitTry(this);
+}
+
class HIf extends HConditionalBranch {
bool hasElse;
HIf(HInstruction condition, this.hasElse) : super(<HInstruction>[condition]);
@@ -1711,7 +1721,12 @@
bool isLiteralNumber() => value is num;
bool isLiteralString() => value is DartString;
bool typeEquals(other) => other is HLiteral;
- bool dataEquals(HLiteral other) => value == other.value;
+ bool dataEquals(HLiteral other) {
+ if (isLiteralNumber() && other.isLiteralNumber()) {
+ if (value.isNaN()) return other.value.isNaN();
+ }
+ return value == other.value;
+ }
}
class HNot extends HInstruction {

Powered by Google App Engine
This is Rietveld 408576698