| 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 class SsaCodeGeneratorTask extends CompilerTask { | 5 class SsaCodeGeneratorTask extends CompilerTask { |
| 6 final JavaScriptBackend backend; | 6 final JavaScriptBackend backend; |
| 7 SsaCodeGeneratorTask(JavaScriptBackend backend) | 7 SsaCodeGeneratorTask(JavaScriptBackend backend) |
| 8 : this.backend = backend, | 8 : this.backend = backend, |
| 9 super(backend.compiler); | 9 super(backend.compiler); |
| 10 String get name() => 'SSA code generator'; | 10 String get name() => 'SSA code generator'; |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 this.parameters, | 234 this.parameters, |
| 235 this.parameterNames) | 235 this.parameterNames) |
| 236 : declaredVariables = new Set<String>(), | 236 : declaredVariables = new Set<String>(), |
| 237 delayedVariableDeclarations = new Set<String>(), | 237 delayedVariableDeclarations = new Set<String>(), |
| 238 buffer = new StringBuffer(), | 238 buffer = new StringBuffer(), |
| 239 generateAtUseSite = new Set<HInstruction>(), | 239 generateAtUseSite = new Set<HInstruction>(), |
| 240 controlFlowOperators = new Set<HInstruction>(), | 240 controlFlowOperators = new Set<HInstruction>(), |
| 241 breakAction = new Map<Element, ElementAction>(), | 241 breakAction = new Map<Element, ElementAction>(), |
| 242 continueAction = new Map<Element, ElementAction>(), | 242 continueAction = new Map<Element, ElementAction>(), |
| 243 unsignedShiftPrecedences = JSPrecedence.binary['>>>'] { | 243 unsignedShiftPrecedences = JSPrecedence.binary['>>>'] { |
| 244 |
| 245 Interceptors interceptors = backend.builder.interceptors; |
| 246 equalsNullElement = interceptors.getEqualsNullInterceptor(); |
| 247 boolifiedEqualsNullElement = |
| 248 interceptors.getBoolifiedVersionOf(equalsNullElement); |
| 244 } | 249 } |
| 245 | 250 |
| 246 abstract visitTypeGuard(HTypeGuard node); | 251 abstract visitTypeGuard(HTypeGuard node); |
| 247 | 252 |
| 248 abstract beginGraph(HGraph graph); | 253 abstract beginGraph(HGraph graph); |
| 249 abstract endGraph(HGraph graph); | 254 abstract endGraph(HGraph graph); |
| 250 | 255 |
| 251 abstract beginLoop(HBasicBlock block); | 256 abstract beginLoop(HBasicBlock block); |
| 252 abstract endLoop(HBasicBlock block); | 257 abstract endLoop(HBasicBlock block); |
| 253 abstract handleLoopCondition(HLoopBranch node); | 258 abstract handleLoopCondition(HLoopBranch node); |
| (...skipping 999 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1253 use(left, JSPrecedence.EQUALITY_PRECEDENCE); | 1258 use(left, JSPrecedence.EQUALITY_PRECEDENCE); |
| 1254 buffer.add(' === '); | 1259 buffer.add(' === '); |
| 1255 use(right, JSPrecedence.RELATIONAL_PRECEDENCE); | 1260 use(right, JSPrecedence.RELATIONAL_PRECEDENCE); |
| 1256 endExpression(JSPrecedence.EQUALITY_PRECEDENCE); | 1261 endExpression(JSPrecedence.EQUALITY_PRECEDENCE); |
| 1257 } | 1262 } |
| 1258 } | 1263 } |
| 1259 | 1264 |
| 1260 visitEquals(HEquals node) { | 1265 visitEquals(HEquals node) { |
| 1261 if (node.builtin) { | 1266 if (node.builtin) { |
| 1262 emitIdentityComparison(node.left, node.right); | 1267 emitIdentityComparison(node.left, node.right); |
| 1268 } else if (node.element === equalsNullElement || |
| 1269 node.element === boolifiedEqualsNullElement) { |
| 1270 beginExpression(JSPrecedence.CALL_PRECEDENCE); |
| 1271 use(node.target, JSPrecedence.CALL_PRECEDENCE); |
| 1272 buffer.add('('); |
| 1273 use(node.left, JSPrecedence.ASSIGNMENT_PRECEDENCE); |
| 1274 buffer.add(')'); |
| 1275 endExpression(JSPrecedence.CALL_PRECEDENCE); |
| 1263 } else { | 1276 } else { |
| 1264 visitInvokeStatic(node); | 1277 visitInvokeStatic(node); |
| 1265 } | 1278 } |
| 1266 } | 1279 } |
| 1267 | 1280 |
| 1268 visitIdentity(HIdentity node) { | 1281 visitIdentity(HIdentity node) { |
| 1269 assert(node.builtin); | 1282 assert(node.builtin); |
| 1270 emitIdentityComparison(node.left, node.right); | 1283 emitIdentityComparison(node.left, node.right); |
| 1271 } | 1284 } |
| 1272 | 1285 |
| (...skipping 1817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3090 startBailoutSwitch(); | 3103 startBailoutSwitch(); |
| 3091 } | 3104 } |
| 3092 } | 3105 } |
| 3093 | 3106 |
| 3094 void endLabeledBlock(HLabeledBlockInformation labeledBlockInfo) { | 3107 void endLabeledBlock(HLabeledBlockInformation labeledBlockInfo) { |
| 3095 if (labeledBlockInfo.body.start.hasGuards()) { | 3108 if (labeledBlockInfo.body.start.hasGuards()) { |
| 3096 endBailoutSwitch(); | 3109 endBailoutSwitch(); |
| 3097 } | 3110 } |
| 3098 } | 3111 } |
| 3099 } | 3112 } |
| OLD | NEW |