OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 /// This library defines runtime operations on objects used by the code | 5 /// This library defines runtime operations on objects used by the code |
6 /// generator. | 6 /// generator. |
7 part of dart._runtime; | 7 part of dart._runtime; |
8 | 8 |
9 class InvocationImpl extends Invocation { | 9 class InvocationImpl extends Invocation { |
10 final Symbol memberName; | 10 final Symbol memberName; |
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
699 /// The global constant list table. | 699 /// The global constant list table. |
700 /// This maps the number of elements in the list (n) | 700 /// This maps the number of elements in the list (n) |
701 /// to a path of length n of maps indexed by the value | 701 /// to a path of length n of maps indexed by the value |
702 /// of the field. The final map is indexed by the element | 702 /// of the field. The final map is indexed by the element |
703 /// type and contains the canonical version of the list. | 703 /// type and contains the canonical version of the list. |
704 final constantLists = JS('', 'new Map()'); | 704 final constantLists = JS('', 'new Map()'); |
705 | 705 |
706 /// | 706 /// |
707 /// Canonicalize a constant list | 707 /// Canonicalize a constant list |
708 /// | 708 /// |
709 @JSExportName('constList') | 709 constList(elements, elementType) => JS( |
710 constList_(elements, elementType) => JS( | |
711 '', | 710 '', |
712 '''(() => { | 711 '''(() => { |
713 function lookupNonTerminal(map, key) { | 712 function lookupNonTerminal(map, key) { |
714 let result = map.get(key); | 713 let result = map.get(key); |
715 if (result !== void 0) return result; | 714 if (result !== void 0) return result; |
716 map.set(key, result = new Map()); | 715 map.set(key, result = new Map()); |
717 return result; | 716 return result; |
718 }; | 717 }; |
719 let count = $elements.length; | 718 let count = $elements.length; |
720 let map = lookupNonTerminal($constantLists, count); | 719 let map = lookupNonTerminal($constantLists, count); |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
846 name = '+' + name; | 845 name = '+' + name; |
847 } | 846 } |
848 return name; | 847 return name; |
849 } | 848 } |
850 | 849 |
851 /// Emulates the implicit "loadLibrary" function provided by a deferred library. | 850 /// Emulates the implicit "loadLibrary" function provided by a deferred library. |
852 /// | 851 /// |
853 /// Libraries are not actually deferred in DDC, so this just returns a future | 852 /// Libraries are not actually deferred in DDC, so this just returns a future |
854 /// that completes immediately. | 853 /// that completes immediately. |
855 Future loadLibrary() => new Future.value(); | 854 Future loadLibrary() => new Future.value(); |
OLD | NEW |