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 abstract class OptimizationPhase { | 7 abstract class OptimizationPhase { |
8 String get name; | 8 String get name; |
9 void visitGraph(HGraph graph); | 9 void visitGraph(HGraph graph); |
10 } | 10 } |
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 // Note that we still have to call [super] to make sure that we end up | 391 // Note that we still have to call [super] to make sure that we end up |
392 // in the remaining optimizations. | 392 // in the remaining optimizations. |
393 return super.visitRelational(node); | 393 return super.visitRelational(node); |
394 } | 394 } |
395 | 395 |
396 HInstruction handleIdentityCheck(HInvokeBinary node) { | 396 HInstruction handleIdentityCheck(HInvokeBinary node) { |
397 HInstruction left = node.left; | 397 HInstruction left = node.left; |
398 HInstruction right = node.right; | 398 HInstruction right = node.right; |
399 HType leftType = types[left]; | 399 HType leftType = types[left]; |
400 HType rightType = types[right]; | 400 HType rightType = types[right]; |
401 assert(!leftType.isConflicting() && !rightType.isConflicting()); | |
402 | 401 |
403 // We don't optimize on numbers to preserve the runtime semantics. | 402 // We don't optimize on numbers to preserve the runtime semantics. |
404 if (!(left.isNumberOrNull(types) && right.isNumberOrNull(types)) && | 403 if (!(left.isNumberOrNull(types) && right.isNumberOrNull(types)) && |
405 leftType.intersection(rightType, compiler).isConflicting()) { | 404 leftType.intersection(rightType, compiler).isConflicting()) { |
406 return graph.addConstantBool(false, constantSystem); | 405 return graph.addConstantBool(false, constantSystem); |
407 } | 406 } |
408 | 407 |
409 if (left.isConstantBoolean() && right.isBoolean(types)) { | 408 if (left.isConstantBoolean() && right.isBoolean(types)) { |
410 HConstant constant = left; | 409 HConstant constant = left; |
411 if (constant.constant.isTrue()) { | 410 if (constant.constant.isTrue()) { |
(...skipping 938 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1350 } | 1349 } |
1351 | 1350 |
1352 // For other fields having setters in the generative constructor body, set | 1351 // For other fields having setters in the generative constructor body, set |
1353 // the type to UNKNOWN to avoid relying on the type set in the initializer | 1352 // the type to UNKNOWN to avoid relying on the type set in the initializer |
1354 // list. | 1353 // list. |
1355 allSetters.forEach((Element element) { | 1354 allSetters.forEach((Element element) { |
1356 backend.registerFieldConstructor(element, HType.UNKNOWN); | 1355 backend.registerFieldConstructor(element, HType.UNKNOWN); |
1357 }); | 1356 }); |
1358 } | 1357 } |
1359 } | 1358 } |
OLD | NEW |