Files
sdk/tests/language_2/vm/mixin_test.dart
T
Aart Bik b0968395f1 [vm/compiler] Minor heuristic change to reduce code size
Rationale:
Inlining constant constructors/mixin is practically always
profitable. So the heuristics have been changed to at least
consider these even at higher depth (note that they are of
course still subject to actual heuristics while inlining).

This brings back flutter gallery size to where it was
before mixins were introduced.

head:

VMIsolate(CodeSize): 4737
Isolate(CodeSize): 2005123                     101%
ReadOnlyData(CodeSize): 2212408                103%
Instructions(CodeSize): 7006928                100%
Total(CodeSize): 11229196                      101%

improved heuristic:

VMIsolate(CodeSize): 4737
Isolate(CodeSize): 1985691
ReadOnlyData(CodeSize): 2152880
Instructions(CodeSize): 6987616
Total(CodeSize): 11130924

https://github.com/dart-lang/sdk/issues/37126

Change-Id: I28de0fa6c92a785bbc47e9fa09ed55ae68593c0a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112758
Commit-Queue: Aart Bik <ajcbik@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-08-12 23:17:43 +00:00

38 lines
701 B
Dart
Executable File

// Copyright (c) 2019, 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.
// Illustrates inlining heuristic issue of
// https://github.com/dart-lang/sdk/issues/37126
// (mixins introduce one extra depth of inlining).
// VMOptions=--deterministic
import "package:expect/expect.dart";
class X {
const X();
int foo() {
return 1;
}
}
mixin YMixin {
int bar() {
return 2;
}
}
class Y with YMixin {
const Y();
}
@pragma("vm:never-inline")
int foobar() {
return new X().foo() + new Y().bar();
}
main() {
Expect.equals(3, foobar());
}