dart-sdk/tests/lib/typed_data/zeroed_allocation_test.dart
Ryan Macnak 1efba58d22 Reapply "[vm] Initialize large typed arrays only once."
Change-Id: I92eb6c96db97e0951ae34315ad8d744e06064b3e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133764
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2020-02-03 17:22:05 +00:00

28 lines
759 B
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.
import 'dart:typed_data';
import 'package:expect/expect.dart';
final KB = 1024;
final interestingSizes = <int>[
4 * KB, // VirtualMemory::PageSize()
64 * KB, // Heap::kAllocatablePageSize
256 * KB, // Heap::kNewAllocatableSize
512 * KB, // PageSpace::kPageSize
];
main() {
for (var base in interestingSizes) {
for (var delta = -32; delta <= 32; delta++) {
final size = base + delta;
final array = new Uint8List(size);
for (var i = 0; i < size; i++) {
Expect.equals(0, array[i]);
}
}
}
}