Files
sdk/tests/lib/mirrors/mirrors_reader_test.dart
T
Ryan Macnak e0c09211fc Revert "[vm] Add a simple compactor."
This reverts commit 5bdffcd32e.

Reason for revert: Failures on DBC, timeouts on hot reload and opt counter stress bots.

Original change's description:
> [vm] Add a simple compactor.
> 
> The compactor copies all live objects in old space to fresh pages, places forwarding pointers in the old objects, forwards all the pointers, then frees the old pages. This has a high space overhead. It is not meant for use in production, but meant to test that the VM is properly set up to handle old-space objects moving.
> 
> Large page objects and instruction objects are not moved.
> 
> Bug: https://github.com/dart-lang/sdk/issues/30978
> Change-Id: Ia42683fd5e27a33702aa5e83bece803a8b005a4b
> Reviewed-on: https://dart-review.googlesource.com/13624
> Commit-Queue: Ryan Macnak <rmacnak@google.com>
> Reviewed-by: Zach Anderson <zra@google.com>
> Reviewed-by: Erik Corry <erikcorry@google.com>

TBR=rmacnak@google.com,zra@google.com,asiva@google.com,erikcorry@google.com

Change-Id: I4fda673561532b604d97b9b02189c030844d969d
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/30978
Reviewed-on: https://dart-review.googlesource.com/14680
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2017-10-17 21:57:19 +00:00

71 lines
2.3 KiB
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.
// Test that everything reachable from a [MirrorSystem] can be accessed.
library test.mirrors.reader;
import 'dart:mirrors';
import 'package:expect/expect.dart';
import 'mirrors_reader.dart';
class RuntimeMirrorsReader extends MirrorsReader {
final MirrorSystem mirrorSystem;
final String mirrorSystemType;
RuntimeMirrorsReader(MirrorSystem mirrorSystem,
{bool verbose: false, bool includeStackTrace: false})
: this.mirrorSystem = mirrorSystem,
this.mirrorSystemType = '${mirrorSystem.runtimeType}',
super(verbose: verbose, includeStackTrace: includeStackTrace);
visitLibraryMirror(LibraryMirror mirror) {
super.visitLibraryMirror(mirror);
Expect.equals(mirror, mirrorSystem.libraries[mirror.uri]);
}
visitClassMirror(ClassMirror mirror) {
super.visitClassMirror(mirror);
Expect.isNotNull(mirror.owner);
}
bool allowUnsupported(var receiver, String tag, UnsupportedError exception) {
if (mirrorSystemType == '_LocalMirrorSystem') {
// VM mirror system.
if (tag.endsWith('location')) {
return receiver is ParameterMirror;
}
} else if (mirrorSystemType == 'JsMirrorSystem') {
// Dart2js runtime mirror system.
if (tag.endsWith('.metadata')) {
return true; // Issue 10905.
}
}
return false;
}
bool expectUnsupported(var receiver, String tag, UnsupportedError exception) {
// [DeclarationMirror.location] is intentionally not supported in runtime
// mirrors.
if (mirrorSystemType == '_LocalMirrorSystem') {
// VM mirror system.
} else if (mirrorSystemType == 'JsMirrorSystem') {
// Dart2js runtime mirror system.
if (receiver is DeclarationMirror && tag == 'location') {
return true;
}
}
return false;
}
}
void main([List<String> arguments = const <String>[]]) {
MirrorSystem mirrors = currentMirrorSystem();
MirrorsReader reader = new RuntimeMirrorsReader(mirrors,
verbose: arguments.contains('-v'),
includeStackTrace: arguments.contains('-s'));
reader.checkMirrorSystem(mirrors);
}