| 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 class Interceptors { | 5 class Interceptors { |
| 6 Compiler compiler; | 6 Compiler compiler; |
| 7 Interceptors(Compiler this.compiler); | 7 Interceptors(Compiler this.compiler); |
| 8 | 8 |
| 9 SourceString mapOperatorToMethodName(Operator op) { | 9 SourceString mapOperatorToMethodName(Operator op) { |
| 10 String name = op.source.stringValue; | 10 String name = op.source.stringValue; |
| 11 if (name === '-') return const SourceString('neg'); | 11 if (name === '-') return const SourceString('neg'); |
| 12 if (name === '+') return const SourceString('add'); | 12 if (name === '+') return const SourceString('add'); |
| 13 if (name === '-') return const SourceString('sub'); | 13 if (name === '-') return const SourceString('sub'); |
| 14 if (name === '*') return const SourceString('mul'); | 14 if (name === '*') return const SourceString('mul'); |
| 15 if (name === '/') return const SourceString('div'); | 15 if (name === '/') return const SourceString('div'); |
| 16 if (name === '~/') return const SourceString('tdiv'); | 16 if (name === '~/') return const SourceString('tdiv'); |
| 17 if (name === '%') return const SourceString('mod'); | 17 if (name === '%') return const SourceString('mod'); |
| 18 if (name === '<<') return const SourceString('shl'); | 18 if (name === '<<') return const SourceString('shl'); |
| 19 if (name === '>>') return const SourceString('shr'); | 19 if (name === '>>') return const SourceString('shr'); |
| 20 if (name === '|') return const SourceString('or'); | 20 if (name === '|') return const SourceString('or'); |
| 21 if (name === '&') return const SourceString('and'); | 21 if (name === '&') return const SourceString('and'); |
| 22 if (name === '^') return const SourceString('xor'); | 22 if (name === '^') return const SourceString('xor'); |
| 23 if (name === '<') return const SourceString('lt'); | 23 if (name === '<') return const SourceString('lt'); |
| 24 if (name === '<=') return const SourceString('le'); | 24 if (name === '<=') return const SourceString('le'); |
| 25 if (name === '>') return const SourceString('gt'); | 25 if (name === '>') return const SourceString('gt'); |
| 26 if (name === '>=') return const SourceString('ge'); | 26 if (name === '>=') return const SourceString('ge'); |
| 27 if (name === '==') return const SourceString('eq'); | 27 if (name === '==') return const SourceString('eq'); |
| 28 if (name === '!=') return const SourceString('eq'); | 28 if (name === '!=') return const SourceString('eq'); |
| 29 if (name === '===') return const SourceString('eqq'); |
| 30 if (name === '!==') return const SourceString('eqq'); |
| 29 if (name === '+=') return const SourceString('add'); | 31 if (name === '+=') return const SourceString('add'); |
| 30 if (name === '-=') return const SourceString('sub'); | 32 if (name === '-=') return const SourceString('sub'); |
| 31 if (name === '*=') return const SourceString('mul'); | 33 if (name === '*=') return const SourceString('mul'); |
| 32 if (name === '/=') return const SourceString('div'); | 34 if (name === '/=') return const SourceString('div'); |
| 33 if (name === '~/=') return const SourceString('tdiv'); | 35 if (name === '~/=') return const SourceString('tdiv'); |
| 34 if (name === '%=') return const SourceString('mod'); | 36 if (name === '%=') return const SourceString('mod'); |
| 35 if (name === '<<=') return const SourceString('shl'); | 37 if (name === '<<=') return const SourceString('shl'); |
| 36 if (name === '>>=') return const SourceString('shr'); | 38 if (name === '>>=') return const SourceString('shr'); |
| 37 if (name === '|=') return const SourceString('or'); | 39 if (name === '|=') return const SourceString('or'); |
| 38 if (name === '&=') return const SourceString('and'); | 40 if (name === '&=') return const SourceString('and'); |
| (...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 723 case "&=": | 725 case "&=": |
| 724 push(new HBitAnd(target, left, right)); | 726 push(new HBitAnd(target, left, right)); |
| 725 break; | 727 break; |
| 726 case "^": | 728 case "^": |
| 727 case "^=": | 729 case "^=": |
| 728 push(new HBitXor(target, left, right)); | 730 push(new HBitXor(target, left, right)); |
| 729 break; | 731 break; |
| 730 case "==": | 732 case "==": |
| 731 push(new HEquals(target, left, right)); | 733 push(new HEquals(target, left, right)); |
| 732 break; | 734 break; |
| 735 case "===": |
| 736 push(new HIdentity(target, left, right)); |
| 737 break; |
| 738 case "!==": |
| 739 HIdentity eq = new HIdentity(target, left, right); |
| 740 add(eq); |
| 741 push(new HNot(eq)); |
| 742 break; |
| 733 case "<": | 743 case "<": |
| 734 push(new HLess(target, left, right)); | 744 push(new HLess(target, left, right)); |
| 735 break; | 745 break; |
| 736 case "<=": | 746 case "<=": |
| 737 push(new HLessEqual(target, left, right)); | 747 push(new HLessEqual(target, left, right)); |
| 738 break; | 748 break; |
| 739 case ">": | 749 case ">": |
| 740 push(new HGreater(target, left, right)); | 750 push(new HGreater(target, left, right)); |
| 741 break; | 751 break; |
| 742 case ">=": | 752 case ">=": |
| (...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1228 } | 1238 } |
| 1229 | 1239 |
| 1230 visitCatchBlock(CatchBlock node) { | 1240 visitCatchBlock(CatchBlock node) { |
| 1231 compiler.unimplemented('SsaBuilder.visitCatchBlock', node: node); | 1241 compiler.unimplemented('SsaBuilder.visitCatchBlock', node: node); |
| 1232 } | 1242 } |
| 1233 | 1243 |
| 1234 visitTypedef(Typedef node) { | 1244 visitTypedef(Typedef node) { |
| 1235 compiler.unimplemented('SsaBuilder.visitTypedef', node: node); | 1245 compiler.unimplemented('SsaBuilder.visitTypedef', node: node); |
| 1236 } | 1246 } |
| 1237 } | 1247 } |
| OLD | NEW |