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 import '../compiler.dart' show Compiler; | 5 import '../compiler.dart' show Compiler; |
6 import '../constants/values.dart'; | 6 import '../constants/values.dart'; |
7 import '../elements/elements.dart'; | 7 import '../elements/elements.dart'; |
8 import '../js_backend/js_backend.dart'; | 8 import '../js_backend/js_backend.dart'; |
9 import '../types/types.dart'; | 9 import '../types/types.dart'; |
10 import '../universe/selector.dart' show Selector; | 10 import '../universe/selector.dart' show Selector; |
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 // to be generated at use site, and only analyze all other arguments. | 433 // to be generated at use site, and only analyze all other arguments. |
434 if (!backend.canUseAliasedSuperMember(superMethod, selector)) { | 434 if (!backend.canUseAliasedSuperMember(superMethod, selector)) { |
435 analyzeInputs(instruction, 1); | 435 analyzeInputs(instruction, 1); |
436 } else { | 436 } else { |
437 super.visitInvokeSuper(instruction); | 437 super.visitInvokeSuper(instruction); |
438 } | 438 } |
439 } | 439 } |
440 | 440 |
441 void visitIs(HIs instruction) { | 441 void visitIs(HIs instruction) { |
442 // In the general case the input might be used multple multiple times, so it | 442 // In the general case the input might be used multple multiple times, so it |
443 // must not be set generate at use site. If the code will generate | 443 // must not be set generate at use site. |
444 // 'instanceof' then we can generate at use site. | 444 |
| 445 // If the code will generate 'instanceof' then we can generate at use site. |
445 if (instruction.useInstanceOf) { | 446 if (instruction.useInstanceOf) { |
446 analyzeInputs(instruction, 0); | 447 analyzeInputs(instruction, 0); |
447 } | 448 } |
| 449 |
| 450 // Compound and variable checks use a separate instruction to compute the |
| 451 // result. |
| 452 if (instruction.isCompoundCheck || instruction.isVariableCheck) { |
| 453 analyzeInputs(instruction, 0); |
| 454 } |
448 } | 455 } |
449 | 456 |
450 // A bounds check method must not have its first input generated at use site, | 457 // A bounds check method must not have its first input generated at use site, |
451 // because it's using it twice. | 458 // because it's using it twice. |
452 void visitBoundsCheck(HBoundsCheck instruction) { | 459 void visitBoundsCheck(HBoundsCheck instruction) { |
453 analyzeInputs(instruction, 1); | 460 analyzeInputs(instruction, 1); |
454 } | 461 } |
455 | 462 |
456 // An identity operation must only have its inputs generated at use site if | 463 // An identity operation must only have its inputs generated at use site if |
457 // does not require an expression with multiple uses (because of null / | 464 // does not require an expression with multiple uses (because of null / |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
788 } | 795 } |
789 | 796 |
790 // If [thenInput] is defined in the first predecessor, then it is only used | 797 // If [thenInput] is defined in the first predecessor, then it is only used |
791 // by [phi] and can be generated at use site. | 798 // by [phi] and can be generated at use site. |
792 if (identical(thenInput.block, end.predecessors[0])) { | 799 if (identical(thenInput.block, end.predecessors[0])) { |
793 assert(thenInput.usedBy.length == 1); | 800 assert(thenInput.usedBy.length == 1); |
794 markAsGenerateAtUseSite(thenInput); | 801 markAsGenerateAtUseSite(thenInput); |
795 } | 802 } |
796 } | 803 } |
797 } | 804 } |
OLD | NEW |