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

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

Issue 10692087: Reapply change to update dart2js operator equals semantics to follow (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Whoops, fix eqB to use === true Created 8 years, 5 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 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
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);
249 } 244 }
250 245
251 abstract visitTypeGuard(HTypeGuard node); 246 abstract visitTypeGuard(HTypeGuard node);
252 247
253 abstract beginGraph(HGraph graph); 248 abstract beginGraph(HGraph graph);
254 abstract endGraph(HGraph graph); 249 abstract endGraph(HGraph graph);
255 250
256 abstract beginLoop(HBasicBlock block); 251 abstract beginLoop(HBasicBlock block);
257 abstract endLoop(HBasicBlock block); 252 abstract endLoop(HBasicBlock block);
258 abstract handleLoopCondition(HLoopBranch node); 253 abstract handleLoopCondition(HLoopBranch node);
(...skipping 999 matching lines...) Expand 10 before | Expand all | Expand 10 after
1258 use(left, JSPrecedence.EQUALITY_PRECEDENCE); 1253 use(left, JSPrecedence.EQUALITY_PRECEDENCE);
1259 buffer.add(' === '); 1254 buffer.add(' === ');
1260 use(right, JSPrecedence.RELATIONAL_PRECEDENCE); 1255 use(right, JSPrecedence.RELATIONAL_PRECEDENCE);
1261 endExpression(JSPrecedence.EQUALITY_PRECEDENCE); 1256 endExpression(JSPrecedence.EQUALITY_PRECEDENCE);
1262 } 1257 }
1263 } 1258 }
1264 1259
1265 visitEquals(HEquals node) { 1260 visitEquals(HEquals node) {
1266 if (node.builtin) { 1261 if (node.builtin) {
1267 emitIdentityComparison(node.left, node.right); 1262 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);
1276 } else { 1263 } else {
1277 visitInvokeStatic(node); 1264 visitInvokeStatic(node);
1278 } 1265 }
1279 } 1266 }
1280 1267
1281 visitIdentity(HIdentity node) { 1268 visitIdentity(HIdentity node) {
1282 assert(node.builtin); 1269 assert(node.builtin);
1283 emitIdentityComparison(node.left, node.right); 1270 emitIdentityComparison(node.left, node.right);
1284 } 1271 }
1285 1272
(...skipping 1817 matching lines...) Expand 10 before | Expand all | Expand 10 after
3103 startBailoutSwitch(); 3090 startBailoutSwitch();
3104 } 3091 }
3105 } 3092 }
3106 3093
3107 void endLabeledBlock(HLabeledBlockInformation labeledBlockInfo) { 3094 void endLabeledBlock(HLabeledBlockInformation labeledBlockInfo) {
3108 if (labeledBlockInfo.body.start.hasGuards()) { 3095 if (labeledBlockInfo.body.start.hasGuards()) {
3109 endBailoutSwitch(); 3096 endBailoutSwitch();
3110 } 3097 }
3111 } 3098 }
3112 } 3099 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698