Files
sdk/tests/language_2/allocation_sinking_inlining_test.dart
T
Bob Nystrom 0947675d6d Migrate the language tests up to arithmetic_test.
This technically steals a few tests from the previous batch that spans
corelib and language, but I wanted to start from the top of the language
tests.

Removed application_test and application_negative_test because they are
useless and the latter has never actually worked correctly since the day
it was transliterated from the long-defunct application file syntax.

R=bkonyi@google.com, whesse@google.com

Review-Url: https://codereview.chromium.org/2984443003 .
2017-07-19 20:30:21 -07:00

36 lines
752 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.
// VMOptions=--optimization-counter-threshold=10 --no-use-osr --no-background-compilation
// Test allocation sinking with polymorphic inlining.
import "package:expect/expect.dart";
class A {
foo(x) => ++x.f;
}
class B {
foo(x) => --x.f;
}
class C {
int f = 0;
}
test(obj) {
var c = new C();
return obj.foo(c);
}
main() {
var a = new A();
var b = new B();
Expect.equals(1, test(a));
Expect.equals(-1, test(b));
for (var i = 0; i < 20; i++) test(a);
Expect.equals(1, test(a));
Expect.equals(-1, test(b));
}