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

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

Issue 9536020: Work around buggy break in List.sort and optimize constant folding of negative values. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Add TODO for Kasperl 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 | « dart/frog/leg/lib/dual_pivot_quicksort.dart ('k') | dart/tests/co19/co19-leg.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/frog/leg/ssa/builder.dart
diff --git a/dart/frog/leg/ssa/builder.dart b/dart/frog/leg/ssa/builder.dart
index 04deac976cc90c3fc947801210c55d635b4e4caa..2adefaf7ea9bdcd3ff9539c0a4cfbcd061be811f 100644
--- a/dart/frog/leg/ssa/builder.dart
+++ b/dart/frog/leg/ssa/builder.dart
@@ -1302,7 +1302,16 @@ class SsaBuilder implements Visitor {
new HStatic(interceptors.getPrefixOperatorInterceptor(op));
add(target);
switch (op.source.stringValue) {
- case "-": push(new HNegate(target, operand)); break;
+ case "-":
+ // TODO(kasperl): Avoid calling visit(node.receiver) above.
+ if ((operand is HLiteral) && (operand.value is double)) {
+ stack.add(graph.addNewLiteralDouble(-operand.value));
+ } else if ((operand is HLiteral) && (operand.value is int)) {
+ stack.add(graph.addNewLiteralInt(-operand.value));
+ } else {
+ push(new HNegate(target, operand));
+ }
+ break;
case "~": push(new HBitNot(target, operand)); break;
default: unreachable();
}
« no previous file with comments | « dart/frog/leg/lib/dual_pivot_quicksort.dart ('k') | dart/tests/co19/co19-leg.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698