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 typedef void Recompile(Element element); | 7 typedef void Recompile(Element element); |
8 | 8 |
9 class ReturnInfo { | 9 class ReturnInfo { |
10 HType returnType; | 10 HType returnType; |
(...skipping 970 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
981 } | 981 } |
982 | 982 |
983 void registerTypeLiteral() { | 983 void registerTypeLiteral() { |
984 enqueueInResolution(getCreateRuntimeType()); | 984 enqueueInResolution(getCreateRuntimeType()); |
985 } | 985 } |
986 | 986 |
987 void registerStackTraceInCatch() { | 987 void registerStackTraceInCatch() { |
988 enqueueInResolution(getTraceFromException()); | 988 enqueueInResolution(getTraceFromException()); |
989 } | 989 } |
990 | 990 |
| 991 void registerSetRuntimeType() { |
| 992 enqueueInResolution(getSetRuntimeTypeInfo()); |
| 993 } |
| 994 |
| 995 void registerGetRuntimeTypeArgument() { |
| 996 enqueueInResolution(getGetRuntimeTypeArgument()); |
| 997 } |
| 998 |
991 void registerRuntimeType() { | 999 void registerRuntimeType() { |
992 enqueueInResolution(getSetRuntimeTypeInfo()); | 1000 enqueueInResolution(getSetRuntimeTypeInfo()); |
993 enqueueInResolution(getGetRuntimeTypeInfo()); | 1001 enqueueInResolution(getGetRuntimeTypeInfo()); |
994 enqueueInResolution(getGetRuntimeTypeArgument()); | 1002 enqueueInResolution(getGetRuntimeTypeArgument()); |
995 } | 1003 } |
996 | 1004 |
997 void registerIsCheck(DartType type, Enqueuer world) { | 1005 void registerIsCheck(DartType type, Enqueuer world) { |
998 if (!type.isRaw) { | 1006 bool isTypeVariable = type.kind == TypeKind.TYPE_VARIABLE; |
| 1007 if (!type.isRaw || isTypeVariable) { |
999 enqueueInResolution(getSetRuntimeTypeInfo()); | 1008 enqueueInResolution(getSetRuntimeTypeInfo()); |
1000 enqueueInResolution(getGetRuntimeTypeInfo()); | 1009 enqueueInResolution(getGetRuntimeTypeInfo()); |
1001 enqueueInResolution(getGetRuntimeTypeArgument()); | 1010 enqueueInResolution(getGetRuntimeTypeArgument()); |
1002 enqueueInResolution(getCheckArguments()); | 1011 enqueueInResolution(getCheckArguments()); |
| 1012 if (isTypeVariable) enqueueInResolution(getGetObjectIsSubtype()); |
1003 } | 1013 } |
1004 // [registerIsCheck] is also called for checked mode checks, so we | 1014 // [registerIsCheck] is also called for checked mode checks, so we |
1005 // need to register checked mode helpers. | 1015 // need to register checked mode helpers. |
1006 if (compiler.enableTypeAssertions) { | 1016 if (compiler.enableTypeAssertions) { |
1007 Element e = getCheckedModeHelper(type, typeCast: false); | 1017 Element e = getCheckedModeHelper(type, typeCast: false); |
1008 if (e != null) world.addToWorkList(e); | 1018 if (e != null) world.addToWorkList(e); |
1009 // We also need the native variant of the check (for DOM types). | 1019 // We also need the native variant of the check (for DOM types). |
1010 e = getNativeCheckedModeHelper(type, typeCast: false); | 1020 e = getNativeCheckedModeHelper(type, typeCast: false); |
1011 if (e != null) world.addToWorkList(e); | 1021 if (e != null) world.addToWorkList(e); |
1012 } | 1022 } |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1437 } | 1447 } |
1438 | 1448 |
1439 Element getGetRuntimeTypeArgument() { | 1449 Element getGetRuntimeTypeArgument() { |
1440 return compiler.findHelper(const SourceString('getRuntimeTypeArgument')); | 1450 return compiler.findHelper(const SourceString('getRuntimeTypeArgument')); |
1441 } | 1451 } |
1442 | 1452 |
1443 Element getCheckArguments() { | 1453 Element getCheckArguments() { |
1444 return compiler.findHelper(const SourceString('checkArguments')); | 1454 return compiler.findHelper(const SourceString('checkArguments')); |
1445 } | 1455 } |
1446 | 1456 |
| 1457 Element getGetObjectIsSubtype() { |
| 1458 return compiler.findHelper(const SourceString('objectIsSubtype')); |
| 1459 } |
| 1460 |
1447 Element getThrowNoSuchMethod() { | 1461 Element getThrowNoSuchMethod() { |
1448 return compiler.findHelper(const SourceString('throwNoSuchMethod')); | 1462 return compiler.findHelper(const SourceString('throwNoSuchMethod')); |
1449 } | 1463 } |
1450 | 1464 |
1451 Element getCreateRuntimeType() { | 1465 Element getCreateRuntimeType() { |
1452 return compiler.findHelper(const SourceString('createRuntimeType')); | 1466 return compiler.findHelper(const SourceString('createRuntimeType')); |
1453 } | 1467 } |
1454 | 1468 |
1455 Element getFallThroughError() { | 1469 Element getFallThroughError() { |
1456 return compiler.findHelper(const SourceString("getFallThroughError")); | 1470 return compiler.findHelper(const SourceString("getFallThroughError")); |
(...skipping 13 matching lines...) Expand all Loading... |
1470 * | 1484 * |
1471 * Invariant: [element] must be a declaration element. | 1485 * Invariant: [element] must be a declaration element. |
1472 */ | 1486 */ |
1473 void eagerRecompile(Element element) { | 1487 void eagerRecompile(Element element) { |
1474 assert(invariant(element, element.isDeclaration)); | 1488 assert(invariant(element, element.isDeclaration)); |
1475 generatedCode.remove(element); | 1489 generatedCode.remove(element); |
1476 generatedBailoutCode.remove(element); | 1490 generatedBailoutCode.remove(element); |
1477 compiler.enqueuer.codegen.addToWorkList(element); | 1491 compiler.enqueuer.codegen.addToWorkList(element); |
1478 } | 1492 } |
1479 } | 1493 } |
OLD | NEW |