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

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

Issue 10831404: When replacing an instruction with another in GVN-like optimizations, try to find a better user of … (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 4 months 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
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 // Test constant folding. 4 // Test constant folding.
5 5
6 #library("compiler_helper"); 6 #library("compiler_helper");
7 7
8 #import("dart:uri"); 8 #import("dart:uri");
9 #import("../../../lib/compiler/implementation/leg.dart", prefix: "leg"); 9 #import("../../../lib/compiler/implementation/leg.dart", prefix: "leg");
10 #import("../../../lib/compiler/implementation/js_backend/js_backend.dart", prefi x: "js"); 10 #import("../../../lib/compiler/implementation/js_backend/js_backend.dart", prefi x: "js");
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 String getIntTypeCheck(String variable) { 50 String getIntTypeCheck(String variable) {
51 return "\\($variable !== \\($variable \\| 0\\)\\)"; 51 return "\\($variable !== \\($variable \\| 0\\)\\)";
52 } 52 }
53 53
54 String getNumberTypeCheck(String variable) { 54 String getNumberTypeCheck(String variable) {
55 return "\\(typeof $variable !== 'number'\\)"; 55 return "\\(typeof $variable !== 'number'\\)";
56 } 56 }
57 57
58 bool checkNumberOfMatches(Iterator it, int nb) { 58 bool checkNumberOfMatches(Iterator it, int nb) {
59 for (int i = 0; i < nb; i++) { 59 for (int i = 0; i < nb; i++) {
60 Expect.isTrue(it.hasNext()); 60 Expect.isTrue(it.hasNext(), "Found less than $nb matches");
61 it.next(); 61 it.next();
62 } 62 }
63 Expect.isFalse(it.hasNext()); 63 Expect.isFalse(it.hasNext(), "Found more than $nb matches");
64 } 64 }
65 65
66 void compileAndMatch(String code, String entry, RegExp regexp) { 66 void compileAndMatch(String code, String entry, RegExp regexp) {
67 String generated = compile(code, entry); 67 String generated = compile(code, entry);
68 Expect.isTrue(regexp.hasMatch(generated), 68 Expect.isTrue(regexp.hasMatch(generated),
69 '"$generated" does not match /$regexp/'); 69 '"$generated" does not match /$regexp/');
70 } 70 }
71 71
72 void compileAndDoNotMatch(String code, String entry, RegExp regexp) { 72 void compileAndDoNotMatch(String code, String entry, RegExp regexp) {
73 String generated = compile(code, entry); 73 String generated = compile(code, entry);
74 Expect.isFalse(regexp.hasMatch(generated), 74 Expect.isFalse(regexp.hasMatch(generated),
75 '"$generated" has a match in /$regexp/'); 75 '"$generated" has a match in /$regexp/');
76 } 76 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698