| 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 952 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 963 DartType type = member.computeType(compiler); | 963 DartType type = member.computeType(compiler); |
| 964 enqueuer.registerIsCheck(type); | 964 enqueuer.registerIsCheck(type); |
| 965 }); | 965 }); |
| 966 } | 966 } |
| 967 } | 967 } |
| 968 | 968 |
| 969 JavaScriptItemCompilationContext createItemCompilationContext() { | 969 JavaScriptItemCompilationContext createItemCompilationContext() { |
| 970 return new JavaScriptItemCompilationContext(); | 970 return new JavaScriptItemCompilationContext(); |
| 971 } | 971 } |
| 972 | 972 |
| 973 void addBackendRtiDependencies(World world) { |
| 974 if (jsArrayClass != null) { |
| 975 world.registerRtiDependency(jsArrayClass, compiler.listClass); |
| 976 } |
| 977 } |
| 978 |
| 973 void enqueueHelpers(ResolutionEnqueuer world) { | 979 void enqueueHelpers(ResolutionEnqueuer world) { |
| 974 jsIndexingBehaviorInterface = | 980 jsIndexingBehaviorInterface = |
| 975 compiler.findHelper(const SourceString('JavaScriptIndexingBehavior')); | 981 compiler.findHelper(const SourceString('JavaScriptIndexingBehavior')); |
| 976 if (jsIndexingBehaviorInterface != null) { | 982 if (jsIndexingBehaviorInterface != null) { |
| 977 world.registerIsCheck(jsIndexingBehaviorInterface.computeType(compiler)); | 983 world.registerIsCheck(jsIndexingBehaviorInterface.computeType(compiler)); |
| 978 } | 984 } |
| 979 | 985 |
| 980 if (compiler.enableTypeAssertions) { | 986 if (compiler.enableTypeAssertions) { |
| 981 // Unconditionally register the helper that checks if the | 987 // Unconditionally register the helper that checks if the |
| 982 // expression in an if/while/for is a boolean. | 988 // expression in an if/while/for is a boolean. |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1004 } | 1010 } |
| 1005 | 1011 |
| 1006 void registerTypeLiteral() { | 1012 void registerTypeLiteral() { |
| 1007 enqueueInResolution(getCreateRuntimeType()); | 1013 enqueueInResolution(getCreateRuntimeType()); |
| 1008 } | 1014 } |
| 1009 | 1015 |
| 1010 void registerStackTraceInCatch() { | 1016 void registerStackTraceInCatch() { |
| 1011 enqueueInResolution(getTraceFromException()); | 1017 enqueueInResolution(getTraceFromException()); |
| 1012 } | 1018 } |
| 1013 | 1019 |
| 1020 void registerSetRuntimeType() { |
| 1021 enqueueInResolution(getSetRuntimeTypeInfo()); |
| 1022 } |
| 1023 |
| 1024 void registerGetRuntimeTypeArgument() { |
| 1025 enqueueInResolution(getGetRuntimeTypeArgument()); |
| 1026 } |
| 1027 |
| 1014 void registerRuntimeType() { | 1028 void registerRuntimeType() { |
| 1015 enqueueInResolution(getSetRuntimeTypeInfo()); | 1029 enqueueInResolution(getSetRuntimeTypeInfo()); |
| 1016 enqueueInResolution(getGetRuntimeTypeInfo()); | 1030 enqueueInResolution(getGetRuntimeTypeInfo()); |
| 1017 enqueueInResolution(getGetRuntimeTypeArgument()); | 1031 enqueueInResolution(getGetRuntimeTypeArgument()); |
| 1018 compiler.enqueuer.resolution.registerInstantiatedClass(compiler.listClass); | 1032 compiler.enqueuer.resolution.registerInstantiatedClass(compiler.listClass); |
| 1019 } | 1033 } |
| 1020 | 1034 |
| 1021 void registerIsCheck(DartType type, Enqueuer world) { | 1035 void registerIsCheck(DartType type, Enqueuer world) { |
| 1022 if (!type.isRaw) { | 1036 bool isTypeVariable = type.kind == TypeKind.TYPE_VARIABLE; |
| 1037 if (!type.isRaw || isTypeVariable) { |
| 1023 enqueueInResolution(getSetRuntimeTypeInfo()); | 1038 enqueueInResolution(getSetRuntimeTypeInfo()); |
| 1024 enqueueInResolution(getGetRuntimeTypeInfo()); | 1039 enqueueInResolution(getGetRuntimeTypeInfo()); |
| 1025 enqueueInResolution(getGetRuntimeTypeArgument()); | 1040 enqueueInResolution(getGetRuntimeTypeArgument()); |
| 1026 enqueueInResolution(getCheckArguments()); | 1041 enqueueInResolution(getCheckArguments()); |
| 1042 if (isTypeVariable) enqueueInResolution(getGetObjectIsSubtype()); |
| 1027 world.registerInstantiatedClass(compiler.listClass); | 1043 world.registerInstantiatedClass(compiler.listClass); |
| 1028 } | 1044 } |
| 1029 // [registerIsCheck] is also called for checked mode checks, so we | 1045 // [registerIsCheck] is also called for checked mode checks, so we |
| 1030 // need to register checked mode helpers. | 1046 // need to register checked mode helpers. |
| 1031 if (compiler.enableTypeAssertions) { | 1047 if (compiler.enableTypeAssertions) { |
| 1032 Element e = getCheckedModeHelper(type, typeCast: false); | 1048 Element e = getCheckedModeHelper(type, typeCast: false); |
| 1033 if (e != null) world.addToWorkList(e); | 1049 if (e != null) world.addToWorkList(e); |
| 1034 // We also need the native variant of the check (for DOM types). | 1050 // We also need the native variant of the check (for DOM types). |
| 1035 e = getNativeCheckedModeHelper(type, typeCast: false); | 1051 e = getNativeCheckedModeHelper(type, typeCast: false); |
| 1036 if (e != null) world.addToWorkList(e); | 1052 if (e != null) world.addToWorkList(e); |
| (...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1465 } | 1481 } |
| 1466 | 1482 |
| 1467 Element getGetRuntimeTypeArgument() { | 1483 Element getGetRuntimeTypeArgument() { |
| 1468 return compiler.findHelper(const SourceString('getRuntimeTypeArgument')); | 1484 return compiler.findHelper(const SourceString('getRuntimeTypeArgument')); |
| 1469 } | 1485 } |
| 1470 | 1486 |
| 1471 Element getCheckArguments() { | 1487 Element getCheckArguments() { |
| 1472 return compiler.findHelper(const SourceString('checkArguments')); | 1488 return compiler.findHelper(const SourceString('checkArguments')); |
| 1473 } | 1489 } |
| 1474 | 1490 |
| 1491 Element getGetObjectIsSubtype() { |
| 1492 return compiler.findHelper(const SourceString('objectIsSubtype')); |
| 1493 } |
| 1494 |
| 1475 Element getThrowNoSuchMethod() { | 1495 Element getThrowNoSuchMethod() { |
| 1476 return compiler.findHelper(const SourceString('throwNoSuchMethod')); | 1496 return compiler.findHelper(const SourceString('throwNoSuchMethod')); |
| 1477 } | 1497 } |
| 1478 | 1498 |
| 1479 Element getCreateRuntimeType() { | 1499 Element getCreateRuntimeType() { |
| 1480 return compiler.findHelper(const SourceString('createRuntimeType')); | 1500 return compiler.findHelper(const SourceString('createRuntimeType')); |
| 1481 } | 1501 } |
| 1482 | 1502 |
| 1483 Element getFallThroughError() { | 1503 Element getFallThroughError() { |
| 1484 return compiler.findHelper(const SourceString("getFallThroughError")); | 1504 return compiler.findHelper(const SourceString("getFallThroughError")); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1498 * | 1518 * |
| 1499 * Invariant: [element] must be a declaration element. | 1519 * Invariant: [element] must be a declaration element. |
| 1500 */ | 1520 */ |
| 1501 void eagerRecompile(Element element) { | 1521 void eagerRecompile(Element element) { |
| 1502 assert(invariant(element, element.isDeclaration)); | 1522 assert(invariant(element, element.isDeclaration)); |
| 1503 generatedCode.remove(element); | 1523 generatedCode.remove(element); |
| 1504 generatedBailoutCode.remove(element); | 1524 generatedBailoutCode.remove(element); |
| 1505 compiler.enqueuer.codegen.addToWorkList(element); | 1525 compiler.enqueuer.codegen.addToWorkList(element); |
| 1506 } | 1526 } |
| 1507 } | 1527 } |
| OLD | NEW |