| 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 2134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2145 if (element.kind == ElementKind.FUNCTION || | 2145 if (element.kind == ElementKind.FUNCTION || |
| 2146 element.kind == ElementKind.GENERATIVE_CONSTRUCTOR) { | 2146 element.kind == ElementKind.GENERATIVE_CONSTRUCTOR) { |
| 2147 bool succeeded = addStaticSendArgumentsToList(selector, node.arguments, | 2147 bool succeeded = addStaticSendArgumentsToList(selector, node.arguments, |
| 2148 element, inputs); | 2148 element, inputs); |
| 2149 if (!succeeded) { | 2149 if (!succeeded) { |
| 2150 // TODO(ngeoffray): Match the VM behavior and throw an | 2150 // TODO(ngeoffray): Match the VM behavior and throw an |
| 2151 // exception at runtime. | 2151 // exception at runtime. |
| 2152 compiler.cancel('Unimplemented non-matching static call', node: node); | 2152 compiler.cancel('Unimplemented non-matching static call', node: node); |
| 2153 } | 2153 } |
| 2154 HType type = HType.UNKNOWN; | 2154 HType type = HType.UNKNOWN; |
| 2155 if (element.isGenerativeConstructor()) { | 2155 Element originalElement = elements[node]; |
| 2156 ClassElement cls = element.enclosingElement; | 2156 if (originalElement.isGenerativeConstructor()) { |
| 2157 type = new HNonPrimitiveType(cls.type); | 2157 ClassElement cls = originalElement.enclosingElement; |
| 2158 } else if (element.isFactoryConstructor() | 2158 if (cls === compiler.listClass) { |
| 2159 && element === compiler.listClass) { | 2159 type = HType.MUTABLE_ARRAY; |
| 2160 type = HType.MUTABLE_ARRAY; | 2160 } else { |
| 2161 type = new HNonPrimitiveType(cls.type); |
| 2162 } |
| 2161 } | 2163 } |
| 2162 push(new HInvokeStatic(selector, inputs, type)); | 2164 push(new HInvokeStatic(selector, inputs, type)); |
| 2163 } else { | 2165 } else { |
| 2164 if (element.kind == ElementKind.GETTER) { | 2166 if (element.kind == ElementKind.GETTER) { |
| 2165 target = new HInvokeStatic(Selector.GETTER, inputs); | 2167 target = new HInvokeStatic(Selector.GETTER, inputs); |
| 2166 add(target); | 2168 add(target); |
| 2167 inputs = <HInstruction>[target]; | 2169 inputs = <HInstruction>[target]; |
| 2168 } | 2170 } |
| 2169 addDynamicSendArgumentsToList(node, inputs); | 2171 addDynamicSendArgumentsToList(node, inputs); |
| 2170 push(new HInvokeClosure(selector, inputs)); | 2172 push(new HInvokeClosure(selector, inputs)); |
| (...skipping 936 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3107 false, | 3109 false, |
| 3108 <HInstruction>[target, input])); | 3110 <HInstruction>[target, input])); |
| 3109 return builder.pop(); | 3111 return builder.pop(); |
| 3110 } | 3112 } |
| 3111 | 3113 |
| 3112 HInstruction result() { | 3114 HInstruction result() { |
| 3113 flushLiterals(); | 3115 flushLiterals(); |
| 3114 return prefix; | 3116 return prefix; |
| 3115 } | 3117 } |
| 3116 } | 3118 } |
| OLD | NEW |