Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 interface OptimizationPhase { | 5 interface OptimizationPhase { |
| 6 String get name(); | 6 String get name(); |
| 7 void visitGraph(HGraph graph); | 7 void visitGraph(HGraph graph); |
| 8 } | 8 } |
| 9 | 9 |
| 10 class SsaOptimizerTask extends CompilerTask { | 10 class SsaOptimizerTask extends CompilerTask { |
| (...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 466 node.block.addBefore(node, target); | 466 node.block.addBefore(node, target); |
| 467 HEquals result = new HEquals(target, node.left, node.right); | 467 HEquals result = new HEquals(target, node.left, node.right); |
| 468 if (onlyUsedInBoolify) { | 468 if (onlyUsedInBoolify) { |
| 469 result.usesBoolifiedInterceptor = true; | 469 result.usesBoolifiedInterceptor = true; |
| 470 result.propagatedType = HType.BOOLEAN; | 470 result.propagatedType = HType.BOOLEAN; |
| 471 } | 471 } |
| 472 return result; | 472 return result; |
| 473 } | 473 } |
| 474 } | 474 } |
| 475 } | 475 } |
| 476 | 476 |
|
ngeoffray
2012/06/14 13:01:21
Add a comment on why we're interested in recompili
Søren Gjesse
2012/06/15 13:19:59
Done.
| |
| 477 if (node.left is HFieldGet && node.right is HConstant) { | |
|
ngeoffray
2012/06/14 13:01:21
check node.right.isInteger()
Søren Gjesse
2012/06/15 13:19:59
Done.
| |
| 478 HFieldGet left = node.left; | |
| 479 HConstant right = node.right; | |
| 480 Type type = left.receiver.propagatedType.computeType(compiler); | |
| 481 if (left.element != null && | |
| 482 compiler.codegenWorld.hasFieldOnlyIntegerSetters( | |
| 483 type, left.element.name)) { | |
| 484 switch (compiler.pass) { | |
| 485 case 1: | |
| 486 compiler.enqueuer.codegen.registerRecompilationCandidate( | |
| 487 work.element); | |
| 488 break; | |
| 489 case 2: | |
| 490 // Codegen will generate the faster code now. | |
| 491 break; | |
| 492 } | |
| 493 return node; | |
|
ngeoffray
2012/06/14 13:01:21
This code does not really belong here. I would cre
Søren Gjesse
2012/06/15 13:19:59
Moved all this to a new SSA pass.
| |
| 494 } | |
| 495 } | |
| 496 | |
| 477 // All other cases are dealt with by the [visitRelational] and | 497 // All other cases are dealt with by the [visitRelational] and |
| 478 // [visitInvokeBinary], which are visited by invoking the [super]'s | 498 // [visitInvokeBinary], which are visited by invoking the [super]'s |
| 479 // visit method. | 499 // visit method. |
| 480 return super.visitEquals(node); | 500 return super.visitEquals(node); |
| 481 } | 501 } |
| 482 | 502 |
| 483 HInstruction visitTypeGuard(HTypeGuard node) { | 503 HInstruction visitTypeGuard(HTypeGuard node) { |
| 484 HInstruction value = node.guarded; | 504 HInstruction value = node.guarded; |
| 485 // If the intersection of the types is still the incoming type then | 505 // If the intersection of the types is still the incoming type then |
| 486 // the incoming type was a subtype of the guarded type, and no check | 506 // the incoming type was a subtype of the guarded type, and no check |
| (...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1162 // the if block terminates. So any use of the instruction | 1182 // the if block terminates. So any use of the instruction |
| 1163 // after the join block should be changed to the new | 1183 // after the join block should be changed to the new |
| 1164 // instruction. | 1184 // instruction. |
| 1165 changeUsesDominatedBy(ifUser.joinBlock, input, convertedType); | 1185 changeUsesDominatedBy(ifUser.joinBlock, input, convertedType); |
| 1166 } | 1186 } |
| 1167 // TODO(ngeoffray): Also change uses for the then block on a HType | 1187 // TODO(ngeoffray): Also change uses for the then block on a HType |
| 1168 // that knows it is not of a specific Type. | 1188 // that knows it is not of a specific Type. |
| 1169 } | 1189 } |
| 1170 } | 1190 } |
| 1171 } | 1191 } |
| OLD | NEW |