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

Side by Side Diff: tests/compiler/dart2js/backend_dart/opt_constprop_test.dart

Issue 792643003: Add DartTypes to abstract Types. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebased Created 6 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
« no previous file with comments | « pkg/compiler/lib/src/tree_ir/tree_ir_builder.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import 'dart:async'; 5 import 'dart:async';
6 import '../mock_compiler.dart'; 6 import '../mock_compiler.dart';
7 import 'sexpr_unstringifier.dart'; 7 import 'sexpr_unstringifier.dart';
8 import 'package:async_helper/async_helper.dart'; 8 import 'package:async_helper/async_helper.dart';
9 import "package:expect/expect.dart"; 9 import "package:expect/expect.dart";
10 import 'package:compiler/src/cps_ir/cps_ir_nodes_sexpr.dart'; 10 import 'package:compiler/src/cps_ir/cps_ir_nodes_sexpr.dart';
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 /// Parses the given input IR, runs an optimization pass over it, and compares 398 /// Parses the given input IR, runs an optimization pass over it, and compares
399 /// the stringification of the result against the expected output. 399 /// the stringification of the result against the expected output.
400 Future testConstantPropagator(String input, String expectedOutput) { 400 Future testConstantPropagator(String input, String expectedOutput) {
401 final compiler = new MockCompiler.internal( 401 final compiler = new MockCompiler.internal(
402 emitJavaScript: false, 402 emitJavaScript: false,
403 enableMinification: false); 403 enableMinification: false);
404 return compiler.init().then((_) { 404 return compiler.init().then((_) {
405 final unstringifier = new SExpressionUnstringifier(); 405 final unstringifier = new SExpressionUnstringifier();
406 final stringifier = new SExpressionStringifier(); 406 final stringifier = new SExpressionStringifier();
407 final optimizer = new TypePropagator( 407 final optimizer = new TypePropagator(
408 compiler, 408 compiler.types,
409 dart2js.DART_CONSTANT_SYSTEM, 409 dart2js.DART_CONSTANT_SYSTEM,
410 new UnitTypeSystem(), 410 new UnitTypeSystem(),
411 compiler.internalError); 411 compiler.internalError);
412 412
413 final f = unstringifier.unstringify(input); 413 final f = unstringifier.unstringify(input);
414 optimizer.rewrite(f); 414 optimizer.rewrite(f);
415 415
416 String expected = normalizeSExpr(expectedOutput); 416 String expected = normalizeSExpr(expectedOutput);
417 String actual = normalizeSExpr(stringifier.visit(f)); 417 String actual = normalizeSExpr(stringifier.visit(f));
418 418
419 Expect.equals(expected, actual); 419 Expect.equals(expected, actual);
420 }); 420 });
421 } 421 }
422 422
423 void main() { 423 void main() {
424 asyncTest(() => testConstantPropagator(CP1_IN, CP1_OUT)); 424 asyncTest(() => testConstantPropagator(CP1_IN, CP1_OUT));
425 asyncTest(() => testConstantPropagator(CP2_IN, CP2_OUT)); 425 asyncTest(() => testConstantPropagator(CP2_IN, CP2_OUT));
426 asyncTest(() => testConstantPropagator(CP3_IN, CP3_OUT)); 426 asyncTest(() => testConstantPropagator(CP3_IN, CP3_OUT));
427 asyncTest(() => testConstantPropagator(CP4_IN, CP4_OUT)); 427 asyncTest(() => testConstantPropagator(CP4_IN, CP4_OUT));
428 asyncTest(() => testConstantPropagator(CP5_IN, CP5_OUT)); 428 asyncTest(() => testConstantPropagator(CP5_IN, CP5_OUT));
429 asyncTest(() => testConstantPropagator(CP6_IN, CP6_OUT)); 429 asyncTest(() => testConstantPropagator(CP6_IN, CP6_OUT));
430 asyncTest(() => testConstantPropagator(CP7_IN, CP7_OUT)); 430 asyncTest(() => testConstantPropagator(CP7_IN, CP7_OUT));
431 asyncTest(() => testConstantPropagator(CP8_IN, CP8_OUT)); 431 asyncTest(() => testConstantPropagator(CP8_IN, CP8_OUT));
432 asyncTest(() => testConstantPropagator(CP9_IN, CP9_OUT)); 432 asyncTest(() => testConstantPropagator(CP9_IN, CP9_OUT));
433 asyncTest(() => testConstantPropagator(CP10_IN, CP10_OUT)); 433 asyncTest(() => testConstantPropagator(CP10_IN, CP10_OUT));
434 } 434 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/tree_ir/tree_ir_builder.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698