| 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}\$${parameters}"; | 47 String mangledName = "builtin\$${name}\$${parameters}"; |
| 48 Element result = compiler.coreLibrary.find(new SourceString(mangledName)); | 48 Element result = compiler.findHelper(new SourceString(mangledName)); |
| 49 return result; | 49 return result; |
| 50 } | 50 } |
| 51 | 51 |
| 52 Element getStaticGetInterceptor(SourceString name) { | 52 Element getStaticGetInterceptor(SourceString name) { |
| 53 String mangledName = "builtin\$get\$${name}"; | 53 String mangledName = "builtin\$get\$${name}"; |
| 54 Element result = compiler.coreLibrary.find(new SourceString(mangledName)); | 54 Element result = compiler.findHelper(new SourceString(mangledName)); |
| 55 return result; | 55 return result; |
| 56 } | 56 } |
| 57 | 57 |
| 58 Element getOperatorInterceptor(Operator op) { | 58 Element getOperatorInterceptor(Operator op) { |
| 59 SourceString name = mapOperatorToMethodName(op); | 59 SourceString name = mapOperatorToMethodName(op); |
| 60 Element result = compiler.coreLibrary.find(name); | 60 Element result = compiler.findHelper(name); |
| 61 return result; | 61 return result; |
| 62 } | 62 } |
| 63 | 63 |
| 64 Element getPrefixOperatorInterceptor(Operator op) { | 64 Element getPrefixOperatorInterceptor(Operator op) { |
| 65 String name = op.source.stringValue; | 65 String name = op.source.stringValue; |
| 66 if (name === '~') { | 66 if (name === '~') { |
| 67 return compiler.coreLibrary.find(const SourceString('not')); | 67 return compiler.findHelper(const SourceString('not')); |
| 68 } | 68 } |
| 69 if (name === '-') { | 69 if (name === '-') { |
| 70 return compiler.coreLibrary.find(const SourceString('neg')); | 70 return compiler.findHelper(const SourceString('neg')); |
| 71 } | 71 } |
| 72 compiler.unimplemented('Unknown operator', node: op); | 72 compiler.unimplemented('Unknown operator', node: op); |
| 73 } | 73 } |
| 74 | 74 |
| 75 Element getIndexInterceptor() { | 75 Element getIndexInterceptor() { |
| 76 return compiler.coreLibrary.find(const SourceString('index')); | 76 return compiler.findHelper(const SourceString('index')); |
| 77 } | 77 } |
| 78 | 78 |
| 79 Element getIndexAssignmentInterceptor() { | 79 Element getIndexAssignmentInterceptor() { |
| 80 return compiler.coreLibrary.find(const SourceString('indexSet')); | 80 return compiler.findHelper(const SourceString('indexSet')); |
| 81 } | 81 } |
| 82 | 82 |
| 83 Element getEqualsNullInterceptor() { | 83 Element getEqualsNullInterceptor() { |
| 84 return compiler.coreLibrary.find(const SourceString('eqNull')); | 84 return compiler.findHelper(const SourceString('eqNull')); |
| 85 } | 85 } |
| 86 } | 86 } |
| 87 | 87 |
| 88 class SsaBuilderTask extends CompilerTask { | 88 class SsaBuilderTask extends CompilerTask { |
| 89 SsaBuilderTask(Compiler compiler) | 89 SsaBuilderTask(Compiler compiler) |
| 90 : super(compiler), interceptors = new Interceptors(compiler); | 90 : super(compiler), interceptors = new Interceptors(compiler); |
| 91 String get name() => 'SSA builder'; | 91 String get name() => 'SSA builder'; |
| 92 Interceptors interceptors; | 92 Interceptors interceptors; |
| 93 | 93 |
| 94 HGraph build(WorkItem work) { | 94 HGraph build(WorkItem work) { |
| (...skipping 1809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1904 } | 1904 } |
| 1905 | 1905 |
| 1906 visitCatchBlock(CatchBlock node) { | 1906 visitCatchBlock(CatchBlock node) { |
| 1907 visit(node.block); | 1907 visit(node.block); |
| 1908 } | 1908 } |
| 1909 | 1909 |
| 1910 visitTypedef(Typedef node) { | 1910 visitTypedef(Typedef node) { |
| 1911 compiler.unimplemented('SsaBuilder.visitTypedef', node: node); | 1911 compiler.unimplemented('SsaBuilder.visitTypedef', node: node); |
| 1912 } | 1912 } |
| 1913 } | 1913 } |
| OLD | NEW |