| OLD | NEW |
| 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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 */ | 153 */ |
| 154 VariableNames variableNames; | 154 VariableNames variableNames; |
| 155 bool shouldGroupVarDeclarations = false; | 155 bool shouldGroupVarDeclarations = false; |
| 156 | 156 |
| 157 /** | 157 /** |
| 158 * While generating expressions, we can't insert variable declarations. | 158 * While generating expressions, we can't insert variable declarations. |
| 159 * Instead we declare them at the start of the function. When minifying | 159 * Instead we declare them at the start of the function. When minifying |
| 160 * we do this most of the time, because it reduces the size unless there | 160 * we do this most of the time, because it reduces the size unless there |
| 161 * is only one variable. | 161 * is only one variable. |
| 162 */ | 162 */ |
| 163 final LinkedHashSet<String> collectedVariableDeclarations; | 163 final Set<String> collectedVariableDeclarations; |
| 164 | 164 |
| 165 /** | 165 /** |
| 166 * Set of variables and parameters that have already been declared. | 166 * Set of variables and parameters that have already been declared. |
| 167 */ | 167 */ |
| 168 final Set<String> declaredLocals; | 168 final Set<String> declaredLocals; |
| 169 | 169 |
| 170 int indent = 0; | 170 int indent = 0; |
| 171 HGraph currentGraph; | 171 HGraph currentGraph; |
| 172 | 172 |
| 173 // Records a block-information that is being handled specially. | 173 // Records a block-information that is being handled specially. |
| 174 // Used to break bad recursion. | 174 // Used to break bad recursion. |
| 175 HBlockInformation currentBlockInformation; | 175 HBlockInformation currentBlockInformation; |
| 176 // The subgraph is used to delimit traversal for some constructions, e.g., | 176 // The subgraph is used to delimit traversal for some constructions, e.g., |
| 177 // if branches. | 177 // if branches. |
| 178 SubGraph subGraph; | 178 SubGraph subGraph; |
| 179 | 179 |
| 180 SsaCodeGenerator(this.backend, CodegenWorkItem work) | 180 SsaCodeGenerator(this.backend, CodegenWorkItem work) |
| 181 : this.work = work, | 181 : this.work = work, |
| 182 declaredLocals = new Set<String>(), | 182 declaredLocals = new Set<String>(), |
| 183 collectedVariableDeclarations = new LinkedHashSet<String>(), | 183 collectedVariableDeclarations = new Set<String>(), |
| 184 currentContainer = new js.Block.empty(), | 184 currentContainer = new js.Block.empty(), |
| 185 parameters = <js.Parameter>[], | 185 parameters = <js.Parameter>[], |
| 186 expressionStack = <js.Expression>[], | 186 expressionStack = <js.Expression>[], |
| 187 oldContainerStack = <js.Block>[], | 187 oldContainerStack = <js.Block>[], |
| 188 generateAtUseSite = new Set<HInstruction>(), | 188 generateAtUseSite = new Set<HInstruction>(), |
| 189 controlFlowOperators = new Set<HInstruction>(), | 189 controlFlowOperators = new Set<HInstruction>(), |
| 190 breakAction = new Map<Element, ElementAction>(), | 190 breakAction = new Map<Element, ElementAction>(), |
| 191 continueAction = new Map<Element, ElementAction>(); | 191 continueAction = new Map<Element, ElementAction>(); |
| 192 | 192 |
| 193 Compiler get compiler => backend.compiler; | 193 Compiler get compiler => backend.compiler; |
| (...skipping 2859 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3053 if (leftType.canBeNull() && rightType.canBeNull()) { | 3053 if (leftType.canBeNull() && rightType.canBeNull()) { |
| 3054 if (left.isConstantNull() || right.isConstantNull() || | 3054 if (left.isConstantNull() || right.isConstantNull() || |
| 3055 (leftType.isPrimitive(compiler) && leftType == rightType)) { | 3055 (leftType.isPrimitive(compiler) && leftType == rightType)) { |
| 3056 return '=='; | 3056 return '=='; |
| 3057 } | 3057 } |
| 3058 return null; | 3058 return null; |
| 3059 } else { | 3059 } else { |
| 3060 return '==='; | 3060 return '==='; |
| 3061 } | 3061 } |
| 3062 } | 3062 } |
| OLD | NEW |