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 977 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
988 enqueueInResolution(getTraceFromException()); | 988 enqueueInResolution(getTraceFromException()); |
989 } | 989 } |
990 | 990 |
991 void registerRuntimeType() { | 991 void registerRuntimeType() { |
992 enqueueInResolution(getSetRuntimeTypeInfo()); | 992 enqueueInResolution(getSetRuntimeTypeInfo()); |
993 enqueueInResolution(getGetRuntimeTypeInfo()); | 993 enqueueInResolution(getGetRuntimeTypeInfo()); |
994 enqueueInResolution(getGetRuntimeTypeArgument()); | 994 enqueueInResolution(getGetRuntimeTypeArgument()); |
995 } | 995 } |
996 | 996 |
997 void registerIsCheck(DartType type, Enqueuer world) { | 997 void registerIsCheck(DartType type, Enqueuer world) { |
998 if (!type.isRaw) { | 998 bool isTypeVariable = type.kind == TypeKind.TYPE_VARIABLE; |
| 999 if (!type.isRaw || isTypeVariable) { |
999 enqueueInResolution(getSetRuntimeTypeInfo()); | 1000 enqueueInResolution(getSetRuntimeTypeInfo()); |
1000 enqueueInResolution(getGetRuntimeTypeInfo()); | 1001 enqueueInResolution(getGetRuntimeTypeInfo()); |
1001 enqueueInResolution(getGetRuntimeTypeArgument()); | 1002 enqueueInResolution(getGetRuntimeTypeArgument()); |
1002 enqueueInResolution(getCheckArguments()); | 1003 enqueueInResolution(getCheckArguments()); |
| 1004 if (isTypeVariable) enqueueInResolution(getGetObjectIsSubtype()); |
1003 } | 1005 } |
1004 // [registerIsCheck] is also called for checked mode checks, so we | 1006 // [registerIsCheck] is also called for checked mode checks, so we |
1005 // need to register checked mode helpers. | 1007 // need to register checked mode helpers. |
1006 if (compiler.enableTypeAssertions) { | 1008 if (compiler.enableTypeAssertions) { |
1007 Element e = getCheckedModeHelper(type, typeCast: false); | 1009 Element e = getCheckedModeHelper(type, typeCast: false); |
1008 if (e != null) world.addToWorkList(e); | 1010 if (e != null) world.addToWorkList(e); |
1009 // We also need the native variant of the check (for DOM types). | 1011 // We also need the native variant of the check (for DOM types). |
1010 e = getNativeCheckedModeHelper(type, typeCast: false); | 1012 e = getNativeCheckedModeHelper(type, typeCast: false); |
1011 if (e != null) world.addToWorkList(e); | 1013 if (e != null) world.addToWorkList(e); |
1012 } | 1014 } |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1437 } | 1439 } |
1438 | 1440 |
1439 Element getGetRuntimeTypeArgument() { | 1441 Element getGetRuntimeTypeArgument() { |
1440 return compiler.findHelper(const SourceString('getRuntimeTypeArgument')); | 1442 return compiler.findHelper(const SourceString('getRuntimeTypeArgument')); |
1441 } | 1443 } |
1442 | 1444 |
1443 Element getCheckArguments() { | 1445 Element getCheckArguments() { |
1444 return compiler.findHelper(const SourceString('checkArguments')); | 1446 return compiler.findHelper(const SourceString('checkArguments')); |
1445 } | 1447 } |
1446 | 1448 |
| 1449 Element getGetObjectIsSubtype() { |
| 1450 return compiler.findHelper(const SourceString('objectIsSubtype')); |
| 1451 } |
| 1452 |
1447 Element getThrowNoSuchMethod() { | 1453 Element getThrowNoSuchMethod() { |
1448 return compiler.findHelper(const SourceString('throwNoSuchMethod')); | 1454 return compiler.findHelper(const SourceString('throwNoSuchMethod')); |
1449 } | 1455 } |
1450 | 1456 |
1451 Element getCreateRuntimeType() { | 1457 Element getCreateRuntimeType() { |
1452 return compiler.findHelper(const SourceString('createRuntimeType')); | 1458 return compiler.findHelper(const SourceString('createRuntimeType')); |
1453 } | 1459 } |
1454 | 1460 |
1455 Element getFallThroughError() { | 1461 Element getFallThroughError() { |
1456 return compiler.findHelper(const SourceString("getFallThroughError")); | 1462 return compiler.findHelper(const SourceString("getFallThroughError")); |
(...skipping 13 matching lines...) Expand all Loading... |
1470 * | 1476 * |
1471 * Invariant: [element] must be a declaration element. | 1477 * Invariant: [element] must be a declaration element. |
1472 */ | 1478 */ |
1473 void eagerRecompile(Element element) { | 1479 void eagerRecompile(Element element) { |
1474 assert(invariant(element, element.isDeclaration)); | 1480 assert(invariant(element, element.isDeclaration)); |
1475 generatedCode.remove(element); | 1481 generatedCode.remove(element); |
1476 generatedBailoutCode.remove(element); | 1482 generatedBailoutCode.remove(element); |
1477 compiler.enqueuer.codegen.addToWorkList(element); | 1483 compiler.enqueuer.codegen.addToWorkList(element); |
1478 } | 1484 } |
1479 } | 1485 } |
OLD | NEW |