Chromium Code Reviews| 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..cffadd05bb0aadf001ff35a9b91f42ff966648c9 100644 |
| --- a/dart/frog/leg/ssa/builder.dart |
| +++ b/dart/frog/leg/ssa/builder.dart |
| @@ -1302,7 +1302,15 @@ class SsaBuilder implements Visitor { |
| new HStatic(interceptors.getPrefixOperatorInterceptor(op)); |
| add(target); |
| switch (op.source.stringValue) { |
| - case "-": push(new HNegate(target, operand)); break; |
| + case "-": |
|
kasperl
2012/03/01 06:13:00
This could possible be dealt with in a faster way
ahe
2012/03/01 06:54:15
Done.
|
| + 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)); |
|
ngeoffray
2012/02/29 20:36:26
Why is that not done in the constant folder instea
ahe
2012/02/29 20:41:24
Because it is really slow at doing it.
ngeoffray
2012/03/01 08:15:51
Why is that?
floitsch
2012/03/01 10:32:18
The problem is not really the constant folding, bu
|
| + } else { |
| + push(new HNegate(target, operand)); |
| + } |
| + break; |
| case "~": push(new HBitNot(target, operand)); break; |
| default: unreachable(); |
| } |