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 final SourceInformationFactory sourceInformationFactory; | 10 final SourceInformationFactory sourceInformationFactory; |
(...skipping 1266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1277 visitMultiply(HMultiply node) => visitInvokeBinary(node, '*'); | 1277 visitMultiply(HMultiply node) => visitInvokeBinary(node, '*'); |
1278 visitSubtract(HSubtract node) => visitInvokeBinary(node, '-'); | 1278 visitSubtract(HSubtract node) => visitInvokeBinary(node, '-'); |
1279 visitBitAnd(HBitAnd node) => visitBitInvokeBinary(node, '&'); | 1279 visitBitAnd(HBitAnd node) => visitBitInvokeBinary(node, '&'); |
1280 visitBitNot(HBitNot node) => visitBitInvokeUnary(node, '~'); | 1280 visitBitNot(HBitNot node) => visitBitInvokeUnary(node, '~'); |
1281 visitBitOr(HBitOr node) => visitBitInvokeBinary(node, '|'); | 1281 visitBitOr(HBitOr node) => visitBitInvokeBinary(node, '|'); |
1282 visitBitXor(HBitXor node) => visitBitInvokeBinary(node, '^'); | 1282 visitBitXor(HBitXor node) => visitBitInvokeBinary(node, '^'); |
1283 visitShiftLeft(HShiftLeft node) => visitBitInvokeBinary(node, '<<'); | 1283 visitShiftLeft(HShiftLeft node) => visitBitInvokeBinary(node, '<<'); |
1284 visitShiftRight(HShiftRight node) => visitBitInvokeBinary(node, '>>>'); | 1284 visitShiftRight(HShiftRight node) => visitBitInvokeBinary(node, '>>>'); |
1285 | 1285 |
1286 visitTruncatingDivide(HTruncatingDivide node) { | 1286 visitTruncatingDivide(HTruncatingDivide node) { |
1287 assert(node.left.isUInt31(compiler)); | 1287 assert(node.isUInt31(compiler)); |
| 1288 assert(node.left.isUInt32(compiler)); |
1288 assert(node.right.isPositiveInteger(compiler)); | 1289 assert(node.right.isPositiveInteger(compiler)); |
1289 use(node.left); | 1290 use(node.left); |
1290 js.Expression jsLeft = pop(); | 1291 js.Expression jsLeft = pop(); |
1291 use(node.right); | 1292 use(node.right); |
1292 push(new js.Binary('/', jsLeft, pop()), node); | 1293 push(new js.Binary('/', jsLeft, pop()), node); |
1293 push(new js.Binary('|', pop(), new js.LiteralNumber("0")), node); | 1294 push(new js.Binary('|', pop(), new js.LiteralNumber("0")), node); |
1294 } | 1295 } |
1295 | 1296 |
1296 visitNegate(HNegate node) => visitInvokeUnary(node, '-'); | 1297 visitNegate(HNegate node) => visitInvokeUnary(node, '-'); |
1297 | 1298 |
(...skipping 1427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2725 js.PropertyAccess accessHelper(String name) { | 2726 js.PropertyAccess accessHelper(String name) { |
2726 Element helper = backend.findHelper(name); | 2727 Element helper = backend.findHelper(name); |
2727 if (helper == null) { | 2728 if (helper == null) { |
2728 // For mocked-up tests. | 2729 // For mocked-up tests. |
2729 return js.js('(void 0).$name'); | 2730 return js.js('(void 0).$name'); |
2730 } | 2731 } |
2731 registry.registerStaticUse(helper); | 2732 registry.registerStaticUse(helper); |
2732 return backend.emitter.staticFunctionAccess(helper); | 2733 return backend.emitter.staticFunctionAccess(helper); |
2733 } | 2734 } |
2734 } | 2735 } |
OLD | NEW |