Chromium Code Reviews| 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 class JavaScriptItemCompilationContext extends ItemCompilationContext { | 7 class JavaScriptItemCompilationContext extends ItemCompilationContext { |
| 8 final Set<HInstruction> boundsChecked; | 8 final Set<HInstruction> boundsChecked; |
| 9 | 9 |
| 10 JavaScriptItemCompilationContext() | 10 JavaScriptItemCompilationContext() |
| (...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 470 Set<ClassElement> classes = getInterceptedClassesOn(selector.name); | 470 Set<ClassElement> classes = getInterceptedClassesOn(selector.name); |
| 471 String name = namer.getOneShotInterceptorName(selector, classes); | 471 String name = namer.getOneShotInterceptorName(selector, classes); |
| 472 if (!oneShotInterceptors.containsKey(name)) { | 472 if (!oneShotInterceptors.containsKey(name)) { |
| 473 registerSpecializedGetInterceptor(classes); | 473 registerSpecializedGetInterceptor(classes); |
| 474 oneShotInterceptors[name] = selector; | 474 oneShotInterceptors[name] = selector; |
| 475 } | 475 } |
| 476 return name; | 476 return name; |
| 477 } | 477 } |
| 478 | 478 |
| 479 bool isInterceptedMethod(Element element) { | 479 bool isInterceptedMethod(Element element) { |
| 480 return element.isInstanceMember() | 480 if (!element.isInstanceMember()) return false; |
| 481 && !element.isGenerativeConstructorBody() | 481 if (element.isGenerativeConstructorBody()) { |
| 482 && interceptedElements[element.name] != null; | 482 return Elements.isNativeOrExtendsNative(element.getEnclosingClass()); |
| 483 } | |
| 484 return interceptedElements[element.name] != null; | |
| 483 } | 485 } |
| 484 | 486 |
| 485 bool fieldHasInterceptedGetter(Element element) { | 487 bool fieldHasInterceptedGetter(Element element) { |
| 486 assert(element.isField()); | 488 assert(element.isField()); |
| 487 return interceptedElements[element.name] != null; | 489 return interceptedElements[element.name] != null; |
| 488 } | 490 } |
| 489 | 491 |
| 490 bool fieldHasInterceptedSetter(Element element) { | 492 bool fieldHasInterceptedSetter(Element element) { |
| 491 assert(element.isField()); | 493 assert(element.isField()); |
| 492 return interceptedElements[element.name] != null; | 494 return interceptedElements[element.name] != null; |
| (...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 945 Enqueuer enqueuer, | 947 Enqueuer enqueuer, |
| 946 TreeElements elements) { | 948 TreeElements elements) { |
| 947 enqueuer.registerInstantiatedClass(typeImplementation, elements); | 949 enqueuer.registerInstantiatedClass(typeImplementation, elements); |
| 948 enqueueInResolution(getCreateRuntimeType(), elements); | 950 enqueueInResolution(getCreateRuntimeType(), elements); |
| 949 // TODO(ahe): Might want to register [element] as an instantiated class | 951 // TODO(ahe): Might want to register [element] as an instantiated class |
| 950 // when reflection is used. However, as long as we disable tree-shaking | 952 // when reflection is used. However, as long as we disable tree-shaking |
| 951 // eagerly it doesn't matter. | 953 // eagerly it doesn't matter. |
| 952 if (element.isTypedef()) { | 954 if (element.isTypedef()) { |
| 953 typedefTypeLiterals.add(element); | 955 typedefTypeLiterals.add(element); |
| 954 } | 956 } |
| 957 if (element.isClass()) { | |
| 958 // TODO(sra): Can we register via a type parameter? | |
| 959 registerEscapingConstructorsOfClass(element, enqueuer); | |
| 960 } | |
| 961 } | |
| 962 | |
| 963 void registerEscapingConstructorsOfClass(ClassElement classElement, | |
| 964 Enqueuer enqueuer) { | |
| 965 // Web component classes have constructors that are escaped to the host | |
|
ngeoffray
2013/10/17 09:08:59
Please define 'escape' here.
sra1
2013/10/18 04:09:32
This code has been replaced.
| |
| 966 // environment. | |
| 967 // TODO(13835): Defer registering generative constructors until the helper | |
| 968 // functions that fetch the constructors is seen. These functions are | |
| 969 // called by document.register. | |
| 970 classElement.ensureResolved(compiler); | |
| 971 if (Elements.isNativeOrExtendsNative(classElement)) { | |
| 972 registerGenerativeConstructors(ClassElement enclosing, Element member) { | |
| 973 if (member.isGenerativeConstructor()) { | |
| 974 enqueuer.registerStaticUse(member); | |
| 975 } | |
| 976 } | |
| 977 classElement.forEachMember(registerGenerativeConstructors, | |
| 978 includeBackendMembers: false, | |
| 979 includeSuperAndInjectedMembers: false); | |
| 980 } | |
| 955 } | 981 } |
| 956 | 982 |
| 957 void registerStackTraceInCatch(TreeElements elements) { | 983 void registerStackTraceInCatch(TreeElements elements) { |
| 958 enqueueInResolution(getTraceFromException(), elements); | 984 enqueueInResolution(getTraceFromException(), elements); |
| 959 } | 985 } |
| 960 | 986 |
| 961 void registerSetRuntimeType(TreeElements elements) { | 987 void registerSetRuntimeType(TreeElements elements) { |
| 962 enqueueInResolution(getSetRuntimeTypeInfo(), elements); | 988 enqueueInResolution(getSetRuntimeTypeInfo(), elements); |
| 963 } | 989 } |
| 964 | 990 |
| (...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1858 copy(constant.values); | 1884 copy(constant.values); |
| 1859 copy(constant.protoValue); | 1885 copy(constant.protoValue); |
| 1860 copy(constant); | 1886 copy(constant); |
| 1861 } | 1887 } |
| 1862 | 1888 |
| 1863 void visitConstructed(ConstructedConstant constant) { | 1889 void visitConstructed(ConstructedConstant constant) { |
| 1864 copy(constant.fields); | 1890 copy(constant.fields); |
| 1865 copy(constant); | 1891 copy(constant); |
| 1866 } | 1892 } |
| 1867 } | 1893 } |
| OLD | NEW |