| 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 js_backend.backend; | 5 part of js_backend.backend; |
| 6 | 6 |
| 7 /// For each class, stores the possible class subtype tests that could succeed. | 7 /// For each class, stores the possible class subtype tests that could succeed. |
| 8 abstract class TypeChecks { | 8 abstract class TypeChecks { |
| 9 /// Get the set of checks required for class [element]. | 9 /// Get the set of checks required for class [element]. |
| 10 Iterable<TypeCheck> operator [](ClassElement element); | 10 Iterable<TypeCheck> operator [](ClassElement element); |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 // Add is-checks that result from classes using type variables in checks. | 258 // Add is-checks that result from classes using type variables in checks. |
| 259 addImplicitChecks( | 259 addImplicitChecks( |
| 260 compiler.resolutionWorldBuilder, classesUsingTypeVariableTests); | 260 compiler.resolutionWorldBuilder, classesUsingTypeVariableTests); |
| 261 // Add the rti dependencies that are implicit in the way the backend | 261 // Add the rti dependencies that are implicit in the way the backend |
| 262 // generates code: when we create a new [List], we actually create | 262 // generates code: when we create a new [List], we actually create |
| 263 // a JSArray in the backend and we need to add type arguments to | 263 // a JSArray in the backend and we need to add type arguments to |
| 264 // the calls of the list constructor whenever we determine that | 264 // the calls of the list constructor whenever we determine that |
| 265 // JSArray needs type arguments. | 265 // JSArray needs type arguments. |
| 266 // TODO(karlklose): make this dependency visible from code. | 266 // TODO(karlklose): make this dependency visible from code. |
| 267 if (backend.helpers.jsArrayClass != null) { | 267 if (backend.helpers.jsArrayClass != null) { |
| 268 registerRtiDependency( | 268 ClassElement listClass = compiler.commonElements.listClass; |
| 269 backend.helpers.jsArrayClass, compiler.commonElements.listClass); | 269 registerRtiDependency(backend.helpers.jsArrayClass, listClass); |
| 270 } | 270 } |
| 271 // Compute the set of all classes and methods that need runtime type | 271 // Compute the set of all classes and methods that need runtime type |
| 272 // information. | 272 // information. |
| 273 compiler.resolutionWorldBuilder.isChecks.forEach((ResolutionDartType type) { | 273 compiler.resolutionWorldBuilder.isChecks.forEach((ResolutionDartType type) { |
| 274 if (type.isInterfaceType) { | 274 if (type.isInterfaceType) { |
| 275 ResolutionInterfaceType itf = type; | 275 ResolutionInterfaceType itf = type; |
| 276 if (!itf.treatAsRaw) { | 276 if (!itf.treatAsRaw) { |
| 277 potentiallyAddForRti(itf.element); | 277 potentiallyAddForRti(itf.element); |
| 278 } | 278 } |
| 279 } else { | 279 } else { |
| (...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1043 * substition for this check. | 1043 * substition for this check. |
| 1044 */ | 1044 */ |
| 1045 class TypeCheck { | 1045 class TypeCheck { |
| 1046 final ClassElement cls; | 1046 final ClassElement cls; |
| 1047 final Substitution substitution; | 1047 final Substitution substitution; |
| 1048 final int hashCode = _nextHash = (_nextHash + 100003).toUnsigned(30); | 1048 final int hashCode = _nextHash = (_nextHash + 100003).toUnsigned(30); |
| 1049 static int _nextHash = 0; | 1049 static int _nextHash = 0; |
| 1050 | 1050 |
| 1051 TypeCheck(this.cls, this.substitution); | 1051 TypeCheck(this.cls, this.substitution); |
| 1052 } | 1052 } |
| OLD | NEW |