| 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 part of js_backend; | 5 part of js_backend; |
| 6 | 6 |
| 7 class JavaScriptItemCompilationContext extends ItemCompilationContext { | 7 class JavaScriptItemCompilationContext extends ItemCompilationContext { |
| 8 final Set<HInstruction> boundsChecked; | 8 final Set<HInstruction> boundsChecked; |
| 9 | 9 |
| 10 JavaScriptItemCompilationContext() | 10 JavaScriptItemCompilationContext() |
| (...skipping 972 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 983 enqueue(world, helper.getElement(compiler), elements); | 983 enqueue(world, helper.getElement(compiler), elements); |
| 984 } | 984 } |
| 985 // We also need the native variant of the check (for DOM types). | 985 // We also need the native variant of the check (for DOM types). |
| 986 helper = getNativeCheckedModeHelper(type, typeCast: false); | 986 helper = getNativeCheckedModeHelper(type, typeCast: false); |
| 987 if (helper != null) { | 987 if (helper != null) { |
| 988 enqueue(world, helper.getElement(compiler), elements); | 988 enqueue(world, helper.getElement(compiler), elements); |
| 989 } | 989 } |
| 990 } | 990 } |
| 991 } | 991 } |
| 992 bool isTypeVariable = type.kind == TypeKind.TYPE_VARIABLE; | 992 bool isTypeVariable = type.kind == TypeKind.TYPE_VARIABLE; |
| 993 if (!type.isRaw || type.containsTypeVariables) { | 993 if (!type.treatAsRaw || type.containsTypeVariables) { |
| 994 enqueueInResolution(getSetRuntimeTypeInfo(), elements); | 994 enqueueInResolution(getSetRuntimeTypeInfo(), elements); |
| 995 enqueueInResolution(getGetRuntimeTypeInfo(), elements); | 995 enqueueInResolution(getGetRuntimeTypeInfo(), elements); |
| 996 enqueueInResolution(getGetRuntimeTypeArgument(), elements); | 996 enqueueInResolution(getGetRuntimeTypeArgument(), elements); |
| 997 if (inCheckedMode) { | 997 if (inCheckedMode) { |
| 998 enqueueInResolution(getAssertSubtype(), elements); | 998 enqueueInResolution(getAssertSubtype(), elements); |
| 999 } | 999 } |
| 1000 enqueueInResolution(getCheckSubtype(), elements); | 1000 enqueueInResolution(getCheckSubtype(), elements); |
| 1001 if (isTypeVariable) { | 1001 if (isTypeVariable) { |
| 1002 enqueueInResolution(getCheckSubtypeOfRuntimeType(), elements); | 1002 enqueueInResolution(getCheckSubtypeOfRuntimeType(), elements); |
| 1003 if (inCheckedMode) { | 1003 if (inCheckedMode) { |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1365 if (nativeCheck) { | 1365 if (nativeCheck) { |
| 1366 return typeCast | 1366 return typeCast |
| 1367 ? 'stringSuperNativeTypeCast' | 1367 ? 'stringSuperNativeTypeCast' |
| 1368 : 'stringSuperNativeTypeCheck'; | 1368 : 'stringSuperNativeTypeCheck'; |
| 1369 } else { | 1369 } else { |
| 1370 return typeCast | 1370 return typeCast |
| 1371 ? 'stringSuperTypeCast' | 1371 ? 'stringSuperTypeCast' |
| 1372 : 'stringSuperTypeCheck'; | 1372 : 'stringSuperTypeCheck'; |
| 1373 } | 1373 } |
| 1374 } else if ((element == compiler.listClass || element == jsArrayClass) && | 1374 } else if ((element == compiler.listClass || element == jsArrayClass) && |
| 1375 type.isRaw) { | 1375 type.treatAsRaw) { |
| 1376 if (nativeCheckOnly) return null; | 1376 if (nativeCheckOnly) return null; |
| 1377 return typeCast | 1377 return typeCast |
| 1378 ? 'listTypeCast' | 1378 ? 'listTypeCast' |
| 1379 : 'listTypeCheck'; | 1379 : 'listTypeCheck'; |
| 1380 } else { | 1380 } else { |
| 1381 if (Elements.isListSupertype(element, compiler)) { | 1381 if (Elements.isListSupertype(element, compiler)) { |
| 1382 if (nativeCheck) { | 1382 if (nativeCheck) { |
| 1383 return typeCast | 1383 return typeCast |
| 1384 ? 'listSuperNativeTypeCast' | 1384 ? 'listSuperNativeTypeCast' |
| 1385 : 'listSuperNativeTypeCheck'; | 1385 : 'listSuperNativeTypeCheck'; |
| 1386 } else { | 1386 } else { |
| 1387 return typeCast | 1387 return typeCast |
| 1388 ? 'listSuperTypeCast' | 1388 ? 'listSuperTypeCast' |
| 1389 : 'listSuperTypeCheck'; | 1389 : 'listSuperTypeCheck'; |
| 1390 } | 1390 } |
| 1391 } else { | 1391 } else { |
| 1392 if (nativeCheck) { | 1392 if (nativeCheck) { |
| 1393 // TODO(karlklose): can we get rid of this branch when we use | 1393 // TODO(karlklose): can we get rid of this branch when we use |
| 1394 // interceptors? | 1394 // interceptors? |
| 1395 return typeCast | 1395 return typeCast |
| 1396 ? 'interceptedTypeCast' | 1396 ? 'interceptedTypeCast' |
| 1397 : 'interceptedTypeCheck'; | 1397 : 'interceptedTypeCheck'; |
| 1398 } else { | 1398 } else { |
| 1399 if (type.kind == TypeKind.INTERFACE && !type.isRaw) { | 1399 if (type.kind == TypeKind.INTERFACE && !type.treatAsRaw) { |
| 1400 return typeCast | 1400 return typeCast |
| 1401 ? 'subtypeCast' | 1401 ? 'subtypeCast' |
| 1402 : 'assertSubtype'; | 1402 : 'assertSubtype'; |
| 1403 } else if (type.kind == TypeKind.TYPE_VARIABLE) { | 1403 } else if (type.kind == TypeKind.TYPE_VARIABLE) { |
| 1404 return typeCast | 1404 return typeCast |
| 1405 ? 'subtypeOfRuntimeTypeCast' | 1405 ? 'subtypeOfRuntimeTypeCast' |
| 1406 : 'assertSubtypeOfRuntimeType'; | 1406 : 'assertSubtypeOfRuntimeType'; |
| 1407 } else if (type.kind == TypeKind.FUNCTION) { | 1407 } else if (type.kind == TypeKind.FUNCTION) { |
| 1408 return typeCast | 1408 return typeCast |
| 1409 ? 'functionSubtypeCast' | 1409 ? 'functionSubtypeCast' |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1842 copy(constant.values); | 1842 copy(constant.values); |
| 1843 copy(constant.protoValue); | 1843 copy(constant.protoValue); |
| 1844 copy(constant); | 1844 copy(constant); |
| 1845 } | 1845 } |
| 1846 | 1846 |
| 1847 void visitConstructed(ConstructedConstant constant) { | 1847 void visitConstructed(ConstructedConstant constant) { |
| 1848 copy(constant.fields); | 1848 copy(constant.fields); |
| 1849 copy(constant); | 1849 copy(constant); |
| 1850 } | 1850 } |
| 1851 } | 1851 } |
| OLD | NEW |