| 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 part of ssa; | 5 part of ssa; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * [InvokeDynamicSpecializer] and its subclasses are helpers to | 8 * [InvokeDynamicSpecializer] and its subclasses are helpers to |
| 9 * optimize intercepted dynamic calls. It knows what input types | 9 * optimize intercepted dynamic calls. It knows what input types |
| 10 * would be beneficial for performance, and how to change a invoke | 10 * would be beneficial for performance, and how to change a invoke |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 | 381 |
| 382 HInstruction tryConvertToBuiltin(HInvokeDynamic instruction, | 382 HInstruction tryConvertToBuiltin(HInvokeDynamic instruction, |
| 383 Compiler compiler) { | 383 Compiler compiler) { |
| 384 HInstruction left = instruction.inputs[1]; | 384 HInstruction left = instruction.inputs[1]; |
| 385 HInstruction right = instruction.inputs[2]; | 385 HInstruction right = instruction.inputs[2]; |
| 386 if (isBuiltin(instruction, compiler)) { | 386 if (isBuiltin(instruction, compiler)) { |
| 387 if (right.isPositiveInteger(compiler) && isNotZero(right, compiler)) { | 387 if (right.isPositiveInteger(compiler) && isNotZero(right, compiler)) { |
| 388 if (left.isUInt31(compiler)) { | 388 if (left.isUInt31(compiler)) { |
| 389 return newBuiltinVariant(instruction, compiler); | 389 return newBuiltinVariant(instruction, compiler); |
| 390 } | 390 } |
| 391 clearAllSideEffects(instruction); |
| 391 // We can call _tdivFast because the rhs is a 32bit integer | 392 // We can call _tdivFast because the rhs is a 32bit integer |
| 392 // and not 0, nor -1. | 393 // and not 0, nor -1. |
| 393 instruction.selector = renameToOptimizedSelector( | 394 instruction.selector = renameToOptimizedSelector( |
| 394 '_tdivFast', instruction.selector, compiler); | 395 '_tdivFast', instruction.selector, compiler); |
| 395 } | 396 } |
| 396 clearAllSideEffects(instruction); | |
| 397 } | 397 } |
| 398 return null; | 398 return null; |
| 399 } | 399 } |
| 400 | 400 |
| 401 HInstruction newBuiltinVariant(HInvokeDynamic instruction, | 401 HInstruction newBuiltinVariant(HInvokeDynamic instruction, |
| 402 Compiler compiler) { | 402 Compiler compiler) { |
| 403 return new HTruncatingDivide( | 403 return new HTruncatingDivide( |
| 404 instruction.inputs[1], instruction.inputs[2], | 404 instruction.inputs[1], instruction.inputs[2], |
| 405 instruction.selector, computeTypeFromInputTypes(instruction, compiler)); | 405 instruction.selector, computeTypeFromInputTypes(instruction, compiler)); |
| 406 } | 406 } |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 724 } | 724 } |
| 725 | 725 |
| 726 HInstruction newBuiltinVariant(HInvokeDynamic instruction, | 726 HInstruction newBuiltinVariant(HInvokeDynamic instruction, |
| 727 Compiler compiler) { | 727 Compiler compiler) { |
| 728 JavaScriptBackend backend = compiler.backend; | 728 JavaScriptBackend backend = compiler.backend; |
| 729 return new HLessEqual( | 729 return new HLessEqual( |
| 730 instruction.inputs[1], instruction.inputs[2], | 730 instruction.inputs[1], instruction.inputs[2], |
| 731 instruction.selector, backend.boolType); | 731 instruction.selector, backend.boolType); |
| 732 } | 732 } |
| 733 } | 733 } |
| OLD | NEW |