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 part of ssa; | 5 part of ssa; |
6 | 6 |
7 /** | 7 /** |
8 * Replaces some instructions with specialized versions to make codegen easier. | 8 * Replaces some instructions with specialized versions to make codegen easier. |
9 * Caches codegen information on nodes. | 9 * Caches codegen information on nodes. |
10 */ | 10 */ |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 } | 377 } |
378 } | 378 } |
379 } | 379 } |
380 | 380 |
381 void visitInstruction(HInstruction instruction) { | 381 void visitInstruction(HInstruction instruction) { |
382 // A code motion invariant instruction is dealt before visiting it. | 382 // A code motion invariant instruction is dealt before visiting it. |
383 assert(!instruction.isCodeMotionInvariant()); | 383 assert(!instruction.isCodeMotionInvariant()); |
384 analyzeInputs(instruction, 0); | 384 analyzeInputs(instruction, 0); |
385 } | 385 } |
386 | 386 |
387 // The codegen might use the input multiple times, so it must not be | 387 void visitIs(HIs instruction) { |
388 // set generate at use site. | 388 // In the general case the input might be used multple multiple times, so it |
389 void visitIs(HIs instruction) {} | 389 // must not be set generate at use site. If the code will generate |
| 390 // 'instanceof' then we can generate at use site. |
| 391 if (instruction.useInstanceOf) { |
| 392 analyzeInputs(instruction, 0); |
| 393 } |
| 394 } |
390 | 395 |
391 // A bounds check method must not have its first input generated at use site, | 396 // A bounds check method must not have its first input generated at use site, |
392 // because it's using it twice. | 397 // because it's using it twice. |
393 void visitBoundsCheck(HBoundsCheck instruction) { | 398 void visitBoundsCheck(HBoundsCheck instruction) { |
394 analyzeInputs(instruction, 1); | 399 analyzeInputs(instruction, 1); |
395 } | 400 } |
396 | 401 |
397 // An identity operation must only have its inputs generated at use site if | 402 // An identity operation must only have its inputs generated at use site if |
398 // does not require an expression with multiple uses (because of null / | 403 // does not require an expression with multiple uses (because of null / |
399 // undefined). | 404 // undefined). |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
725 } | 730 } |
726 | 731 |
727 // If [thenInput] is defined in the first predecessor, then it is only used | 732 // If [thenInput] is defined in the first predecessor, then it is only used |
728 // by [phi] and can be generated at use site. | 733 // by [phi] and can be generated at use site. |
729 if (identical(thenInput.block, end.predecessors[0])) { | 734 if (identical(thenInput.block, end.predecessors[0])) { |
730 assert(thenInput.usedBy.length == 1); | 735 assert(thenInput.usedBy.length == 1); |
731 markAsGenerateAtUseSite(thenInput); | 736 markAsGenerateAtUseSite(thenInput); |
732 } | 737 } |
733 } | 738 } |
734 } | 739 } |
OLD | NEW |