| 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 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; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 if (name === '|=') return const SourceString('or'); | 38 if (name === '|=') return const SourceString('or'); |
| 39 if (name === '&=') return const SourceString('and'); | 39 if (name === '&=') return const SourceString('and'); |
| 40 if (name === '^=') return const SourceString('xor'); | 40 if (name === '^=') return const SourceString('xor'); |
| 41 if (name === '++') return const SourceString('add'); | 41 if (name === '++') return const SourceString('add'); |
| 42 if (name === '--') return const SourceString('sub'); | 42 if (name === '--') return const SourceString('sub'); |
| 43 compiler.unimplemented('Unknown operator', node: op); | 43 compiler.unimplemented('Unknown operator', node: op); |
| 44 } | 44 } |
| 45 | 45 |
| 46 Element getStaticInterceptor(SourceString name, int parameters) { | 46 Element getStaticInterceptor(SourceString name, int parameters) { |
| 47 String mangledName = "builtin\$${name.slowToString()}\$${parameters}"; | 47 String mangledName = "builtin\$${name.slowToString()}\$${parameters}"; |
| 48 return compiler.findHelper(new SourceString(mangledName)); | 48 Element result = compiler.findHelper(new SourceString(mangledName)); |
| 49 return result; |
| 49 } | 50 } |
| 50 | 51 |
| 51 Element getStaticGetInterceptor(SourceString name) { | 52 Element getStaticGetInterceptor(SourceString name) { |
| 52 String mangledName = "builtin\$get\$${name.slowToString()}"; | 53 String mangledName = "builtin\$get\$${name.slowToString()}"; |
| 53 return compiler.findHelper(new SourceString(mangledName)); | 54 Element result = compiler.findHelper(new SourceString(mangledName)); |
| 55 return result; |
| 54 } | 56 } |
| 55 | 57 |
| 56 Element getStaticSetInterceptor(SourceString name) { | 58 Element getStaticSetInterceptor(SourceString name) { |
| 57 String mangledName = "builtin\$set\$${name.slowToString()}"; | 59 String mangledName = "builtin\$set\$${name.slowToString()}"; |
| 58 return compiler.findHelper(new SourceString(mangledName)); | 60 Element result = compiler.findHelper(new SourceString(mangledName)); |
| 61 return result; |
| 59 } | 62 } |
| 60 | 63 |
| 61 Element getOperatorInterceptor(Operator op) { | 64 Element getOperatorInterceptor(Operator op) { |
| 62 SourceString name = mapOperatorToMethodName(op); | 65 SourceString name = mapOperatorToMethodName(op); |
| 63 return compiler.findHelper(name); | 66 Element result = compiler.findHelper(name); |
| 64 } | 67 return result; |
| 65 | |
| 66 Element getBoolifiedVersionOf(Element interceptor) { | |
| 67 String boolifiedName = "${interceptor.name.slowToString()}B"; | |
| 68 return compiler.findHelper(new SourceString(boolifiedName)); | |
| 69 } | 68 } |
| 70 | 69 |
| 71 Element getPrefixOperatorInterceptor(Operator op) { | 70 Element getPrefixOperatorInterceptor(Operator op) { |
| 72 String name = op.source.stringValue; | 71 String name = op.source.stringValue; |
| 73 if (name === '~') { | 72 if (name === '~') { |
| 74 return compiler.findHelper(const SourceString('not')); | 73 return compiler.findHelper(const SourceString('not')); |
| 75 } | 74 } |
| 76 if (name === '-') { | 75 if (name === '-') { |
| 77 return compiler.findHelper(const SourceString('neg')); | 76 return compiler.findHelper(const SourceString('neg')); |
| 78 } | 77 } |
| (...skipping 3044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3123 false, | 3122 false, |
| 3124 <HInstruction>[target, input])); | 3123 <HInstruction>[target, input])); |
| 3125 return builder.pop(); | 3124 return builder.pop(); |
| 3126 } | 3125 } |
| 3127 | 3126 |
| 3128 HInstruction result() { | 3127 HInstruction result() { |
| 3129 flushLiterals(); | 3128 flushLiterals(); |
| 3130 return prefix; | 3129 return prefix; |
| 3131 } | 3130 } |
| 3132 } | 3131 } |
| OLD | NEW |