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

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

Issue 12082074: Fix another bailout problem where not all blocks were visiting when propagating bailout information… (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 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 2651 matching lines...) Expand 10 before | Expand all | Expand 10 after
2662 } 2662 }
2663 2663
2664 String currentLabel() { 2664 String currentLabel() {
2665 return labels.last; 2665 return labels.last;
2666 } 2666 }
2667 2667
2668 js.VariableUse generateStateUse() 2668 js.VariableUse generateStateUse()
2669 => new js.VariableUse(variableNames.stateName); 2669 => new js.VariableUse(variableNames.stateName);
2670 2670
2671 HBasicBlock beginGraph(HGraph graph) { 2671 HBasicBlock beginGraph(HGraph graph) {
2672 propagator = 2672 propagator = new SsaBailoutPropagator(compiler, variableNames);
2673 new SsaBailoutPropagator(compiler, generateAtUseSite, variableNames);
2674 propagator.visitGraph(graph); 2673 propagator.visitGraph(graph);
2675 // TODO(ngeoffray): We could avoid generating the state at the 2674 // TODO(ngeoffray): We could avoid generating the state at the
2676 // call site for non-complex bailout methods. 2675 // call site for non-complex bailout methods.
2677 newParameters.add(new js.Parameter(variableNames.stateName)); 2676 newParameters.add(new js.Parameter(variableNames.stateName));
2678 2677
2679 List<String> names = new List<String>(propagator.bailoutArity); 2678 List<String> names = new List<String>(propagator.bailoutArity);
2680 for (String variable in propagator.parameterNames.keys) { 2679 for (String variable in propagator.parameterNames.keys) {
2681 int index = propagator.parameterNames[variable]; 2680 int index = propagator.parameterNames[variable];
2682 assert(names[index] == null); 2681 assert(names[index] == null);
2683 names[index] = variable; 2682 names[index] = variable;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
2723 } 2722 }
2724 2723
2725 visitParameterValue(HParameterValue node) { 2724 visitParameterValue(HParameterValue node) {
2726 // Nothing to do, parameters are dealt with specially in a bailout 2725 // Nothing to do, parameters are dealt with specially in a bailout
2727 // method. 2726 // method.
2728 } 2727 }
2729 2728
2730 bool visitAndOrInfo(HAndOrBlockInformation info) => false; 2729 bool visitAndOrInfo(HAndOrBlockInformation info) => false;
2731 2730
2732 visitLoopBranch(HLoopBranch node) { 2731 visitLoopBranch(HLoopBranch node) {
2733 HBasicBlock header = node.isDoWhile() 2732 if (node.computeLoopHeader().hasBailoutTargets()) {
2734 ? node.block.successors[0]
2735 : node.block;
2736 if (header.hasBailoutTargets()) {
2737 // The graph visitor in [visitLoopInfo] does not handle the 2733 // The graph visitor in [visitLoopInfo] does not handle the
2738 // condition. We must instead manually emit it here. 2734 // condition. We must instead manually emit it here.
2739 handleLoopCondition(node); 2735 handleLoopCondition(node);
2740 // We must also visit the body from here. 2736 // We must also visit the body from here.
2741 // For a do while loop, the body has already been visited. 2737 // For a do while loop, the body has already been visited.
2742 if (!node.isDoWhile()) { 2738 if (!node.isDoWhile()) {
2743 visitBasicBlock(node.block.dominatedBlocks[0]); 2739 visitBasicBlock(node.block.dominatedBlocks[0]);
2744 } 2740 }
2745 } else { 2741 } else {
2746 super.visitLoopBranch(node); 2742 super.visitLoopBranch(node);
2747 } 2743 }
2748 } 2744 }
2749 2745
2750 2746
2751 bool visitIfInfo(HIfBlockInformation info) { 2747 bool visitIfInfo(HIfBlockInformation info) {
2752 if (info.thenGraph.start.hasBailoutTargets()) return false; 2748 if (info.thenGraph.start.hasBailoutTargets()) return false;
2753 if (info.elseGraph.start.hasBailoutTargets()) return false; 2749 if (info.elseGraph.start.hasBailoutTargets()) return false;
2754 return super.visitIfInfo(info); 2750 return super.visitIfInfo(info);
2755 } 2751 }
2756 2752
2757 bool visitLoopInfo(HLoopBlockInformation info) { 2753 bool visitLoopInfo(HLoopBlockInformation info) {
2758 // Always emit with block flow traversal. 2754 // Always emit with block flow traversal.
2759 if (info.loopHeader.hasBailoutTargets()) { 2755 if (info.loopHeader.hasBailoutTargets()) {
2760 // If there are any bailout targets in the loop, we cannot use 2756 // If there are any bailout targets in the loop, we cannot use
2761 // the pretty [SsaCodeGenerator.visitLoopInfo] printer. 2757 // the pretty [SsaCodeGenerator.visitLoopInfo] printer.
2762 if (info.initializer != null) { 2758 if (info.initializer != null) {
2763 generateStatements(info.initializer); 2759 generateStatements(info.initializer);
2764 } 2760 }
2765 beginLoop(info.loopHeader); 2761 beginLoop(info.loopHeader);
2766 generateStatements(info.condition); 2762 if (!info.isDoWhile()) {
2763 generateStatements(info.condition);
2764 }
2767 generateStatements(info.body); 2765 generateStatements(info.body);
2766 if (info.isDoWhile()) {
2767 generateStatements(info.condition);
2768 }
2768 if (info.updates != null) { 2769 if (info.updates != null) {
2769 generateStatements(info.updates); 2770 generateStatements(info.updates);
2770 } 2771 }
2771 endLoop(info.end); 2772 endLoop(info.end);
2772 return true; 2773 return true;
2773 } 2774 }
2774 return super.visitLoopInfo(info); 2775 return super.visitLoopInfo(info);
2775 } 2776 }
2776 2777
2777 bool visitTryInfo(HTryBlockInformation info) => false; 2778 bool visitTryInfo(HTryBlockInformation info) => false;
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
2995 if (leftType.canBeNull() && rightType.canBeNull()) { 2996 if (leftType.canBeNull() && rightType.canBeNull()) {
2996 if (left.isConstantNull() || right.isConstantNull() || 2997 if (left.isConstantNull() || right.isConstantNull() ||
2997 (leftType.isPrimitive() && leftType == rightType)) { 2998 (leftType.isPrimitive() && leftType == rightType)) {
2998 return '=='; 2999 return '==';
2999 } 3000 }
3000 return null; 3001 return null;
3001 } else { 3002 } else {
3002 return '==='; 3003 return '===';
3003 } 3004 }
3004 } 3005 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698