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/backend_api.dart' show BackendClasses; | 5 import '../common/backend_api.dart' show BackendClasses; |
6 import '../compiler.dart' show Compiler; | 6 import '../compiler.dart' show Compiler; |
7 import '../constants/constant_system.dart'; | 7 import '../constants/constant_system.dart'; |
8 import '../constants/values.dart'; | 8 import '../constants/values.dart'; |
9 import '../elements/entities.dart'; | 9 import '../elements/entities.dart'; |
10 import '../js_backend/backend.dart'; | 10 import '../js_backend/backend.dart'; |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 block.addAfter(user, replacement); | 345 block.addAfter(user, replacement); |
346 block.rewrite(user, replacement); | 346 block.rewrite(user, replacement); |
347 block.remove(user); | 347 block.remove(user); |
348 return false; | 348 return false; |
349 } | 349 } |
350 | 350 |
351 if (user is HIs) { | 351 if (user is HIs) { |
352 // See if we can rewrite the is-check to use 'instanceof', i.e. rewrite | 352 // See if we can rewrite the is-check to use 'instanceof', i.e. rewrite |
353 // "getInterceptor(x).$isT" to "x instanceof T". | 353 // "getInterceptor(x).$isT" to "x instanceof T". |
354 if (node == user.interceptor) { | 354 if (node == user.interceptor) { |
355 if (backend.mayGenerateInstanceofCheck(user.typeExpression)) { | 355 if (backend.interceptorData |
| 356 .mayGenerateInstanceofCheck(user.typeExpression)) { |
356 HInstruction instanceofCheck = new HIs.instanceOf( | 357 HInstruction instanceofCheck = new HIs.instanceOf( |
357 user.typeExpression, user.expression, user.instructionType); | 358 user.typeExpression, user.expression, user.instructionType); |
358 instanceofCheck.sourceInformation = user.sourceInformation; | 359 instanceofCheck.sourceInformation = user.sourceInformation; |
359 instanceofCheck.sourceElement = user.sourceElement; | 360 instanceofCheck.sourceElement = user.sourceElement; |
360 return replaceUserWith(instanceofCheck); | 361 return replaceUserWith(instanceofCheck); |
361 } | 362 } |
362 } | 363 } |
363 } else if (user is HInvokeDynamic) { | 364 } else if (user is HInvokeDynamic) { |
364 if (node == user.inputs[0]) { | 365 if (node == user.inputs[0]) { |
365 // Replace the user with a [HOneShotInterceptor]. | 366 // Replace the user with a [HOneShotInterceptor]. |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 instruction = new HInvokeDynamicMethod( | 423 instruction = new HInvokeDynamicMethod( |
423 selector, mask, inputs, node.instructionType, true); | 424 selector, mask, inputs, node.instructionType, true); |
424 } | 425 } |
425 | 426 |
426 HBasicBlock block = node.block; | 427 HBasicBlock block = node.block; |
427 block.addAfter(node, instruction); | 428 block.addAfter(node, instruction); |
428 block.rewrite(node, instruction); | 429 block.rewrite(node, instruction); |
429 return true; | 430 return true; |
430 } | 431 } |
431 } | 432 } |
OLD | NEW |