dart-sdk/tests/language/deferred_optimized_test.dart
Vyacheslav Egorov 4fb15fcbf2 [vm/compiler] Consolidate compiler passes and share them between JIT and AOT.
Passes bodies are moved into compiler_pass{.cc,.h}.

Invoking a pass is just INVOKE_PASS(Name) now, instead of putting a bunch of
if-s and calls in compiler.cc or precompiler.cc.

We also consolidate ability to print IL and enable-disable passes under a
single flag --compiler-passes, e.g.

--compiler-passes=-Inlining,-CSE    disable inlining and CSE passes

--compiler-passes=Inlining+         print IL after Inlining pass and all
                                    subsequent passes

Change-Id: I90ff54b04a54f20099f5bf38dd45b16b8e3c4781
Reviewed-on: https://dart-review.googlesource.com/43968
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2018-03-01 16:43:58 +00:00

35 lines
777 B
Dart

// Copyright (c) 2014, 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 --compiler-passes=-Inlining --no-background-compilation
// Declares foo that returns 42.
import "deferred_constraints_lib2.dart" deferred as lib;
import 'package:expect/expect.dart';
bool libLoaded = false;
main() {
Expect.equals(88, heyhey());
for (int i = 0; i < 30; i++) {
heyhey();
}
lib.loadLibrary().then((_) {
libLoaded = true;
Expect.equals(42, heyhey());
});
}
heyhey() => barbar();
barbar() {
if (libLoaded) {
// Returns 42.
return lib.foo();
}
return 88;
}