Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(172)

Side by Side Diff: tests/compiler/dart2js/array_tracing_mirror_test.dart

Issue 85783002: Bailout on array optimizations if the array might escape to reflection land. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 // Make sure that limiting mirrors through @MirrorsUsed does not
6 // affect optimizations done on arrays.
7
8 import 'package:expect/expect.dart';
9 import "package:async_helper/async_helper.dart";
10 import 'memory_compiler.dart';
11
12 const MEMORY_SOURCE_FILES = const {
13 'main.dart': '''
14
15 @MirrorsUsed(targets: 'main')
16 import 'dart:mirrors';
17 class A {
18 var field;
19 }
20
21 main() {
22 var a = new A();
23 var mirror = reflect(a);
24 var array = [42, 42];
25 a.field = array;
26 var field = mirror.getField(#field);
27 field.invoke(#clear, []);
28 return array.length;
29 }
30 ''',
31 };
32
33 main() {
34 var compiler = compilerFor(MEMORY_SOURCE_FILES);
35 asyncTest(() => compiler.run(Uri.parse('memory:main.dart')).then((_) {
36 var element = compiler.mainApp.findExported('main');
37 var code = compiler.backend.assembleCode(element);
38 Expect.isTrue(code.contains('return 2'));
39 }));
40 }
41
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/inferrer/container_tracer.dart ('k') | tests/lib/mirrors/array_tracing2_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698