c959c9aba7
Change-Id: I3f67dd79ff2ee745cc2ea161ce7150630e805c97 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150186 Commit-Queue: Bob Nystrom <rnystrom@google.com> Auto-Submit: Bob Nystrom <rnystrom@google.com> Reviewed-by: Nicholas Shahan <nshahan@google.com>
36 lines
752 B
Dart
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));
|
|
}
|