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) { | |
floitsch
2013/12/10 15:45:16
Maybe add an assert that left and right are of the
ngeoffray
2013/12/10 15:48:15
Done.
| |
1253 use(node.left); | |
1254 js.Expression jsLeft = pop(); | |
1255 use(node.right); | |
1256 push(new js.Binary('/', jsLeft, pop()), node); | |
1257 push(new js.Binary('|', pop(), new js.LiteralNumber("0")), node); | |
1258 } | |
1259 | |
1252 visitNegate(HNegate node) => visitInvokeUnary(node, '-'); | 1260 visitNegate(HNegate node) => visitInvokeUnary(node, '-'); |
1253 | 1261 |
1254 visitLess(HLess node) => visitRelational(node, '<'); | 1262 visitLess(HLess node) => visitRelational(node, '<'); |
1255 visitLessEqual(HLessEqual node) => visitRelational(node, '<='); | 1263 visitLessEqual(HLessEqual node) => visitRelational(node, '<='); |
1256 visitGreater(HGreater node) => visitRelational(node, '>'); | 1264 visitGreater(HGreater node) => visitRelational(node, '>'); |
1257 visitGreaterEqual(HGreaterEqual node) => visitRelational(node, '>='); | 1265 visitGreaterEqual(HGreaterEqual node) => visitRelational(node, '>='); |
1258 | 1266 |
1259 visitBoolify(HBoolify node) { | 1267 visitBoolify(HBoolify node) { |
1260 assert(node.inputs.length == 1); | 1268 assert(node.inputs.length == 1); |
1261 use(node.inputs[0]); | 1269 use(node.inputs[0]); |
(...skipping 1398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2660 if (left.isConstantNull() || right.isConstantNull() || | 2668 if (left.isConstantNull() || right.isConstantNull() || |
2661 (left.isPrimitive(compiler) && | 2669 (left.isPrimitive(compiler) && |
2662 left.instructionType == right.instructionType)) { | 2670 left.instructionType == right.instructionType)) { |
2663 return '=='; | 2671 return '=='; |
2664 } | 2672 } |
2665 return null; | 2673 return null; |
2666 } else { | 2674 } else { |
2667 return '==='; | 2675 return '==='; |
2668 } | 2676 } |
2669 } | 2677 } |
OLD | NEW |