dd6dc29c21
This change mechanically copies runtime/tests/vm/dart -> runtime/tests/vm/dart_2 in preparation for the migration of runtime/tests/vm/dart to NNBD. Corresponding statuses in vm.status are duplicated. Added vm_nnbd builder tag for NNBD bots. vm/dart/* tests are allowed to run only on vm_nnbd builders. vm/dart_2/* tests are allowed to run only on non-vm_nnbd builders. Issue: https://github.com/dart-lang/sdk/issues/41314 Change-Id: I079da92da17960605f37c1c0e28e48362b236739 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149485 Reviewed-by: Régis Crelier <regis@google.com> Reviewed-by: Ryan Macnak <rmacnak@google.com> Commit-Queue: Alexander Markov <alexmarkov@google.com>
45 lines
1.1 KiB
Dart
45 lines
1.1 KiB
Dart
// Copyright (c) 2020, 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.
|
|
//
|
|
// SharedObjects=ffi_test_functions
|
|
|
|
import 'package:expect/expect.dart';
|
|
|
|
import 'dylib_utils.dart';
|
|
import 'unboxed_parameter_helper.dart';
|
|
|
|
class Foo {
|
|
int val;
|
|
Foo(this.val);
|
|
}
|
|
|
|
var globalFoo;
|
|
|
|
final dbl2 = getDoubleWithHeapObjectTag();
|
|
|
|
@pragma('vm:never-inline')
|
|
double bar(int i, double k, Foo foo, double j, [int optional = 1]) {
|
|
triggerGc();
|
|
globalFoo.val = 0;
|
|
return (i + 2 + j.toInt() - j.toInt() + globalFoo.val + optional).toDouble();
|
|
}
|
|
|
|
@pragma('vm:never-inline')
|
|
createFoo() {
|
|
globalFoo = Foo(1);
|
|
}
|
|
|
|
final bool kTrue = int.parse('1') == 1;
|
|
|
|
main() {
|
|
createFoo();
|
|
final dbl = getDoubleWithHeapObjectTag();
|
|
Expect.equals(4.0,
|
|
bar(kTrue ? 1 : 2, kTrue ? 2 * dbl : 0.0, globalFoo, kTrue ? dbl : 1.0));
|
|
Expect.equals(
|
|
3.0,
|
|
bar(kTrue ? 1 : 2, kTrue ? 2 * dbl : 0.0, globalFoo, kTrue ? dbl : 1.0,
|
|
0));
|
|
}
|