| 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 typedef void Recompile(Element element); | 5 typedef void Recompile(Element element); |
| 6 | 6 |
| 7 class ReturnInfo { | 7 class ReturnInfo { |
| 8 HType returnType; | 8 HType returnType; |
| 9 List<Element> compiledFunctions; | 9 List<Element> compiledFunctions; |
| 10 | 10 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 } | 32 } |
| 33 | 33 |
| 34 addCompiledFunction(FunctionElement function) => | 34 addCompiledFunction(FunctionElement function) => |
| 35 compiledFunctions.add(function); | 35 compiledFunctions.add(function); |
| 36 } | 36 } |
| 37 | 37 |
| 38 class HTypeList { | 38 class HTypeList { |
| 39 final List<HType> types; | 39 final List<HType> types; |
| 40 | 40 |
| 41 HTypeList(int length) : types = new List<HType>(length); | 41 HTypeList(int length) : types = new List<HType>(length); |
| 42 const HTypeList.allUnknown() : types = null; | 42 const HTypeList.withAllUnknown() : types = null; |
| 43 | 43 |
| 44 factory HTypeList.fromInvocation(HInvoke node, HTypeMap types) { | 44 factory HTypeList.fromInvocation(HInvoke node, HTypeMap types) { |
| 45 bool allUnknown = true; | 45 bool allUnknown = true; |
| 46 for (int i = 1; i < node.inputs.length; i++) { | 46 for (int i = 1; i < node.inputs.length; i++) { |
| 47 if (types[node.inputs[i]] != HType.UNKNOWN) { | 47 if (types[node.inputs[i]] != HType.UNKNOWN) { |
| 48 allUnknown = false; | 48 allUnknown = false; |
| 49 break; | 49 break; |
| 50 } | 50 } |
| 51 } | 51 } |
| 52 if (allUnknown) return HTypeList.ALL_UNKNOWN; | 52 if (allUnknown) return HTypeList.ALL_UNKNOWN; |
| 53 | 53 |
| 54 HTypeList result = new HTypeList(node.inputs.length - 1); | 54 HTypeList result = new HTypeList(node.inputs.length - 1); |
| 55 for (int i = 0; i < result.types.length; i++) { | 55 for (int i = 0; i < result.types.length; i++) { |
| 56 result.types[i] = types[node.inputs[i + 1]]; | 56 result.types[i] = types[node.inputs[i + 1]]; |
| 57 } | 57 } |
| 58 return result; | 58 return result; |
| 59 } | 59 } |
| 60 | 60 |
| 61 static const HTypeList ALL_UNKNOWN = const HTypeList.allUnknown(); | 61 static const HTypeList ALL_UNKNOWN = const HTypeList.withAllUnknown(); |
| 62 | 62 |
| 63 bool get allUnknown => types === null; | 63 bool get allUnknown => types === null; |
| 64 int get length => types.length; | 64 int get length => types.length; |
| 65 HType operator[](int index) => types[index]; | 65 HType operator[](int index) => types[index]; |
| 66 | 66 |
| 67 HTypeList union(HTypeList other) { | 67 HTypeList union(HTypeList other) { |
| 68 if (allUnknown) return this; | 68 if (allUnknown) return this; |
| 69 if (other.allUnknown) return other; | 69 if (other.allUnknown) return other; |
| 70 if (length != other.length) return HTypeList.ALL_UNKNOWN; | 70 if (length != other.length) return HTypeList.ALL_UNKNOWN; |
| 71 bool onlyUnknown = true; | 71 bool onlyUnknown = true; |
| (...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 577 return const SourceString('listSuperTypeCheck'); | 577 return const SourceString('listSuperTypeCheck'); |
| 578 } | 578 } |
| 579 } else if (nativeCheck) { | 579 } else if (nativeCheck) { |
| 580 return const SourceString('callTypeCheck'); | 580 return const SourceString('callTypeCheck'); |
| 581 } else { | 581 } else { |
| 582 return const SourceString('propertyTypeCheck'); | 582 return const SourceString('propertyTypeCheck'); |
| 583 } | 583 } |
| 584 } | 584 } |
| 585 } | 585 } |
| 586 } | 586 } |
| OLD | NEW |