Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 library dart2js.js_helpers.impact; | 5 library dart2js.js_helpers.impact; |
| 6 | 6 |
| 7 import '../common/names.dart' show | 7 import '../common/names.dart' show |
| 8 Identifiers; | 8 Identifiers; |
| 9 import '../compiler.dart' show | 9 import '../compiler.dart' show |
| 10 Compiler; | 10 Compiler; |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 38 final Compiler compiler; | 38 final Compiler compiler; |
| 39 | 39 |
| 40 BackendImpacts(this.compiler); | 40 BackendImpacts(this.compiler); |
| 41 | 41 |
| 42 JavaScriptBackend get backend => compiler.backend; | 42 JavaScriptBackend get backend => compiler.backend; |
| 43 | 43 |
| 44 BackendHelpers get helpers => backend.helpers; | 44 BackendHelpers get helpers => backend.helpers; |
| 45 | 45 |
| 46 CoreClasses get coreClasses => compiler.coreClasses; | 46 CoreClasses get coreClasses => compiler.coreClasses; |
| 47 | 47 |
| 48 BackendImpact get getRuntimeTypeArgument => new BackendImpact( | 48 BackendImpact _getRuntimeTypeArgument; |
| 49 staticUses: [ | 49 |
| 50 helpers.getRuntimeTypeArgument, | 50 BackendImpact get getRuntimeTypeArgument { |
| 51 helpers.getTypeArgumentByIndex, | 51 if(_getRuntimeTypeArgument == null) { |
| 52 helpers.copyTypeArguments]); | 52 _getRuntimeTypeArgument = new BackendImpact( |
|
sigurdm
2015/11/10 08:07:07
These could be done with ?= null-aware assignment.
Johnni Winther
2015/11/10 10:26:37
It looks strange:
return _getRuntimeTypeArgumen
sigurdm
2015/11/10 12:11:06
I thought about two lines:
_getRuntimeTypeArgument
| |
| 53 | 53 staticUses: [ |
| 54 BackendImpact get computeSignature => new BackendImpact( | 54 helpers.getRuntimeTypeArgument, |
| 55 staticUses: [ | 55 helpers.getTypeArgumentByIndex, |
| 56 helpers.setRuntimeTypeInfo, | 56 helpers.copyTypeArguments]); |
| 57 helpers.getRuntimeTypeInfo, | 57 } |
| 58 helpers.computeSignature, | 58 return _getRuntimeTypeArgument; |
| 59 helpers.getRuntimeTypeArguments], | 59 } |
| 60 instantiatedClasses: [ | 60 |
| 61 coreClasses.listClass]); | 61 BackendImpact _computeSignature; |
| 62 | 62 |
| 63 BackendImpact get asyncBody => new BackendImpact( | 63 BackendImpact get computeSignature { |
| 64 staticUses: [ | 64 if(_computeSignature == null) { |
| 65 helpers.asyncHelper, | 65 _computeSignature = new BackendImpact( |
| 66 helpers.syncCompleterConstructor, | 66 staticUses: [ |
| 67 helpers.streamIteratorConstructor, | 67 helpers.setRuntimeTypeInfo, |
| 68 helpers.wrapBody]); | 68 helpers.getRuntimeTypeInfo, |
| 69 | 69 helpers.computeSignature, |
| 70 BackendImpact get syncStarBody => new BackendImpact( | 70 helpers.getRuntimeTypeArguments], |
| 71 staticUses: [ | 71 instantiatedClasses: [ |
| 72 helpers.syncStarIterableConstructor, | 72 coreClasses.listClass]); |
| 73 helpers.endOfIteration, | 73 } |
| 74 helpers.yieldStar, | 74 return _computeSignature; |
| 75 helpers.syncStarUncaughtError], | 75 } |
| 76 instantiatedClasses: [ | 76 |
| 77 helpers.syncStarIterable]); | 77 BackendImpact _asyncBody; |
| 78 | 78 |
| 79 BackendImpact get asyncStarBody => new BackendImpact( | 79 BackendImpact get asyncBody { |
| 80 staticUses: [ | 80 if(_asyncBody == null) { |
| 81 helpers.asyncStarHelper, | 81 _asyncBody = new BackendImpact( |
| 82 helpers.streamOfController, | 82 staticUses: [ |
| 83 helpers.yieldSingle, | 83 helpers.asyncHelper, |
| 84 helpers.yieldStar, | 84 helpers.syncCompleterConstructor, |
| 85 helpers.asyncStarControllerConstructor, | 85 helpers.streamIteratorConstructor, |
| 86 helpers.streamIteratorConstructor, | 86 helpers.wrapBody]); |
| 87 helpers.wrapBody], | 87 } |
| 88 instantiatedClasses: [ | 88 return _asyncBody; |
| 89 helpers.asyncStarController]); | 89 } |
| 90 | 90 |
| 91 BackendImpact get typeVariableBoundCheck => new BackendImpact( | 91 BackendImpact _syncStarBody; |
| 92 staticUses: [ | 92 |
| 93 helpers.throwTypeError, | 93 BackendImpact get syncStarBody { |
| 94 helpers.assertIsSubtype]); | 94 if(_syncStarBody == null) { |
| 95 | 95 _syncStarBody = new BackendImpact( |
| 96 BackendImpact get abstractClassInstantiation => new BackendImpact( | 96 staticUses: [ |
| 97 staticUses: [ | 97 helpers.syncStarIterableConstructor, |
| 98 helpers.throwAbstractClassInstantiationError], | 98 helpers.endOfIteration, |
| 99 otherImpacts: [ | 99 helpers.yieldStar, |
| 100 needsString('Needed to encode the message.')]); | 100 helpers.syncStarUncaughtError], |
| 101 | 101 instantiatedClasses: [ |
| 102 BackendImpact get fallThroughError => new BackendImpact( | 102 helpers.syncStarIterable]); |
| 103 staticUses: [ | 103 } |
| 104 helpers.fallThroughError]); | 104 return _syncStarBody; |
| 105 | 105 } |
| 106 BackendImpact get asCheck => new BackendImpact( | 106 |
| 107 staticUses: [ | 107 BackendImpact _asyncStarBody; |
| 108 helpers.throwRuntimeError]); | 108 |
| 109 | 109 BackendImpact get asyncStarBody { |
| 110 BackendImpact get throwNoSuchMethod => new BackendImpact( | 110 if(_asyncStarBody == null) { |
| 111 staticUses: [ | 111 _asyncStarBody = new BackendImpact( |
| 112 helpers.throwNoSuchMethod], | 112 staticUses: [ |
| 113 otherImpacts: [ | 113 helpers.asyncStarHelper, |
| 114 // Also register the types of the arguments passed to this method. | 114 helpers.streamOfController, |
| 115 needsList( | 115 helpers.yieldSingle, |
| 116 'Needed to encode the arguments for throw NoSuchMethodError.'), | 116 helpers.yieldStar, |
| 117 needsString( | 117 helpers.asyncStarControllerConstructor, |
| 118 'Needed to encode the name for throw NoSuchMethodError.')]); | 118 helpers.streamIteratorConstructor, |
| 119 | 119 helpers.wrapBody], |
| 120 BackendImpact get throwRuntimeError => new BackendImpact( | 120 instantiatedClasses: [ |
| 121 staticUses: [ | 121 helpers.asyncStarController]); |
| 122 helpers.throwRuntimeError], | 122 } |
| 123 // Also register the types of the arguments passed to this method. | 123 return _asyncStarBody; |
| 124 instantiatedClasses: [ | 124 } |
| 125 coreClasses.stringClass]); | 125 |
| 126 | 126 BackendImpact _typeVariableBoundCheck; |
| 127 BackendImpact get superNoSuchMethod => new BackendImpact( | 127 |
| 128 staticUses: [ | 128 BackendImpact get typeVariableBoundCheck { |
| 129 helpers.createInvocationMirror, | 129 if(_typeVariableBoundCheck == null) { |
| 130 coreClasses.objectClass.lookupLocalMember(Identifiers.noSuchMethod_)], | 130 _typeVariableBoundCheck = new BackendImpact( |
| 131 otherImpacts: [ | 131 staticUses: [ |
| 132 needsInt( | 132 helpers.throwTypeError, |
| 133 'Needed to encode the invocation kind of super.noSuchMethod.'), | 133 helpers.assertIsSubtype]); |
| 134 needsList( | 134 } |
| 135 'Needed to encode the arguments of super.noSuchMethod.'), | 135 return _typeVariableBoundCheck; |
| 136 needsString( | 136 } |
| 137 'Needed to encode the name of super.noSuchMethod.')]); | 137 |
| 138 BackendImpact _abstractClassInstantiation; | |
| 139 | |
| 140 BackendImpact get abstractClassInstantiation { | |
| 141 if(_abstractClassInstantiation == null) { | |
| 142 _abstractClassInstantiation = new BackendImpact( | |
| 143 staticUses: [ | |
| 144 helpers.throwAbstractClassInstantiationError], | |
| 145 otherImpacts: [ | |
| 146 _needsString('Needed to encode the message.')]); | |
| 147 } | |
| 148 return _abstractClassInstantiation; | |
| 149 } | |
| 150 | |
| 151 BackendImpact _fallThroughError; | |
| 152 | |
| 153 BackendImpact get fallThroughError { | |
| 154 if(_fallThroughError == null) { | |
| 155 _fallThroughError = new BackendImpact( | |
| 156 staticUses: [ | |
| 157 helpers.fallThroughError]); | |
| 158 } | |
| 159 return _fallThroughError; | |
| 160 } | |
| 161 | |
| 162 BackendImpact _asCheck; | |
| 163 | |
| 164 BackendImpact get asCheck { | |
| 165 if(_asCheck == null) { | |
| 166 _asCheck = new BackendImpact( | |
| 167 staticUses: [ | |
| 168 helpers.throwRuntimeError]); | |
| 169 } | |
| 170 return _asCheck; | |
| 171 } | |
| 172 | |
| 173 BackendImpact _throwNoSuchMethod; | |
| 174 | |
| 175 BackendImpact get throwNoSuchMethod { | |
| 176 if(_throwNoSuchMethod == null) { | |
| 177 _throwNoSuchMethod = new BackendImpact( | |
| 178 staticUses: [ | |
| 179 helpers.throwNoSuchMethod], | |
| 180 otherImpacts: [ | |
| 181 // Also register the types of the arguments passed to this method. | |
| 182 _needsList( | |
| 183 'Needed to encode the arguments for throw NoSuchMethodError.'), | |
| 184 _needsString( | |
| 185 'Needed to encode the name for throw NoSuchMethodError.')]); | |
| 186 } | |
| 187 return _throwNoSuchMethod; | |
| 188 } | |
| 189 | |
| 190 BackendImpact _throwRuntimeError; | |
| 191 | |
| 192 BackendImpact get throwRuntimeError { | |
| 193 if(_throwRuntimeError == null) { | |
| 194 _throwRuntimeError = new BackendImpact( | |
| 195 staticUses: [ | |
| 196 helpers.throwRuntimeError], | |
| 197 // Also register the types of the arguments passed to this method. | |
| 198 instantiatedClasses: [ | |
| 199 coreClasses.stringClass]); | |
| 200 } | |
| 201 return _throwRuntimeError; | |
| 202 } | |
| 203 | |
| 204 BackendImpact _superNoSuchMethod; | |
| 205 | |
| 206 BackendImpact get superNoSuchMethod { | |
| 207 if(_superNoSuchMethod == null) { | |
| 208 _superNoSuchMethod = new BackendImpact( | |
| 209 staticUses: [ | |
| 210 helpers.createInvocationMirror, | |
| 211 coreClasses.objectClass.lookupLocalMember( | |
| 212 Identifiers.noSuchMethod_)], | |
| 213 otherImpacts: [ | |
| 214 _needsInt( | |
| 215 'Needed to encode the invocation kind of super.noSuchMethod.'), | |
| 216 _needsList( | |
| 217 'Needed to encode the arguments of super.noSuchMethod.'), | |
| 218 _needsString( | |
| 219 'Needed to encode the name of super.noSuchMethod.')]); | |
| 220 } | |
| 221 return _superNoSuchMethod; | |
| 222 } | |
| 223 | |
| 224 BackendImpact _constantMapLiteral; | |
| 138 | 225 |
| 139 BackendImpact get constantMapLiteral { | 226 BackendImpact get constantMapLiteral { |
| 140 | 227 if (_constantMapLiteral == null) { |
| 141 ClassElement find(String name) { | 228 |
| 142 return helpers.find(helpers.jsHelperLibrary, name); | 229 ClassElement find(String name) { |
| 143 } | 230 return helpers.find(helpers.jsHelperLibrary, name); |
| 144 | 231 } |
| 145 return new BackendImpact( | 232 |
| 146 instantiatedClasses: [ | 233 _constantMapLiteral = new BackendImpact( |
| 147 find(JavaScriptMapConstant.DART_CLASS), | 234 instantiatedClasses: [ |
| 148 find(JavaScriptMapConstant.DART_PROTO_CLASS), | 235 find(JavaScriptMapConstant.DART_CLASS), |
| 149 find(JavaScriptMapConstant.DART_STRING_CLASS), | 236 find(JavaScriptMapConstant.DART_PROTO_CLASS), |
| 150 find(JavaScriptMapConstant.DART_GENERAL_CLASS)]); | 237 find(JavaScriptMapConstant.DART_STRING_CLASS), |
| 151 } | 238 find(JavaScriptMapConstant.DART_GENERAL_CLASS)]); |
| 152 | 239 } |
| 153 BackendImpact get symbolConstructor => new BackendImpact( | 240 return _constantMapLiteral; |
| 154 staticUses: [ | 241 } |
| 155 helpers.compiler.symbolValidatedConstructor]); | 242 |
| 156 | 243 BackendImpact _symbolConstructor; |
| 157 BackendImpact get constSymbol => new BackendImpact( | 244 |
| 158 instantiatedClasses: [ | 245 BackendImpact get symbolConstructor { |
| 159 coreClasses.symbolClass], | 246 if(_symbolConstructor == null) { |
| 160 staticUses: [ | 247 _symbolConstructor = new BackendImpact( |
| 161 compiler.symbolConstructor.declaration]); | 248 staticUses: [ |
| 162 | 249 helpers.compiler.symbolValidatedConstructor]); |
| 163 BackendImpact get incDecOperation => | 250 } |
| 164 needsInt('Needed for the `+ 1` or `- 1` operation of ++/--.'); | 251 return _symbolConstructor; |
| 252 } | |
| 253 | |
| 254 BackendImpact _constSymbol; | |
| 255 | |
| 256 BackendImpact get constSymbol { | |
| 257 if(_constSymbol == null) { | |
| 258 _constSymbol = new BackendImpact( | |
| 259 instantiatedClasses: [ | |
| 260 coreClasses.symbolClass], | |
| 261 staticUses: [ | |
| 262 compiler.symbolConstructor.declaration]); | |
| 263 } | |
| 264 return _constSymbol; | |
| 265 } | |
| 266 | |
| 267 BackendImpact _incDecOperation; | |
| 268 | |
| 269 BackendImpact get incDecOperation { | |
| 270 if (_incDecOperation == null) { | |
| 271 _incDecOperation = | |
| 272 _needsInt('Needed for the `+ 1` or `- 1` operation of ++/--.'); | |
| 273 } | |
| 274 return _incDecOperation; | |
| 275 } | |
| 165 | 276 |
| 166 /// Helper for registering that `int` is needed. | 277 /// Helper for registering that `int` is needed. |
| 167 BackendImpact needsInt(String reason) { | 278 BackendImpact _needsInt(String reason) { |
| 168 // TODO(johnniwinther): Register [reason] for use in dump-info. | 279 // TODO(johnniwinther): Register [reason] for use in dump-info. |
| 169 return new BackendImpact( | 280 return new BackendImpact( |
| 170 instantiatedClasses: [coreClasses.intClass]); | 281 instantiatedClasses: [coreClasses.intClass]); |
| 171 } | 282 } |
| 172 | 283 |
| 173 /// Helper for registering that `List` is needed. | 284 /// Helper for registering that `List` is needed. |
| 174 BackendImpact needsList(String reason) { | 285 BackendImpact _needsList(String reason) { |
| 175 // TODO(johnniwinther): Register [reason] for use in dump-info. | 286 // TODO(johnniwinther): Register [reason] for use in dump-info. |
| 176 return new BackendImpact( | 287 return new BackendImpact( |
| 177 instantiatedClasses: [coreClasses.listClass]); | 288 instantiatedClasses: [coreClasses.listClass]); |
| 178 } | 289 } |
| 179 | 290 |
| 180 /// Helper for registering that `String` is needed. | 291 /// Helper for registering that `String` is needed. |
| 181 BackendImpact needsString(String reason) { | 292 BackendImpact _needsString(String reason) { |
| 182 // TODO(johnniwinther): Register [reason] for use in dump-info. | 293 // TODO(johnniwinther): Register [reason] for use in dump-info. |
| 183 return new BackendImpact( | 294 return new BackendImpact( |
| 184 instantiatedClasses: [ | 295 instantiatedClasses: [ |
| 185 coreClasses.stringClass]); | 296 coreClasses.stringClass]); |
| 186 } | 297 } |
| 187 | 298 |
| 188 BackendImpact get assertWithoutMessage => new BackendImpact( | 299 BackendImpact _assertWithoutMessage; |
| 189 staticUses: [ | 300 |
| 190 helpers.assertHelper]); | 301 BackendImpact get assertWithoutMessage { |
| 191 | 302 if(_assertWithoutMessage == null) { |
| 192 BackendImpact get assertWithMessage => new BackendImpact( | 303 _assertWithoutMessage = new BackendImpact( |
| 193 staticUses: [ | 304 staticUses: [ |
| 194 helpers.assertTest, | 305 helpers.assertHelper]); |
| 195 helpers.assertThrow]); | 306 } |
| 196 | 307 return _assertWithoutMessage; |
| 197 BackendImpact get asyncForIn => new BackendImpact( | 308 } |
| 198 staticUses: [ | 309 |
| 199 helpers.streamIteratorConstructor]); | 310 BackendImpact _assertWithMessage; |
| 200 | 311 |
| 201 BackendImpact get stringInterpolation => new BackendImpact( | 312 BackendImpact get assertWithMessage { |
| 202 staticUses: [ | 313 if(_assertWithMessage == null) { |
| 203 helpers.stringInterpolationHelper]); | 314 _assertWithMessage = new BackendImpact( |
| 204 | 315 staticUses: [ |
| 205 BackendImpact get catchStatement => new BackendImpact( | 316 helpers.assertTest, |
| 206 staticUses: [ | 317 helpers.assertThrow]); |
| 207 helpers.exceptionUnwrapper], | 318 } |
| 208 instantiatedClasses: [ | 319 return _assertWithMessage; |
| 209 helpers.jsPlainJavaScriptObjectClass, | 320 } |
| 210 helpers.jsUnknownJavaScriptObjectClass]); | 321 |
| 211 | 322 BackendImpact _asyncForIn; |
| 212 BackendImpact get throwExpression => new BackendImpact( | 323 |
| 213 // We don't know ahead of time whether we will need the throw in a | 324 BackendImpact get asyncForIn { |
| 214 // statement context or an expression context, so we register both | 325 if(_asyncForIn == null) { |
| 215 // here, even though we may not need the throwExpression helper. | 326 _asyncForIn = new BackendImpact( |
| 216 staticUses: [ | 327 staticUses: [ |
| 217 helpers.wrapExceptionHelper, | 328 helpers.streamIteratorConstructor]); |
| 218 helpers.throwExpressionHelper]); | 329 } |
| 219 | 330 return _asyncForIn; |
| 220 BackendImpact get lazyField => new BackendImpact( | 331 } |
| 221 staticUses: [ | 332 |
| 222 helpers.cyclicThrowHelper]); | 333 BackendImpact _stringInterpolation; |
| 223 | 334 |
| 224 BackendImpact get typeLiteral => new BackendImpact( | 335 BackendImpact get stringInterpolation { |
| 225 instantiatedClasses: [ | 336 if(_stringInterpolation == null) { |
| 226 backend.typeImplementation], | 337 _stringInterpolation = new BackendImpact( |
| 227 staticUses: [ | 338 staticUses: [ |
| 228 helpers.createRuntimeType]); | 339 helpers.stringInterpolationHelper]); |
| 229 | 340 } |
| 230 BackendImpact get stackTraceInCatch => new BackendImpact( | 341 return _stringInterpolation; |
| 231 instantiatedClasses: [ | 342 } |
| 232 coreClasses.stackTraceClass], | 343 |
| 233 staticUses: [ | 344 BackendImpact _catchStatement; |
| 234 helpers.traceFromException]); | 345 |
| 235 | 346 BackendImpact get catchStatement { |
| 236 BackendImpact get syncForIn => new BackendImpact( | 347 if(_catchStatement == null) { |
| 237 // The SSA builder recognizes certain for-in loops and can generate calls | 348 _catchStatement = new BackendImpact( |
| 238 // to throwConcurrentModificationError. | 349 staticUses: [ |
| 239 staticUses: [ | 350 helpers.exceptionUnwrapper], |
| 240 helpers.checkConcurrentModificationError]); | 351 instantiatedClasses: [ |
| 241 | 352 helpers.jsPlainJavaScriptObjectClass, |
| 242 BackendImpact get typeVariableExpression => new BackendImpact( | 353 helpers.jsUnknownJavaScriptObjectClass]); |
| 243 staticUses: [ | 354 } |
| 244 helpers.setRuntimeTypeInfo, | 355 return _catchStatement; |
| 245 helpers.getRuntimeTypeInfo, | 356 } |
| 246 helpers.runtimeTypeToString, | 357 |
| 247 helpers.createRuntimeType], | 358 BackendImpact _throwExpression; |
| 248 instantiatedClasses: [ | 359 |
| 249 coreClasses.listClass], | 360 BackendImpact get throwExpression { |
| 250 otherImpacts: [ | 361 if(_throwExpression == null) { |
| 251 getRuntimeTypeArgument, | 362 _throwExpression = new BackendImpact( |
| 252 needsInt('Needed for accessing a type variable literal on this.')]); | 363 // We don't know ahead of time whether we will need the throw in a |
| 253 | 364 // statement context or an expression context, so we register both |
| 254 BackendImpact get typeCheck => new BackendImpact( | 365 // here, even though we may not need the throwExpression helper. |
| 255 instantiatedClasses: [ | 366 staticUses: [ |
| 256 coreClasses.boolClass]); | 367 helpers.wrapExceptionHelper, |
| 257 | 368 helpers.throwExpressionHelper]); |
| 258 BackendImpact get checkedModeTypeCheck => new BackendImpact( | 369 } |
| 259 staticUses: [ | 370 return _throwExpression; |
| 260 helpers.throwRuntimeError]); | 371 } |
| 261 | 372 |
| 262 BackendImpact get malformedTypeCheck => new BackendImpact( | 373 BackendImpact _lazyField; |
| 263 staticUses: [ | 374 |
| 264 helpers.throwTypeError]); | 375 BackendImpact get lazyField { |
| 265 | 376 if(_lazyField == null) { |
| 266 BackendImpact get genericTypeCheck => new BackendImpact( | 377 _lazyField = new BackendImpact( |
| 267 staticUses: [ | 378 staticUses: [ |
| 268 helpers.checkSubtype, | 379 helpers.cyclicThrowHelper]); |
| 269 // TODO(johnniwinther): Investigate why this is needed. | 380 } |
| 270 helpers.setRuntimeTypeInfo, | 381 return _lazyField; |
| 271 helpers.getRuntimeTypeInfo], | 382 } |
| 272 instantiatedClasses: [ | 383 |
| 273 coreClasses.listClass], | 384 BackendImpact _typeLiteral; |
| 274 otherImpacts: [ | 385 |
| 275 getRuntimeTypeArgument]); | 386 BackendImpact get typeLiteral { |
| 276 | 387 if(_typeLiteral == null) { |
| 277 BackendImpact get genericIsCheck => new BackendImpact( | 388 _typeLiteral = new BackendImpact( |
| 278 instantiatedClasses: [ | 389 instantiatedClasses: [ |
| 279 coreClasses.listClass]); | 390 backend.typeImplementation], |
| 280 | 391 staticUses: [ |
| 281 BackendImpact get genericCheckedModeTypeCheck => new BackendImpact( | 392 helpers.createRuntimeType]); |
| 282 staticUses: [ | 393 } |
| 283 helpers.assertSubtype]); | 394 return _typeLiteral; |
| 284 | 395 } |
| 285 BackendImpact get typeVariableTypeCheck => new BackendImpact( | 396 |
| 286 staticUses: [ | 397 BackendImpact _stackTraceInCatch; |
| 287 helpers.checkSubtypeOfRuntimeType]); | 398 |
| 288 | 399 BackendImpact get stackTraceInCatch { |
| 289 BackendImpact get typeVariableCheckedModeTypeCheck => new BackendImpact( | 400 if(_stackTraceInCatch == null) { |
| 290 staticUses: [ | 401 _stackTraceInCatch = new BackendImpact( |
| 291 helpers.assertSubtypeOfRuntimeType]); | 402 instantiatedClasses: [ |
| 292 | 403 coreClasses.stackTraceClass], |
| 293 BackendImpact get functionTypeCheck => new BackendImpact( | 404 staticUses: [ |
| 294 staticUses: [ | 405 helpers.traceFromException]); |
| 295 helpers.functionTypeTestMetaHelper]); | 406 } |
| 296 | 407 return _stackTraceInCatch; |
| 297 BackendImpact get nativeTypeCheck => new BackendImpact( | 408 } |
| 298 staticUses: [ | 409 |
| 299 // We will neeed to add the "$is" and "$as" properties on the | 410 BackendImpact _syncForIn; |
| 300 // JavaScript object prototype, so we make sure | 411 |
| 301 // [:defineProperty:] is compiled. | 412 BackendImpact get syncForIn { |
| 302 helpers.defineProperty]); | 413 if(_syncForIn == null) { |
| 303 | 414 _syncForIn = new BackendImpact( |
| 304 BackendImpact get closure => new BackendImpact( | 415 // The SSA builder recognizes certain for-in loops and can generate |
| 305 instantiatedClasses: [ | 416 // calls to throwConcurrentModificationError. |
| 306 coreClasses.functionClass]); | 417 staticUses: [ |
| 418 helpers.checkConcurrentModificationError]); | |
| 419 } | |
| 420 return _syncForIn; | |
| 421 } | |
| 422 | |
| 423 BackendImpact _typeVariableExpression; | |
| 424 | |
| 425 BackendImpact get typeVariableExpression { | |
| 426 if(_typeVariableExpression == null) { | |
| 427 _typeVariableExpression = new BackendImpact( | |
| 428 staticUses: [ | |
| 429 helpers.setRuntimeTypeInfo, | |
| 430 helpers.getRuntimeTypeInfo, | |
| 431 helpers.runtimeTypeToString, | |
| 432 helpers.createRuntimeType], | |
| 433 instantiatedClasses: [ | |
| 434 coreClasses.listClass], | |
| 435 otherImpacts: [ | |
| 436 getRuntimeTypeArgument, | |
| 437 _needsInt('Needed for accessing a type variable literal on this.') | |
| 438 ]); | |
| 439 } | |
| 440 return _typeVariableExpression; | |
| 441 } | |
| 442 | |
| 443 BackendImpact _typeCheck; | |
| 444 | |
| 445 BackendImpact get typeCheck { | |
| 446 if(_typeCheck == null) { | |
| 447 _typeCheck = new BackendImpact( | |
| 448 instantiatedClasses: [ | |
| 449 coreClasses.boolClass]); | |
| 450 } | |
| 451 return _typeCheck; | |
| 452 } | |
| 453 | |
| 454 BackendImpact _checkedModeTypeCheck; | |
| 455 | |
| 456 BackendImpact get checkedModeTypeCheck { | |
| 457 if(_checkedModeTypeCheck == null) { | |
| 458 _checkedModeTypeCheck = new BackendImpact( | |
| 459 staticUses: [ | |
| 460 helpers.throwRuntimeError]); | |
| 461 } | |
| 462 return _checkedModeTypeCheck; | |
| 463 } | |
| 464 | |
| 465 BackendImpact _malformedTypeCheck; | |
| 466 | |
| 467 BackendImpact get malformedTypeCheck { | |
| 468 if(_malformedTypeCheck == null) { | |
| 469 _malformedTypeCheck = new BackendImpact( | |
| 470 staticUses: [ | |
| 471 helpers.throwTypeError]); | |
| 472 } | |
| 473 return _malformedTypeCheck; | |
| 474 } | |
| 475 | |
| 476 BackendImpact _genericTypeCheck; | |
| 477 | |
| 478 BackendImpact get genericTypeCheck { | |
| 479 if(_genericTypeCheck == null) { | |
| 480 _genericTypeCheck = new BackendImpact( | |
| 481 staticUses: [ | |
| 482 helpers.checkSubtype, | |
| 483 // TODO(johnniwinther): Investigate why this is needed. | |
| 484 helpers.setRuntimeTypeInfo, | |
| 485 helpers.getRuntimeTypeInfo], | |
| 486 instantiatedClasses: [ | |
| 487 coreClasses.listClass], | |
| 488 otherImpacts: [ | |
| 489 getRuntimeTypeArgument]); | |
| 490 } | |
| 491 return _genericTypeCheck; | |
| 492 } | |
| 493 | |
| 494 BackendImpact _genericIsCheck; | |
| 495 | |
| 496 BackendImpact get genericIsCheck { | |
| 497 if(_genericIsCheck == null) { | |
| 498 _genericIsCheck = new BackendImpact( | |
| 499 instantiatedClasses: [ | |
| 500 coreClasses.listClass]); | |
| 501 } | |
| 502 return _genericIsCheck; | |
| 503 } | |
| 504 | |
| 505 BackendImpact _genericCheckedModeTypeCheck; | |
| 506 | |
| 507 BackendImpact get genericCheckedModeTypeCheck { | |
| 508 if(_genericCheckedModeTypeCheck == null) { | |
| 509 _genericCheckedModeTypeCheck = new BackendImpact( | |
| 510 staticUses: [ | |
| 511 helpers.assertSubtype]); | |
| 512 } | |
| 513 return _genericCheckedModeTypeCheck; | |
| 514 } | |
| 515 | |
| 516 BackendImpact _typeVariableTypeCheck; | |
| 517 | |
| 518 BackendImpact get typeVariableTypeCheck { | |
| 519 if(_typeVariableTypeCheck == null) { | |
| 520 _typeVariableTypeCheck = new BackendImpact( | |
| 521 staticUses: [ | |
| 522 helpers.checkSubtypeOfRuntimeType]); | |
| 523 } | |
| 524 return _typeVariableTypeCheck; | |
| 525 } | |
| 526 | |
| 527 BackendImpact _typeVariableCheckedModeTypeCheck; | |
| 528 | |
| 529 BackendImpact get typeVariableCheckedModeTypeCheck { | |
| 530 if(_typeVariableCheckedModeTypeCheck == null) { | |
| 531 _typeVariableCheckedModeTypeCheck = new BackendImpact( | |
| 532 staticUses: [ | |
| 533 helpers.assertSubtypeOfRuntimeType]); | |
| 534 } | |
| 535 return _typeVariableCheckedModeTypeCheck; | |
| 536 } | |
| 537 | |
| 538 BackendImpact _functionTypeCheck; | |
| 539 | |
| 540 BackendImpact get functionTypeCheck { | |
| 541 if(_functionTypeCheck == null) { | |
| 542 _functionTypeCheck = new BackendImpact( | |
| 543 staticUses: [ | |
| 544 helpers.functionTypeTestMetaHelper]); | |
| 545 } | |
| 546 return _functionTypeCheck; | |
| 547 } | |
| 548 | |
| 549 BackendImpact _nativeTypeCheck; | |
| 550 | |
| 551 BackendImpact get nativeTypeCheck { | |
| 552 if(_nativeTypeCheck == null) { | |
| 553 _nativeTypeCheck = new BackendImpact( | |
| 554 staticUses: [ | |
| 555 // We will neeed to add the "$is" and "$as" properties on the | |
| 556 // JavaScript object prototype, so we make sure | |
| 557 // [:defineProperty:] is compiled. | |
| 558 helpers.defineProperty]); | |
| 559 } | |
| 560 return _nativeTypeCheck; | |
| 561 } | |
| 562 | |
| 563 BackendImpact _closure; | |
| 564 | |
| 565 BackendImpact get closure { | |
| 566 if(_closure == null) { | |
| 567 _closure = new BackendImpact( | |
| 568 instantiatedClasses: [ | |
| 569 coreClasses.functionClass]); | |
| 570 } | |
| 571 return _closure; | |
| 572 } | |
| 307 } | 573 } |
| OLD | NEW |