File tree Expand file tree Collapse file tree 2 files changed +37
-0
lines changed
runtime/vm/compiler/backend Expand file tree Collapse file tree 2 files changed +37
-0
lines changed Original file line number Diff line number Diff line change @@ -1160,6 +1160,9 @@ void ConstantPropagator::VisitBinaryDoubleOp(BinaryDoubleOpInstr* instr) {
1160
1160
}
1161
1161
const Double& result = Double::ZoneHandle (Double::NewCanonical (result_val));
1162
1162
SetValue (instr, result);
1163
+ } else if (IsConstant (left) && IsConstant (right)) {
1164
+ // Both values known, but no rule to evaluate this further.
1165
+ SetValue (instr, non_constant_);
1163
1166
}
1164
1167
}
1165
1168
Original file line number Diff line number Diff line change
1
+ // Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
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.
4
+
5
+ // Proper CP on double op (dartbug.com/35321).
6
+ //
7
+ // VMOptions=--deterministic --optimization_counter_threshold=10
8
+
9
+ import "package:expect/expect.dart" ;
10
+
11
+ double foo (bool x) {
12
+ if (x) return 1.0 ;
13
+ }
14
+
15
+ int bar (int i) {
16
+ if (i < 0 ) {
17
+ return bar (i + 1 );
18
+ } else if ((foo (i == 22 ) / 22.0 ) >= (1 / 0.0 )) {
19
+ return 1 ;
20
+ }
21
+ return 0 ;
22
+ }
23
+
24
+ void main () {
25
+ for (int i = 0 ; i < 20 ; ++ i) {
26
+ var x = - 1 ;
27
+ try {
28
+ x = bar (i);
29
+ } catch (_) {
30
+ x = - 2 ;
31
+ }
32
+ Expect .equals (- 2 , x);
33
+ }
34
+ }
You can’t perform that action at this time.
0 commit comments