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

Side by Side Diff: pkg/compiler/lib/src/js_backend/codegen/task.dart

Issue 1397953005: dart2js cps: Speed up integrity checking some more. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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
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 /// Generate code using the cps-based IR pipeline. 5 /// Generate code using the cps-based IR pipeline.
6 library code_generator_task; 6 library code_generator_task;
7 7
8 import 'glue.dart'; 8 import 'glue.dart';
9 import 'codegen.dart'; 9 import 'codegen.dart';
10 import 'unsugar.dart'; 10 import 'unsugar.dart';
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 if (false) { 95 if (false) {
96 reporter.log('Using SSA compiler for platform element $element'); 96 reporter.log('Using SSA compiler for platform element $element');
97 return fallbackCompiler.compile(work); 97 return fallbackCompiler.compile(work);
98 } 98 }
99 99
100 if (tracer != null) { 100 if (tracer != null) {
101 tracer.traceCompilation(element.name, null); 101 tracer.traceCompilation(element.name, null);
102 } 102 }
103 cps.FunctionDefinition cpsFunction = compileToCpsIr(element); 103 cps.FunctionDefinition cpsFunction = compileToCpsIr(element);
104 cpsFunction = optimizeCpsIr(cpsFunction); 104 cpsFunction = optimizeCpsIr(cpsFunction);
105 cpsIntegrityChecker = null;
105 tree_ir.FunctionDefinition treeFunction = compileToTreeIr(cpsFunction); 106 tree_ir.FunctionDefinition treeFunction = compileToTreeIr(cpsFunction);
106 treeFunction = optimizeTreeIr(treeFunction); 107 treeFunction = optimizeTreeIr(treeFunction);
107 return compileToJavaScript(work, treeFunction); 108 return compileToJavaScript(work, treeFunction);
108 } on CodegenBailout catch (e) { 109 } on CodegenBailout catch (e) {
109 String message = "Unable to compile $element with the new compiler.\n" 110 String message = "Unable to compile $element with the new compiler.\n"
110 " Reason: ${e.message}"; 111 " Reason: ${e.message}";
111 reporter.internalError(element, message); 112 reporter.internalError(element, message);
112 } 113 }
113 }); 114 });
114 } 115 }
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 return node is cps.Variable && node.type != null 179 return node is cps.Variable && node.type != null
179 ? '$s:${formatTypeMask(node.type)}' 180 ? '$s:${formatTypeMask(node.type)}'
180 : s; 181 : s;
181 } 182 }
182 DEBUG_MODE = true; 183 DEBUG_MODE = true;
183 print(';;; ==== After $passName ===='); 184 print(';;; ==== After $passName ====');
184 print(new SExpressionStringifier(printType).visit(cpsFunction)); 185 print(new SExpressionStringifier(printType).visit(cpsFunction));
185 } 186 }
186 } 187 }
187 188
189 CheckCpsIntegrity cpsIntegrityChecker;
190
188 bool checkCpsIntegrity(cps.FunctionDefinition node, String previousPass) { 191 bool checkCpsIntegrity(cps.FunctionDefinition node, String previousPass) {
189 cpsOptimizationTask.measureSubtask('Check integrity', () { 192 cpsOptimizationTask.measureSubtask('Check integrity', () {
190 new CheckCpsIntegrity().check(node, previousPass); 193 if (cpsIntegrityChecker == null) {
sra1 2015/10/15 23:06:52 Is this worth it?
asgerf 2015/10/16 07:43:30 It is necessary to ensure we get one instance per
194 cpsIntegrityChecker = new CheckCpsIntegrity();
195 }
196 cpsIntegrityChecker.check(node, previousPass);
191 }); 197 });
192 return true; // So this can be used from assert(). 198 return true; // So this can be used from assert().
193 } 199 }
194 200
195 cps.FunctionDefinition optimizeCpsIr(cps.FunctionDefinition cpsFunction) { 201 cps.FunctionDefinition optimizeCpsIr(cps.FunctionDefinition cpsFunction) {
196 cpsOptimizationTask.measure(() { 202 cpsOptimizationTask.measure(() {
197 TypeMaskSystem typeSystem = new TypeMaskSystem(compiler); 203 TypeMaskSystem typeSystem = new TypeMaskSystem(compiler);
198 204
199 applyCpsPass(new RedundantJoinEliminator(), cpsFunction); 205 applyCpsPass(new RedundantJoinEliminator(), cpsFunction);
200 applyCpsPass(new RedundantPhiEliminator(), cpsFunction); 206 applyCpsPass(new RedundantPhiEliminator(), cpsFunction);
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 treeOptimizationTask] 278 treeOptimizationTask]
273 ..addAll(fallbackCompiler.tasks); 279 ..addAll(fallbackCompiler.tasks);
274 } 280 }
275 281
276 js.Node attachPosition(js.Node node, AstElement element) { 282 js.Node attachPosition(js.Node node, AstElement element) {
277 return node.withSourceInformation( 283 return node.withSourceInformation(
278 sourceInformationFactory.createBuilderForContext(element) 284 sourceInformationFactory.createBuilderForContext(element)
279 .buildDeclaration(element)); 285 .buildDeclaration(element));
280 } 286 }
281 } 287 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698