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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 ClassElement jsStringClass; | 172 ClassElement jsStringClass; |
173 ClassElement jsArrayClass; | 173 ClassElement jsArrayClass; |
174 ClassElement jsNumberClass; | 174 ClassElement jsNumberClass; |
175 ClassElement jsIntClass; | 175 ClassElement jsIntClass; |
176 ClassElement jsDoubleClass; | 176 ClassElement jsDoubleClass; |
177 ClassElement jsNullClass; | 177 ClassElement jsNullClass; |
178 ClassElement jsBoolClass; | 178 ClassElement jsBoolClass; |
179 ClassElement jsPlainJavaScriptObjectClass; | 179 ClassElement jsPlainJavaScriptObjectClass; |
180 ClassElement jsUnknownJavaScriptObjectClass; | 180 ClassElement jsUnknownJavaScriptObjectClass; |
181 | 181 |
| 182 /// Class element for JsRuntimeType in interceptors.dart. |
| 183 ClassElement jsRuntimeType; |
| 184 |
| 185 /// Class element for JsFunctionType in interceptors.dart. |
| 186 ClassElement jsFunctionType; |
| 187 |
182 ClassElement jsIndexableClass; | 188 ClassElement jsIndexableClass; |
183 ClassElement jsMutableIndexableClass; | 189 ClassElement jsMutableIndexableClass; |
184 | 190 |
185 ClassElement jsMutableArrayClass; | 191 ClassElement jsMutableArrayClass; |
186 ClassElement jsFixedArrayClass; | 192 ClassElement jsFixedArrayClass; |
187 ClassElement jsExtendableArrayClass; | 193 ClassElement jsExtendableArrayClass; |
188 | 194 |
189 Element jsIndexableLength; | 195 Element jsIndexableLength; |
190 Element jsArrayRemoveLast; | 196 Element jsArrayRemoveLast; |
191 Element jsArrayAdd; | 197 Element jsArrayAdd; |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
506 compiler.findInterceptor(const SourceString('JSMutableArray')), | 512 compiler.findInterceptor(const SourceString('JSMutableArray')), |
507 jsFixedArrayClass = | 513 jsFixedArrayClass = |
508 compiler.findInterceptor(const SourceString('JSFixedArray')), | 514 compiler.findInterceptor(const SourceString('JSFixedArray')), |
509 jsExtendableArrayClass = | 515 jsExtendableArrayClass = |
510 compiler.findInterceptor(const SourceString('JSExtendableArray')), | 516 compiler.findInterceptor(const SourceString('JSExtendableArray')), |
511 jsPlainJavaScriptObjectClass = | 517 jsPlainJavaScriptObjectClass = |
512 compiler.findInterceptor(const SourceString('PlainJavaScriptObject')), | 518 compiler.findInterceptor(const SourceString('PlainJavaScriptObject')), |
513 jsUnknownJavaScriptObjectClass = | 519 jsUnknownJavaScriptObjectClass = |
514 compiler.findInterceptor( | 520 compiler.findInterceptor( |
515 const SourceString('UnknownJavaScriptObject')), | 521 const SourceString('UnknownJavaScriptObject')), |
| 522 jsRuntimeType = |
| 523 compiler.findInterceptor(const SourceString('JsRuntimeType')), |
| 524 jsFunctionType = |
| 525 compiler.findInterceptor(const SourceString('JsFunctionType')), |
516 ]; | 526 ]; |
517 | 527 |
518 jsIndexableClass = | 528 jsIndexableClass = |
519 compiler.findInterceptor(const SourceString('JSIndexable')); | 529 compiler.findInterceptor(const SourceString('JSIndexable')); |
520 jsMutableIndexableClass = | 530 jsMutableIndexableClass = |
521 compiler.findInterceptor(const SourceString('JSMutableIndexable')); | 531 compiler.findInterceptor(const SourceString('JSMutableIndexable')); |
522 | 532 |
523 // TODO(kasperl): Some tests do not define the special JSArray | 533 // TODO(kasperl): Some tests do not define the special JSArray |
524 // subclasses, so we check to see if they are defined before | 534 // subclasses, so we check to see if they are defined before |
525 // trying to resolve them. | 535 // trying to resolve them. |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
662 seenAnyClass = true; | 672 seenAnyClass = true; |
663 if (enqueuer.isResolutionQueue) { | 673 if (enqueuer.isResolutionQueue) { |
664 // TODO(9577): Make it so that these are not needed when there are no | 674 // TODO(9577): Make it so that these are not needed when there are no |
665 // native classes. | 675 // native classes. |
666 enqueue(enqueuer, getNativeInterceptorMethod, elements); | 676 enqueue(enqueuer, getNativeInterceptorMethod, elements); |
667 enqueue(enqueuer, defineNativeMethodsFinishMethod, elements); | 677 enqueue(enqueuer, defineNativeMethodsFinishMethod, elements); |
668 enqueueClass(enqueuer, jsInterceptorClass, compiler.globalDependencies); | 678 enqueueClass(enqueuer, jsInterceptorClass, compiler.globalDependencies); |
669 } | 679 } |
670 } | 680 } |
671 | 681 |
| 682 // TODO(ahe): Find a better way to enable these interceptors. |
| 683 addInterceptors(jsRuntimeType, enqueuer, elements); |
| 684 addInterceptors(jsFunctionType, enqueuer, elements); |
| 685 |
672 // Register any helper that will be needed by the backend. | 686 // Register any helper that will be needed by the backend. |
673 if (enqueuer.isResolutionQueue) { | 687 if (enqueuer.isResolutionQueue) { |
674 if (cls == compiler.intClass | 688 if (cls == compiler.intClass |
675 || cls == compiler.doubleClass | 689 || cls == compiler.doubleClass |
676 || cls == compiler.numClass) { | 690 || cls == compiler.numClass) { |
677 // The backend will try to optimize number operations and use the | 691 // The backend will try to optimize number operations and use the |
678 // `iae` helper directly. | 692 // `iae` helper directly. |
679 enqueue(enqueuer, | 693 enqueue(enqueuer, |
680 compiler.findHelper(const SourceString('iae')), | 694 compiler.findHelper(const SourceString('iae')), |
681 elements); | 695 elements); |
(...skipping 1014 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1696 copy(constant.values); | 1710 copy(constant.values); |
1697 copy(constant.protoValue); | 1711 copy(constant.protoValue); |
1698 copy(constant); | 1712 copy(constant); |
1699 } | 1713 } |
1700 | 1714 |
1701 void visitConstructed(ConstructedConstant constant) { | 1715 void visitConstructed(ConstructedConstant constant) { |
1702 copy(constant.fields); | 1716 copy(constant.fields); |
1703 copy(constant); | 1717 copy(constant); |
1704 } | 1718 } |
1705 } | 1719 } |
OLD | NEW |