| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 import '../common_elements.dart' show CommonElements; | 5 import '../common_elements.dart' show CommonElements; |
| 6 import '../constants/constant_system.dart'; | 6 import '../constants/constant_system.dart'; |
| 7 import '../constants/values.dart'; | 7 import '../constants/values.dart'; |
| 8 import '../elements/entities.dart'; | 8 import '../elements/entities.dart'; |
| 9 import '../js_backend/interceptor_data.dart'; | 9 import '../js_backend/interceptor_data.dart'; |
| 10 import '../types/types.dart'; | 10 import '../types/types.dart'; |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 !(interceptedClasses.contains(_commonElements.jsDoubleClass) || | 231 !(interceptedClasses.contains(_commonElements.jsDoubleClass) || |
| 232 interceptedClasses.contains(_commonElements.jsIntClass))) { | 232 interceptedClasses.contains(_commonElements.jsIntClass))) { |
| 233 Set<ClassEntity> required; | 233 Set<ClassEntity> required; |
| 234 for (HInstruction user in node.usedBy) { | 234 for (HInstruction user in node.usedBy) { |
| 235 if (user is! HInvoke) continue; | 235 if (user is! HInvoke) continue; |
| 236 Set<ClassEntity> intercepted = interceptorData | 236 Set<ClassEntity> intercepted = interceptorData |
| 237 .getInterceptedClassesOn(user.selector.name, closedWorld); | 237 .getInterceptedClassesOn(user.selector.name, closedWorld); |
| 238 if (intercepted.contains(_commonElements.jsIntClass)) { | 238 if (intercepted.contains(_commonElements.jsIntClass)) { |
| 239 // TODO(johnniwinther): Use type argument when all uses of | 239 // TODO(johnniwinther): Use type argument when all uses of |
| 240 // intercepted classes expect entities instead of elements. | 240 // intercepted classes expect entities instead of elements. |
| 241 required ??= new Set/*<ClassEntity>*/(); | 241 required ??= new Set<ClassEntity>(); |
| 242 required.add(_commonElements.jsIntClass); | 242 required.add(_commonElements.jsIntClass); |
| 243 } | 243 } |
| 244 if (intercepted.contains(_commonElements.jsDoubleClass)) { | 244 if (intercepted.contains(_commonElements.jsDoubleClass)) { |
| 245 // TODO(johnniwinther): Use type argument when all uses of | 245 // TODO(johnniwinther): Use type argument when all uses of |
| 246 // intercepted classes expect entities instead of elements. | 246 // intercepted classes expect entities instead of elements. |
| 247 required ??= new Set/*<ClassEntity>*/(); | 247 required ??= new Set<ClassEntity>(); |
| 248 required.add(_commonElements.jsDoubleClass); | 248 required.add(_commonElements.jsDoubleClass); |
| 249 } | 249 } |
| 250 } | 250 } |
| 251 // Don't modify the result of [interceptorData.getInterceptedClassesOn]. | 251 // Don't modify the result of [interceptorData.getInterceptedClassesOn]. |
| 252 if (required != null) { | 252 if (required != null) { |
| 253 interceptedClasses = interceptedClasses.union(required); | 253 interceptedClasses = interceptedClasses.union(required); |
| 254 } | 254 } |
| 255 } | 255 } |
| 256 } else { | 256 } else { |
| 257 // TODO(johnniwinther): Use type argument when all uses of intercepted | 257 // TODO(johnniwinther): Use type argument when all uses of intercepted |
| 258 // classes expect entities instead of elements. | 258 // classes expect entities instead of elements. |
| 259 interceptedClasses = new Set/*<ClassEntity>*/(); | 259 interceptedClasses = new Set<ClassEntity>(); |
| 260 for (HInstruction user in node.usedBy) { | 260 for (HInstruction user in node.usedBy) { |
| 261 if (user is HInvokeDynamic && | 261 if (user is HInvokeDynamic && |
| 262 user.isCallOnInterceptor(closedWorld) && | 262 user.isCallOnInterceptor(closedWorld) && |
| 263 node == user.receiver && | 263 node == user.receiver && |
| 264 useCount(user, node) == 1) { | 264 useCount(user, node) == 1) { |
| 265 interceptedClasses.addAll(interceptorData.getInterceptedClassesOn( | 265 interceptedClasses.addAll(interceptorData.getInterceptedClassesOn( |
| 266 user.selector.name, closedWorld)); | 266 user.selector.name, closedWorld)); |
| 267 } else if (user is HInvokeSuper && | 267 } else if (user is HInvokeSuper && |
| 268 user.isCallOnInterceptor(closedWorld) && | 268 user.isCallOnInterceptor(closedWorld) && |
| 269 node == user.receiver && | 269 node == user.receiver && |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 instruction = new HInvokeDynamicMethod( | 421 instruction = new HInvokeDynamicMethod( |
| 422 selector, mask, inputs, node.instructionType, true); | 422 selector, mask, inputs, node.instructionType, true); |
| 423 } | 423 } |
| 424 | 424 |
| 425 HBasicBlock block = node.block; | 425 HBasicBlock block = node.block; |
| 426 block.addAfter(node, instruction); | 426 block.addAfter(node, instruction); |
| 427 block.rewrite(node, instruction); | 427 block.rewrite(node, instruction); |
| 428 return true; | 428 return true; |
| 429 } | 429 } |
| 430 } | 430 } |
| OLD | NEW |