| 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 class SsaCodeGeneratorTask extends CompilerTask { | 7 class SsaCodeGeneratorTask extends CompilerTask { |
| 8 | 8 |
| 9 final JavaScriptBackend backend; | 9 final JavaScriptBackend backend; |
| 10 | 10 |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 } | 214 } |
| 215 return false; | 215 return false; |
| 216 } | 216 } |
| 217 | 217 |
| 218 // We want the outcome of bit-operations to be positive. However, if | 218 // We want the outcome of bit-operations to be positive. However, if |
| 219 // the result of a bit-operation is only used by other bit | 219 // the result of a bit-operation is only used by other bit |
| 220 // operations we do not have to convert to an unsigned | 220 // operations we do not have to convert to an unsigned |
| 221 // integer. Also, if we are using & with a positive constant we know | 221 // integer. Also, if we are using & with a positive constant we know |
| 222 // that the result is positive already and need no conversion. | 222 // that the result is positive already and need no conversion. |
| 223 bool requiresUintConversion(HInstruction instruction) { | 223 bool requiresUintConversion(HInstruction instruction) { |
| 224 if (instruction is HShiftRight) { |
| 225 return false; |
| 226 } |
| 224 if (instruction is HBitAnd) { | 227 if (instruction is HBitAnd) { |
| 225 HBitAnd bitAnd = instruction; | 228 HBitAnd bitAnd = instruction; |
| 226 if (isNonNegativeInt32Constant(bitAnd.left) || | 229 if (isNonNegativeInt32Constant(bitAnd.left) || |
| 227 isNonNegativeInt32Constant(bitAnd.right)) { | 230 isNonNegativeInt32Constant(bitAnd.right)) { |
| 228 return false; | 231 return false; |
| 229 } | 232 } |
| 230 } | 233 } |
| 231 return hasNonBitOpUser(instruction, new Set<HPhi>()); | 234 return hasNonBitOpUser(instruction, new Set<HPhi>()); |
| 232 } | 235 } |
| 233 | 236 |
| (...skipping 1036 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1270 | 1273 |
| 1271 visitAdd(HAdd node) => visitInvokeBinary(node, '+'); | 1274 visitAdd(HAdd node) => visitInvokeBinary(node, '+'); |
| 1272 visitDivide(HDivide node) => visitInvokeBinary(node, '/'); | 1275 visitDivide(HDivide node) => visitInvokeBinary(node, '/'); |
| 1273 visitMultiply(HMultiply node) => visitInvokeBinary(node, '*'); | 1276 visitMultiply(HMultiply node) => visitInvokeBinary(node, '*'); |
| 1274 visitSubtract(HSubtract node) => visitInvokeBinary(node, '-'); | 1277 visitSubtract(HSubtract node) => visitInvokeBinary(node, '-'); |
| 1275 visitBitAnd(HBitAnd node) => visitBitInvokeBinary(node, '&'); | 1278 visitBitAnd(HBitAnd node) => visitBitInvokeBinary(node, '&'); |
| 1276 visitBitNot(HBitNot node) => visitBitInvokeUnary(node, '~'); | 1279 visitBitNot(HBitNot node) => visitBitInvokeUnary(node, '~'); |
| 1277 visitBitOr(HBitOr node) => visitBitInvokeBinary(node, '|'); | 1280 visitBitOr(HBitOr node) => visitBitInvokeBinary(node, '|'); |
| 1278 visitBitXor(HBitXor node) => visitBitInvokeBinary(node, '^'); | 1281 visitBitXor(HBitXor node) => visitBitInvokeBinary(node, '^'); |
| 1279 visitShiftLeft(HShiftLeft node) => visitBitInvokeBinary(node, '<<'); | 1282 visitShiftLeft(HShiftLeft node) => visitBitInvokeBinary(node, '<<'); |
| 1283 visitShiftRight(HShiftRight node) => visitBitInvokeBinary(node, '>>>'); |
| 1280 | 1284 |
| 1281 visitNegate(HNegate node) => visitInvokeUnary(node, '-'); | 1285 visitNegate(HNegate node) => visitInvokeUnary(node, '-'); |
| 1282 | 1286 |
| 1283 visitLess(HLess node) => visitRelational(node, '<'); | 1287 visitLess(HLess node) => visitRelational(node, '<'); |
| 1284 visitLessEqual(HLessEqual node) => visitRelational(node, '<='); | 1288 visitLessEqual(HLessEqual node) => visitRelational(node, '<='); |
| 1285 visitGreater(HGreater node) => visitRelational(node, '>'); | 1289 visitGreater(HGreater node) => visitRelational(node, '>'); |
| 1286 visitGreaterEqual(HGreaterEqual node) => visitRelational(node, '>='); | 1290 visitGreaterEqual(HGreaterEqual node) => visitRelational(node, '>='); |
| 1287 | 1291 |
| 1288 visitBoolify(HBoolify node) { | 1292 visitBoolify(HBoolify node) { |
| 1289 assert(node.inputs.length == 1); | 1293 assert(node.inputs.length == 1); |
| (...skipping 1288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2578 if (left.isConstantNull() || right.isConstantNull() || | 2582 if (left.isConstantNull() || right.isConstantNull() || |
| 2579 (left.isPrimitive(compiler) && | 2583 (left.isPrimitive(compiler) && |
| 2580 left.instructionType == right.instructionType)) { | 2584 left.instructionType == right.instructionType)) { |
| 2581 return '=='; | 2585 return '=='; |
| 2582 } | 2586 } |
| 2583 return null; | 2587 return null; |
| 2584 } else { | 2588 } else { |
| 2585 return '==='; | 2589 return '==='; |
| 2586 } | 2590 } |
| 2587 } | 2591 } |
| OLD | NEW |