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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/ssa/codegen.dart

Issue 23063003: Fix issue 12023 by avoiding a critical edge in the SSA graph with a switch statement. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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 4
5 part of ssa; 5 part of ssa;
6 6
7 class SsaCodeGeneratorTask extends CompilerTask { 7 class SsaCodeGeneratorTask extends CompilerTask {
8 8
9 final JavaScriptBackend backend; 9 final JavaScriptBackend backend;
10 10
(...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after
693 js.Expression key = pop(); 693 js.Expression key = pop();
694 List<js.SwitchClause> cases = <js.SwitchClause>[]; 694 List<js.SwitchClause> cases = <js.SwitchClause>[];
695 695
696 js.Block oldContainer = currentContainer; 696 js.Block oldContainer = currentContainer;
697 for (int i = 0; i < info.matchExpressions.length; i++) { 697 for (int i = 0; i < info.matchExpressions.length; i++) {
698 for (Constant constant in info.matchExpressions[i]) { 698 for (Constant constant in info.matchExpressions[i]) {
699 generateConstant(constant); 699 generateConstant(constant);
700 currentContainer = new js.Block.empty(); 700 currentContainer = new js.Block.empty();
701 cases.add(new js.Case(pop(), currentContainer)); 701 cases.add(new js.Case(pop(), currentContainer));
702 } 702 }
703 if (i == info.matchExpressions.length - 1 && info.hasDefault) { 703 if (i == info.matchExpressions.length - 1) {
704 currentContainer = new js.Block.empty(); 704 currentContainer = new js.Block.empty();
705 cases.add(new js.Default(currentContainer)); 705 cases.add(new js.Default(currentContainer));
706 } 706 }
707 generateStatements(info.statements[i]); 707 generateStatements(info.statements[i]);
708 } 708 }
709 currentContainer = oldContainer; 709 currentContainer = oldContainer;
710 710
711 js.Statement result = new js.Switch(key, cases); 711 js.Statement result = new js.Switch(key, cases);
712 pushStatement(wrapIntoLabels(result, info.labels)); 712 pushStatement(wrapIntoLabels(result, info.labels));
713 return true; 713 return true;
(...skipping 2270 matching lines...) Expand 10 before | Expand all | Expand 10 after
2984 if (leftType.canBeNull() && rightType.canBeNull()) { 2984 if (leftType.canBeNull() && rightType.canBeNull()) {
2985 if (left.isConstantNull() || right.isConstantNull() || 2985 if (left.isConstantNull() || right.isConstantNull() ||
2986 (leftType.isPrimitive(compiler) && leftType == rightType)) { 2986 (leftType.isPrimitive(compiler) && leftType == rightType)) {
2987 return '=='; 2987 return '==';
2988 } 2988 }
2989 return null; 2989 return null;
2990 } else { 2990 } else {
2991 return '==='; 2991 return '===';
2992 } 2992 }
2993 } 2993 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/ssa/builder.dart ('k') | sdk/lib/_internal/compiler/implementation/ssa/nodes.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698