| 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 929 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 940 DartType type = member.computeType(compiler); | 940 DartType type = member.computeType(compiler); |
| 941 enqueuer.registerIsCheck(type); | 941 enqueuer.registerIsCheck(type); |
| 942 }); | 942 }); |
| 943 } | 943 } |
| 944 } | 944 } |
| 945 | 945 |
| 946 JavaScriptItemCompilationContext createItemCompilationContext() { | 946 JavaScriptItemCompilationContext createItemCompilationContext() { |
| 947 return new JavaScriptItemCompilationContext(); | 947 return new JavaScriptItemCompilationContext(); |
| 948 } | 948 } |
| 949 | 949 |
| 950 void addBackendRtiDependencies(World world) { |
| 951 if (jsArrayClass != null) { |
| 952 world.registerRtiDependency(jsArrayClass, compiler.listClass); |
| 953 } |
| 954 } |
| 955 |
| 950 void enqueueHelpers(ResolutionEnqueuer world) { | 956 void enqueueHelpers(ResolutionEnqueuer world) { |
| 951 jsIndexingBehaviorInterface = | 957 jsIndexingBehaviorInterface = |
| 952 compiler.findHelper(const SourceString('JavaScriptIndexingBehavior')); | 958 compiler.findHelper(const SourceString('JavaScriptIndexingBehavior')); |
| 953 if (jsIndexingBehaviorInterface != null) { | 959 if (jsIndexingBehaviorInterface != null) { |
| 954 world.registerIsCheck(jsIndexingBehaviorInterface.computeType(compiler)); | 960 world.registerIsCheck(jsIndexingBehaviorInterface.computeType(compiler)); |
| 955 } | 961 } |
| 956 | 962 |
| 957 if (compiler.enableTypeAssertions) { | 963 if (compiler.enableTypeAssertions) { |
| 958 // Unconditionally register the helper that checks if the | 964 // Unconditionally register the helper that checks if the |
| 959 // expression in an if/while/for is a boolean. | 965 // expression in an if/while/for is a boolean. |
| (...skipping 21 matching lines...) Expand all Loading... |
| 981 } | 987 } |
| 982 | 988 |
| 983 void registerTypeLiteral() { | 989 void registerTypeLiteral() { |
| 984 enqueueInResolution(getCreateRuntimeType()); | 990 enqueueInResolution(getCreateRuntimeType()); |
| 985 } | 991 } |
| 986 | 992 |
| 987 void registerStackTraceInCatch() { | 993 void registerStackTraceInCatch() { |
| 988 enqueueInResolution(getTraceFromException()); | 994 enqueueInResolution(getTraceFromException()); |
| 989 } | 995 } |
| 990 | 996 |
| 997 void registerSetRuntimeType() { |
| 998 enqueueInResolution(getSetRuntimeTypeInfo()); |
| 999 } |
| 1000 |
| 1001 void registerGetRuntimeTypeArgument() { |
| 1002 enqueueInResolution(getGetRuntimeTypeArgument()); |
| 1003 } |
| 1004 |
| 991 void registerRuntimeType() { | 1005 void registerRuntimeType() { |
| 992 enqueueInResolution(getSetRuntimeTypeInfo()); | 1006 enqueueInResolution(getSetRuntimeTypeInfo()); |
| 993 enqueueInResolution(getGetRuntimeTypeInfo()); | 1007 enqueueInResolution(getGetRuntimeTypeInfo()); |
| 994 enqueueInResolution(getGetRuntimeTypeArgument()); | 1008 enqueueInResolution(getGetRuntimeTypeArgument()); |
| 995 } | 1009 } |
| 996 | 1010 |
| 997 void registerIsCheck(DartType type, Enqueuer world) { | 1011 void registerIsCheck(DartType type, Enqueuer world) { |
| 998 if (!type.isRaw) { | 1012 bool isTypeVariable = type.kind == TypeKind.TYPE_VARIABLE; |
| 1013 if (!type.isRaw || isTypeVariable) { |
| 999 enqueueInResolution(getSetRuntimeTypeInfo()); | 1014 enqueueInResolution(getSetRuntimeTypeInfo()); |
| 1000 enqueueInResolution(getGetRuntimeTypeInfo()); | 1015 enqueueInResolution(getGetRuntimeTypeInfo()); |
| 1001 enqueueInResolution(getGetRuntimeTypeArgument()); | 1016 enqueueInResolution(getGetRuntimeTypeArgument()); |
| 1002 enqueueInResolution(getCheckArguments()); | 1017 enqueueInResolution(getCheckArguments()); |
| 1018 if (isTypeVariable) enqueueInResolution(getGetObjectIsSubtype()); |
| 1003 } | 1019 } |
| 1004 // [registerIsCheck] is also called for checked mode checks, so we | 1020 // [registerIsCheck] is also called for checked mode checks, so we |
| 1005 // need to register checked mode helpers. | 1021 // need to register checked mode helpers. |
| 1006 if (compiler.enableTypeAssertions) { | 1022 if (compiler.enableTypeAssertions) { |
| 1007 Element e = getCheckedModeHelper(type, typeCast: false); | 1023 Element e = getCheckedModeHelper(type, typeCast: false); |
| 1008 if (e != null) world.addToWorkList(e); | 1024 if (e != null) world.addToWorkList(e); |
| 1009 // We also need the native variant of the check (for DOM types). | 1025 // We also need the native variant of the check (for DOM types). |
| 1010 e = getNativeCheckedModeHelper(type, typeCast: false); | 1026 e = getNativeCheckedModeHelper(type, typeCast: false); |
| 1011 if (e != null) world.addToWorkList(e); | 1027 if (e != null) world.addToWorkList(e); |
| 1012 } | 1028 } |
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1437 } | 1453 } |
| 1438 | 1454 |
| 1439 Element getGetRuntimeTypeArgument() { | 1455 Element getGetRuntimeTypeArgument() { |
| 1440 return compiler.findHelper(const SourceString('getRuntimeTypeArgument')); | 1456 return compiler.findHelper(const SourceString('getRuntimeTypeArgument')); |
| 1441 } | 1457 } |
| 1442 | 1458 |
| 1443 Element getCheckArguments() { | 1459 Element getCheckArguments() { |
| 1444 return compiler.findHelper(const SourceString('checkArguments')); | 1460 return compiler.findHelper(const SourceString('checkArguments')); |
| 1445 } | 1461 } |
| 1446 | 1462 |
| 1463 Element getGetObjectIsSubtype() { |
| 1464 return compiler.findHelper(const SourceString('objectIsSubtype')); |
| 1465 } |
| 1466 |
| 1447 Element getThrowNoSuchMethod() { | 1467 Element getThrowNoSuchMethod() { |
| 1448 return compiler.findHelper(const SourceString('throwNoSuchMethod')); | 1468 return compiler.findHelper(const SourceString('throwNoSuchMethod')); |
| 1449 } | 1469 } |
| 1450 | 1470 |
| 1451 Element getCreateRuntimeType() { | 1471 Element getCreateRuntimeType() { |
| 1452 return compiler.findHelper(const SourceString('createRuntimeType')); | 1472 return compiler.findHelper(const SourceString('createRuntimeType')); |
| 1453 } | 1473 } |
| 1454 | 1474 |
| 1455 Element getFallThroughError() { | 1475 Element getFallThroughError() { |
| 1456 return compiler.findHelper(const SourceString("getFallThroughError")); | 1476 return compiler.findHelper(const SourceString("getFallThroughError")); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1470 * | 1490 * |
| 1471 * Invariant: [element] must be a declaration element. | 1491 * Invariant: [element] must be a declaration element. |
| 1472 */ | 1492 */ |
| 1473 void eagerRecompile(Element element) { | 1493 void eagerRecompile(Element element) { |
| 1474 assert(invariant(element, element.isDeclaration)); | 1494 assert(invariant(element, element.isDeclaration)); |
| 1475 generatedCode.remove(element); | 1495 generatedCode.remove(element); |
| 1476 generatedBailoutCode.remove(element); | 1496 generatedBailoutCode.remove(element); |
| 1477 compiler.enqueuer.codegen.addToWorkList(element); | 1497 compiler.enqueuer.codegen.addToWorkList(element); |
| 1478 } | 1498 } |
| 1479 } | 1499 } |
| OLD | NEW |