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 HVisitor<R> { | 5 interface HVisitor<R> { |
| 6 R visitAdd(HAdd node); | 6 R visitAdd(HAdd node); |
| 7 R visitBailoutTarget(HBailoutTarget node); | 7 R visitBailoutTarget(HBailoutTarget node); |
| 8 R visitBitAnd(HBitAnd node); | 8 R visitBitAnd(HBitAnd node); |
| 9 R visitBitNot(HBitNot node); | 9 R visitBitNot(HBitNot node); |
| 10 R visitBitOr(HBitOr node); | 10 R visitBitOr(HBitOr node); |
| (...skipping 1369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1380 if (input == target) return HType.UNKNOWN; | 1380 if (input == target) return HType.UNKNOWN; |
| 1381 if (isString() || left.isString()) { | 1381 if (isString() || left.isString()) { |
| 1382 return (input == left) ? HType.STRING : HType.UNKNOWN; | 1382 return (input == left) ? HType.STRING : HType.UNKNOWN; |
| 1383 } | 1383 } |
| 1384 if (right.isString()) return HType.STRING; | 1384 if (right.isString()) return HType.STRING; |
| 1385 if (isNumber() || left.isNumber() || right.isNumber()) return HType.NUMBER; | 1385 if (isNumber() || left.isNumber() || right.isNumber()) return HType.NUMBER; |
| 1386 return HType.UNKNOWN; | 1386 return HType.UNKNOWN; |
| 1387 } | 1387 } |
| 1388 | 1388 |
| 1389 AddOperation get operation() => const AddOperation(); | 1389 AddOperation get operation() => const AddOperation(); |
| 1390 | |
| 1391 HInstruction fold(HGraph graph) { | |
|
ngeoffray
2012/03/14 12:29:58
Is that dead code? There is no fold method in the
Lasse Reichstein Nielsen
2012/03/14 13:04:49
It's probably dead, just leftover of a merge that
| |
| 1392 // TODO(floitsch): move this code to the compile-time-constant handler. | |
| 1393 if (left.isConstantString() && right is HConstant) { | |
| 1394 HConstant op1 = left; | |
| 1395 HConstant op2 = right; | |
| 1396 DartString leftString = op1.constant.value; | |
| 1397 DartString otherString = null; | |
| 1398 if (right.isConstantString()) { | |
| 1399 otherString = op2.constant.value; | |
| 1400 } else { | |
| 1401 assert(op2.isConstantNumber() || | |
| 1402 op2.isConstantBoolean() || | |
| 1403 op2.isConstantNull()); | |
| 1404 otherString = new DartString.literal(op2.constant.value.toString()); | |
| 1405 } | |
| 1406 DartString cons = new DartString.concat(leftString, otherString); | |
| 1407 return graph.addConstantString(cons); | |
| 1408 } | |
| 1409 return super.fold(graph); | |
| 1410 } | |
| 1411 | |
| 1390 int typeCode() => 5; | 1412 int typeCode() => 5; |
| 1391 bool typeEquals(other) => other is HAdd; | 1413 bool typeEquals(other) => other is HAdd; |
| 1392 bool dataEquals(HInstruction other) => true; | 1414 bool dataEquals(HInstruction other) => true; |
| 1393 } | 1415 } |
| 1394 | 1416 |
| 1395 class HDivide extends HBinaryArithmetic { | 1417 class HDivide extends HBinaryArithmetic { |
| 1396 HDivide(HStatic target, HInstruction left, HInstruction right) | 1418 HDivide(HStatic target, HInstruction left, HInstruction right) |
| 1397 : super(target, left, right); | 1419 : super(target, left, right); |
| 1398 accept(HVisitor visitor) => visitor.visitDivide(this); | 1420 accept(HVisitor visitor) => visitor.visitDivide(this); |
| 1399 | 1421 |
| (...skipping 738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2138 class HIfBlockInformation { | 2160 class HIfBlockInformation { |
| 2139 final HIf branch; | 2161 final HIf branch; |
| 2140 final SubGraph thenGraph; | 2162 final SubGraph thenGraph; |
| 2141 final SubGraph elseGraph; | 2163 final SubGraph elseGraph; |
| 2142 final HBasicBlock joinBlock; | 2164 final HBasicBlock joinBlock; |
| 2143 HIfBlockInformation(this.branch, | 2165 HIfBlockInformation(this.branch, |
| 2144 this.thenGraph, | 2166 this.thenGraph, |
| 2145 this.elseGraph, | 2167 this.elseGraph, |
| 2146 this.joinBlock); | 2168 this.joinBlock); |
| 2147 } | 2169 } |
| OLD | NEW |