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

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

Issue 10356053: Prettify !(x rel-op y) into (x "!rel-op" y) when possible. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 7 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
« no previous file with comments | « lib/compiler/implementation/operations.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 SsaCodeGeneratorTask(Compiler compiler) : super(compiler); 6 SsaCodeGeneratorTask(Compiler compiler) : super(compiler);
7 String get name() => 'SSA code generator'; 7 String get name() => 'SSA code generator';
8 8
9 9
10 String generateMethod(WorkItem work, HGraph graph) { 10 String generateMethod(WorkItem work, HGraph graph) {
(...skipping 1379 matching lines...) Expand 10 before | Expand all | Expand 10 after
1390 // With labeled breaks we can have more dominated blocks. 1390 // With labeled breaks we can have more dominated blocks.
1391 if (dominated.length >= 3) { 1391 if (dominated.length >= 3) {
1392 for (int i = 2; i < dominated.length; i++) { 1392 for (int i = 2; i < dominated.length; i++) {
1393 visitBasicBlock(dominated[i]); 1393 visitBasicBlock(dominated[i]);
1394 } 1394 }
1395 } 1395 }
1396 } 1396 }
1397 1397
1398 visitNot(HNot node) { 1398 visitNot(HNot node) {
1399 assert(node.inputs.length == 1); 1399 assert(node.inputs.length == 1);
1400 HInstruction input = node.inputs[0];
1401 if (input is HBoolify && isGenerateAtUseSite(input)) {
1402 beginExpression(JSPrecedence.EQUALITY_PRECEDENCE);
1403 assert(node.inputs.length == 1);
1404 use(node.inputs[0], JSPrecedence.EQUALITY_PRECEDENCE);
1405 buffer.add(' !== true');
1406 endExpression(JSPrecedence.EQUALITY_PRECEDENCE);
1407 return;
ngeoffray 2012/05/08 09:27:24 I prefer else if than return.
Lasse Reichstein Nielsen 2012/05/08 10:03:33 Done.
1408 }
1409 if (input is HRelational &&
1410 input.builtin &&
1411 isGenerateAtUseSite(input)) {
1412 Map<String, String> inverseOperator = const <String>{
1413 "==" : "!=",
1414 "!=" : "==",
1415 "===": "!==",
1416 "!==": "===",
1417 "<" : ">=",
1418 "<=" : ">",
1419 ">" : "<=",
1420 ">=" : "<"
1421 };
1422 visitInvokeBinary(input,
1423 inverseOperator[input.operation.name.stringValue]);
1424 return;
ngeoffray 2012/05/08 09:27:24 ditto.
Lasse Reichstein Nielsen 2012/05/08 10:03:33 Done.
1425 }
1400 beginExpression(JSPrecedence.PREFIX_PRECEDENCE); 1426 beginExpression(JSPrecedence.PREFIX_PRECEDENCE);
1401 buffer.add('!'); 1427 buffer.add('!');
1402 use(node.inputs[0], JSPrecedence.PREFIX_PRECEDENCE); 1428 use(input, JSPrecedence.PREFIX_PRECEDENCE);
1403 endExpression(JSPrecedence.PREFIX_PRECEDENCE); 1429 endExpression(JSPrecedence.PREFIX_PRECEDENCE);
1404 } 1430 }
1405 1431
1406 visitParameterValue(HParameterValue node) { 1432 visitParameterValue(HParameterValue node) {
1407 assert(isGenerateAtUseSite(node)); 1433 assert(isGenerateAtUseSite(node));
1408 buffer.add(parameterNames[node.element]); 1434 buffer.add(parameterNames[node.element]);
1409 } 1435 }
1410 1436
1411 visitPhi(HPhi node) { 1437 visitPhi(HPhi node) {
1412 String operation = logicalOperations[node]; 1438 String operation = logicalOperations[node];
(...skipping 816 matching lines...) Expand 10 before | Expand all | Expand 10 after
2229 startBailoutSwitch(); 2255 startBailoutSwitch();
2230 } 2256 }
2231 } 2257 }
2232 2258
2233 void endLabeledBlock(HLabeledBlockInformation labeledBlockInfo) { 2259 void endLabeledBlock(HLabeledBlockInformation labeledBlockInfo) {
2234 if (labeledBlockInfo.body.start.hasGuards()) { 2260 if (labeledBlockInfo.body.start.hasGuards()) {
2235 endBailoutSwitch(); 2261 endBailoutSwitch();
2236 } 2262 }
2237 } 2263 }
2238 } 2264 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/operations.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698