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 1231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1242 visitDivide(HDivide node) => visitInvokeBinary(node, '/'); | 1242 visitDivide(HDivide node) => visitInvokeBinary(node, '/'); |
1243 visitMultiply(HMultiply node) => visitInvokeBinary(node, '*'); | 1243 visitMultiply(HMultiply node) => visitInvokeBinary(node, '*'); |
1244 visitSubtract(HSubtract node) => visitInvokeBinary(node, '-'); | 1244 visitSubtract(HSubtract node) => visitInvokeBinary(node, '-'); |
1245 visitBitAnd(HBitAnd node) => visitBitInvokeBinary(node, '&'); | 1245 visitBitAnd(HBitAnd node) => visitBitInvokeBinary(node, '&'); |
1246 visitBitNot(HBitNot node) => visitBitInvokeUnary(node, '~'); | 1246 visitBitNot(HBitNot node) => visitBitInvokeUnary(node, '~'); |
1247 visitBitOr(HBitOr node) => visitBitInvokeBinary(node, '|'); | 1247 visitBitOr(HBitOr node) => visitBitInvokeBinary(node, '|'); |
1248 visitBitXor(HBitXor node) => visitBitInvokeBinary(node, '^'); | 1248 visitBitXor(HBitXor node) => visitBitInvokeBinary(node, '^'); |
1249 visitShiftLeft(HShiftLeft node) => visitBitInvokeBinary(node, '<<'); | 1249 visitShiftLeft(HShiftLeft node) => visitBitInvokeBinary(node, '<<'); |
1250 visitShiftRight(HShiftRight node) => visitBitInvokeBinary(node, '>>>'); | 1250 visitShiftRight(HShiftRight node) => visitBitInvokeBinary(node, '>>>'); |
1251 | 1251 |
| 1252 visitTruncatingDivide(HTruncatingDivide node) { |
| 1253 assert(node.left.isUInt31(compiler)); |
| 1254 assert(node.right.isPositiveInteger(compiler)); |
| 1255 use(node.left); |
| 1256 js.Expression jsLeft = pop(); |
| 1257 use(node.right); |
| 1258 push(new js.Binary('/', jsLeft, pop()), node); |
| 1259 push(new js.Binary('|', pop(), new js.LiteralNumber("0")), node); |
| 1260 } |
| 1261 |
1252 visitNegate(HNegate node) => visitInvokeUnary(node, '-'); | 1262 visitNegate(HNegate node) => visitInvokeUnary(node, '-'); |
1253 | 1263 |
1254 visitLess(HLess node) => visitRelational(node, '<'); | 1264 visitLess(HLess node) => visitRelational(node, '<'); |
1255 visitLessEqual(HLessEqual node) => visitRelational(node, '<='); | 1265 visitLessEqual(HLessEqual node) => visitRelational(node, '<='); |
1256 visitGreater(HGreater node) => visitRelational(node, '>'); | 1266 visitGreater(HGreater node) => visitRelational(node, '>'); |
1257 visitGreaterEqual(HGreaterEqual node) => visitRelational(node, '>='); | 1267 visitGreaterEqual(HGreaterEqual node) => visitRelational(node, '>='); |
1258 | 1268 |
1259 visitBoolify(HBoolify node) { | 1269 visitBoolify(HBoolify node) { |
1260 assert(node.inputs.length == 1); | 1270 assert(node.inputs.length == 1); |
1261 use(node.inputs[0]); | 1271 use(node.inputs[0]); |
(...skipping 1398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2660 if (left.isConstantNull() || right.isConstantNull() || | 2670 if (left.isConstantNull() || right.isConstantNull() || |
2661 (left.isPrimitive(compiler) && | 2671 (left.isPrimitive(compiler) && |
2662 left.instructionType == right.instructionType)) { | 2672 left.instructionType == right.instructionType)) { |
2663 return '=='; | 2673 return '=='; |
2664 } | 2674 } |
2665 return null; | 2675 return null; |
2666 } else { | 2676 } else { |
2667 return '==='; | 2677 return '==='; |
2668 } | 2678 } |
2669 } | 2679 } |
OLD | NEW |