Files
sdk/tests/language/vm/optimized_identical_test.dart
T
fschneider@google.com b5465cf7ef VM: Fix bug in canonicalization of identical in the optimizing compiler.
Make sure that BranchInstr::Canonicalize does not mutate it's input before
all conditions for the optimzations to take place are met. Otherwise, bailing out
leaves the affected comparison instruction in an invalid state.

BUG=https://code.google.com/p/dart/issues/detail?id=14109
R=srdjan@google.com

Review URL: https://codereview.chromium.org//26451006

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@28646 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-15 15:15:47 +00:00

26 lines
747 B
Dart

// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// Test various optimizations and deoptimizations of optimizing compiler..
// VMOptions=--optimization-counter-threshold=10 --no-constant-propagation
import "package:expect/expect.dart";
// Test canonicalization of identical with double input.
// Constant propagation is disabled so that canonicalization is run
// one time less than usual.
test(a) {
var dbl = a + 1.0;
if (!identical(dbl, true)) {
return "ok";
}
throw "fail";
}
main() {
for (var i = 0; i < 20; i++) test(0);
Expect.equals("ok", test(0));
}