dart-sdk/tests/language/vm/integer_type_propagation2_test.dart
Robert Nystrom 2034061433 Migrate language_2/vm to NNBD.
Change-Id: I313a57ed7c7ea2ada75065f55a7367376f6bdae5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152183
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
2020-06-25 20:39:23 +00:00

34 lines
826 B
Dart

// Copyright (c) 2017, 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=--no-background-compilation --optimization-counter-threshold=1000
import "package:expect/expect.dart";
import "dart:typed_data";
var list = new Uint32List(1);
@pragma('vm:never-inline')
testuint32(bool b) {
var t;
if (b) {
t = list[0];
}
if (t != null) {
return t & 0x7fffffff;
}
return -1;
}
main() {
var s = 0;
testuint32(true);
testuint32(false);
for (int i = 0; i < 10000; ++i) {
testuint32(true);
}
Expect.equals(0, testuint32(true));
Expect.equals(-1, testuint32(false));
}