| 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 const VERBOSE_OPTIMIZER_HINTS = false; | 7 const VERBOSE_OPTIMIZER_HINTS = false; |
| 8 | 8 |
| 9 const bool USE_CPS_IR = const bool.fromEnvironment("USE_CPS_IR"); | 9 const bool USE_CPS_IR = const bool.fromEnvironment("USE_CPS_IR"); |
| 10 | 10 |
| (...skipping 824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 835 enqueue(enqueuer, getNativeInterceptorMethod, registry); | 835 enqueue(enqueuer, getNativeInterceptorMethod, registry); |
| 836 enqueueClass(enqueuer, jsInterceptorClass, compiler.globalDependencies); | 836 enqueueClass(enqueuer, jsInterceptorClass, compiler.globalDependencies); |
| 837 enqueueClass(enqueuer, jsPlainJavaScriptObjectClass, registry); | 837 enqueueClass(enqueuer, jsPlainJavaScriptObjectClass, registry); |
| 838 } else if (cls == mapLiteralClass) { | 838 } else if (cls == mapLiteralClass) { |
| 839 // For map literals, the dependency between the implementation class | 839 // For map literals, the dependency between the implementation class |
| 840 // and [Map] is not visible, so we have to add it manually. | 840 // and [Map] is not visible, so we have to add it manually. |
| 841 Element getFactory(String name, int arity) { | 841 Element getFactory(String name, int arity) { |
| 842 // The constructor is on the patch class, but dart2js unit tests don't | 842 // The constructor is on the patch class, but dart2js unit tests don't |
| 843 // have a patch class. | 843 // have a patch class. |
| 844 ClassElement implementation = cls.patch != null ? cls.patch : cls; | 844 ClassElement implementation = cls.patch != null ? cls.patch : cls; |
| 845 return implementation.lookupConstructor( | 845 ConstructorElement ctor = implementation.lookupConstructor(name); |
| 846 new Selector.callConstructor( | 846 if (ctor == null |
| 847 name, mapLiteralClass.library, arity), | 847 || (isPrivateName(name) |
| 848 (element) { | 848 && ctor.library != mapLiteralClass.library)) { |
| 849 compiler.internalError(mapLiteralClass, | 849 compiler.internalError(mapLiteralClass, |
| 850 "Map literal class $mapLiteralClass missing " | 850 "Map literal class $mapLiteralClass missing " |
| 851 "'$name' constructor" | 851 "'$name' constructor" |
| 852 " ${mapLiteralClass.constructors}"); | 852 " ${mapLiteralClass.constructors}"); |
| 853 }); | 853 } |
| 854 return ctor; |
| 854 } | 855 } |
| 855 mapLiteralConstructor = getFactory('_literal', 1); | 856 mapLiteralConstructor = getFactory('_literal', 1); |
| 856 mapLiteralConstructorEmpty = getFactory('_empty', 0); | 857 mapLiteralConstructorEmpty = getFactory('_empty', 0); |
| 857 enqueueInResolution(mapLiteralConstructor, registry); | 858 enqueueInResolution(mapLiteralConstructor, registry); |
| 858 enqueueInResolution(mapLiteralConstructorEmpty, registry); | 859 enqueueInResolution(mapLiteralConstructorEmpty, registry); |
| 859 } | 860 } |
| 860 } | 861 } |
| 861 if (cls == closureClass) { | 862 if (cls == closureClass) { |
| 862 enqueue(enqueuer, findHelper('closureFromTearOff'), registry); | 863 enqueue(enqueuer, findHelper('closureFromTearOff'), registry); |
| 863 } | 864 } |
| (...skipping 1661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2525 } | 2526 } |
| 2526 } | 2527 } |
| 2527 | 2528 |
| 2528 /// Records that [constant] is used by the element behind [registry]. | 2529 /// Records that [constant] is used by the element behind [registry]. |
| 2529 class Dependency { | 2530 class Dependency { |
| 2530 final ConstantValue constant; | 2531 final ConstantValue constant; |
| 2531 final Element annotatedElement; | 2532 final Element annotatedElement; |
| 2532 | 2533 |
| 2533 const Dependency(this.constant, this.annotatedElement); | 2534 const Dependency(this.constant, this.annotatedElement); |
| 2534 } | 2535 } |
| OLD | NEW |