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

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

Issue 12226032: Fix size problem spotted by sra@, where iae and ioore were always put in the codegen work list. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 10 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 9
10 import "../../../sdk/lib/_internal/compiler/implementation/elements/elements.dar t" 10 import "../../../sdk/lib/_internal/compiler/implementation/elements/elements.dar t"
(...skipping 28 matching lines...) Expand all
39 var context = new js.JavaScriptItemCompilationContext(); 39 var context = new js.JavaScriptItemCompilationContext();
40 leg.ResolutionWorkItem resolutionWork = 40 leg.ResolutionWorkItem resolutionWork =
41 new leg.ResolutionWorkItem(element, context); 41 new leg.ResolutionWorkItem(element, context);
42 resolutionWork.run(compiler, compiler.enqueuer.resolution); 42 resolutionWork.run(compiler, compiler.enqueuer.resolution);
43 leg.CodegenWorkItem work = 43 leg.CodegenWorkItem work =
44 new leg.CodegenWorkItem(element, resolutionWork.resolutionTree, context); 44 new leg.CodegenWorkItem(element, resolutionWork.resolutionTree, context);
45 work.run(compiler, compiler.enqueuer.codegen); 45 work.run(compiler, compiler.enqueuer.codegen);
46 return compiler.enqueuer.codegen.assembleCode(element); 46 return compiler.enqueuer.codegen.assembleCode(element);
47 } 47 }
48 48
49 MockCompiler compilerFor(String code, Uri uri, {bool analyzeAll: false}) { 49 MockCompiler compilerFor(String code, Uri uri,
50 MockCompiler compiler = new MockCompiler(analyzeAll: analyzeAll); 50 {bool analyzeAll: false,
51 String coreSource: DEFAULT_CORELIB}) {
52 MockCompiler compiler = new MockCompiler(
53 analyzeAll: analyzeAll, coreSource: coreSource);
51 compiler.sourceFiles[uri.toString()] = new SourceFile(uri.toString(), code); 54 compiler.sourceFiles[uri.toString()] = new SourceFile(uri.toString(), code);
52 return compiler; 55 return compiler;
53 } 56 }
54 57
55 String compileAll(String code) { 58 String compileAll(String code, {String coreSource: DEFAULT_CORELIB}) {
56 Uri uri = new Uri.fromComponents(scheme: 'source'); 59 Uri uri = new Uri.fromComponents(scheme: 'source');
57 MockCompiler compiler = compilerFor(code, uri); 60 MockCompiler compiler = compilerFor(code, uri, coreSource: coreSource);
58 compiler.runCompiler(uri); 61 compiler.runCompiler(uri);
59 Expect.isFalse(compiler.compilationFailed, 62 Expect.isFalse(compiler.compilationFailed,
60 'Unexpected compilation error'); 63 'Unexpected compilation error');
61 return compiler.assembledCode; 64 return compiler.assembledCode;
62 } 65 }
63 66
64 dynamic compileAndCheck(String code, 67 dynamic compileAndCheck(String code,
65 String name, 68 String name,
66 check(MockCompiler compiler, lego.Element element)) { 69 check(MockCompiler compiler, lego.Element element)) {
67 Uri uri = new Uri.fromComponents(scheme: 'source'); 70 Uri uri = new Uri.fromComponents(scheme: 'source');
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 final xRe = new RegExp('\\bx\\b'); 129 final xRe = new RegExp('\\bx\\b');
127 regexp = regexp.replaceAll(xRe, '(?:$anyIdentifier)'); 130 regexp = regexp.replaceAll(xRe, '(?:$anyIdentifier)');
128 final spaceRe = new RegExp('\\s+'); 131 final spaceRe = new RegExp('\\s+');
129 regexp = regexp.replaceAll(spaceRe, '(?:\\s*)'); 132 regexp = regexp.replaceAll(spaceRe, '(?:\\s*)');
130 if (shouldMatch) { 133 if (shouldMatch) {
131 Expect.isTrue(new RegExp(regexp).hasMatch(generated)); 134 Expect.isTrue(new RegExp(regexp).hasMatch(generated));
132 } else { 135 } else {
133 Expect.isFalse(new RegExp(regexp).hasMatch(generated)); 136 Expect.isFalse(new RegExp(regexp).hasMatch(generated));
134 } 137 }
135 } 138 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/js_backend/backend.dart ('k') | tests/compiler/dart2js/mock_compiler.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698