| 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 '../compiler.dart' show Compiler; | 5 import '../compiler.dart' show Compiler; |
| 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/elements.dart'; | 8 import '../elements/elements.dart'; |
| 9 import '../js_backend/js_backend.dart'; | 9 import '../js_backend/js_backend.dart'; |
| 10 import '../types/types.dart'; | 10 import '../types/types.dart'; |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 } | 91 } |
| 92 } | 92 } |
| 93 | 93 |
| 94 class IndexAssignSpecializer extends InvokeDynamicSpecializer { | 94 class IndexAssignSpecializer extends InvokeDynamicSpecializer { |
| 95 const IndexAssignSpecializer(); | 95 const IndexAssignSpecializer(); |
| 96 | 96 |
| 97 HInstruction tryConvertToBuiltin(HInvokeDynamic instruction, | 97 HInstruction tryConvertToBuiltin(HInvokeDynamic instruction, |
| 98 Compiler compiler) { | 98 Compiler compiler) { |
| 99 if (instruction.inputs[1].isMutableIndexable(compiler)) { | 99 if (instruction.inputs[1].isMutableIndexable(compiler)) { |
| 100 if (!instruction.inputs[2].isInteger(compiler) | 100 if (!instruction.inputs[2].isInteger(compiler) |
| 101 && compiler.enableTypeAssertions) { | 101 && compiler.options.enableTypeAssertions) { |
| 102 // We want the right checked mode error. | 102 // We want the right checked mode error. |
| 103 return null; | 103 return null; |
| 104 } | 104 } |
| 105 return new HIndexAssign(instruction.inputs[1], | 105 return new HIndexAssign(instruction.inputs[1], |
| 106 instruction.inputs[2], | 106 instruction.inputs[2], |
| 107 instruction.inputs[3], | 107 instruction.inputs[3], |
| 108 instruction.selector); | 108 instruction.selector); |
| 109 } | 109 } |
| 110 return null; | 110 return null; |
| 111 } | 111 } |
| 112 } | 112 } |
| 113 | 113 |
| 114 class IndexSpecializer extends InvokeDynamicSpecializer { | 114 class IndexSpecializer extends InvokeDynamicSpecializer { |
| 115 const IndexSpecializer(); | 115 const IndexSpecializer(); |
| 116 | 116 |
| 117 HInstruction tryConvertToBuiltin(HInvokeDynamic instruction, | 117 HInstruction tryConvertToBuiltin(HInvokeDynamic instruction, |
| 118 Compiler compiler) { | 118 Compiler compiler) { |
| 119 if (!instruction.inputs[1].isIndexablePrimitive(compiler)) return null; | 119 if (!instruction.inputs[1].isIndexablePrimitive(compiler)) return null; |
| 120 if (!instruction.inputs[2].isInteger(compiler) | 120 if (!instruction.inputs[2].isInteger(compiler) |
| 121 && compiler.enableTypeAssertions) { | 121 && compiler.options.enableTypeAssertions) { |
| 122 // We want the right checked mode error. | 122 // We want the right checked mode error. |
| 123 return null; | 123 return null; |
| 124 } | 124 } |
| 125 TypeMask receiverType = | 125 TypeMask receiverType = |
| 126 instruction.getDartReceiver(compiler).instructionType; | 126 instruction.getDartReceiver(compiler).instructionType; |
| 127 TypeMask type = TypeMaskFactory.inferredTypeForSelector( | 127 TypeMask type = TypeMaskFactory.inferredTypeForSelector( |
| 128 instruction.selector, receiverType, compiler); | 128 instruction.selector, receiverType, compiler); |
| 129 return new HIndex( | 129 return new HIndex( |
| 130 instruction.inputs[1], instruction.inputs[2], | 130 instruction.inputs[1], instruction.inputs[2], |
| 131 instruction.selector, type); | 131 instruction.selector, type); |
| (...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 772 return constantSystem.codeUnitAt; | 772 return constantSystem.codeUnitAt; |
| 773 } | 773 } |
| 774 | 774 |
| 775 HInstruction tryConvertToBuiltin(HInvokeDynamic instruction, | 775 HInstruction tryConvertToBuiltin(HInvokeDynamic instruction, |
| 776 Compiler compiler) { | 776 Compiler compiler) { |
| 777 // TODO(sra): Implement a builtin HCodeUnitAt instruction and the same index | 777 // TODO(sra): Implement a builtin HCodeUnitAt instruction and the same index |
| 778 // bounds checking optimizations as for HIndex. | 778 // bounds checking optimizations as for HIndex. |
| 779 return null; | 779 return null; |
| 780 } | 780 } |
| 781 } | 781 } |
| OLD | NEW |