Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(525)

Side by Side Diff: lib/runtime/dart/_js_helper.js

Issue 1052383003: Disable closure wrapping by default (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 var _js_helper; 1 var _js_helper;
2 (function(exports) { 2 (function(exports) {
3 'use strict'; 3 'use strict';
4 class NoSideEffects extends core.Object { 4 class NoSideEffects extends core.Object {
5 NoSideEffects() { 5 NoSideEffects() {
6 } 6 }
7 } 7 }
8 class NoThrows extends core.Object { 8 class NoThrows extends core.Object {
9 NoThrows() { 9 NoThrows() {
10 } 10 }
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 let keys = this[_keys]; 95 let keys = this[_keys];
96 for (let i = 0; i['<'](dart.dload(keys, 'length')); i = dart.notNull(i) + 1) { 96 for (let i = 0; i['<'](dart.dload(keys, 'length')); i = dart.notNull(i) + 1) {
97 let key = dart.dindex(keys, i); 97 let key = dart.dindex(keys, i);
98 f(dart.as(key, K), dart.as(this[_fetch](key), V)); 98 f(dart.as(key, K), dart.as(this[_fetch](key), V));
99 } 99 }
100 } 100 }
101 get keys() { 101 get keys() {
102 return new (_ConstantMapKeyIterable$(K))(this); 102 return new (_ConstantMapKeyIterable$(K))(this);
103 } 103 }
104 get values() { 104 get values() {
105 return new (_internal.MappedIterable$(K, V))(this[_keys], dart.closureWr ap(((key) => this[_fetch](key)).bind(this), "(K) → V")); 105 return new (_internal.MappedIterable$(K, V))(this[_keys], dart.as(((key) => this[_fetch](key)).bind(this), dart.throw_("Unimplemented type (K) → V")));
106 } 106 }
107 } 107 }
108 ConstantStringMap[dart.implements] = () => [_internal.EfficientLength]; 108 ConstantStringMap[dart.implements] = () => [_internal.EfficientLength];
109 dart.defineNamedConstructor(ConstantStringMap, _$); 109 dart.defineNamedConstructor(ConstantStringMap, _$);
110 return ConstantStringMap; 110 return ConstantStringMap;
111 }); 111 });
112 let ConstantStringMap = ConstantStringMap$(); 112 let ConstantStringMap = ConstantStringMap$();
113 let _protoValue = Symbol('_protoValue'); 113 let _protoValue = Symbol('_protoValue');
114 let ConstantProtoMap$ = dart.generic(function(K, V) { 114 let ConstantProtoMap$ = dart.generic(function(K, V) {
115 class ConstantProtoMap extends ConstantStringMap$(K, V) { 115 class ConstantProtoMap extends ConstantStringMap$(K, V) {
(...skipping 1610 matching lines...) Expand 10 before | Expand all | Expand 10 after
1726 hash = Math.random() * 0x3fffffff | 0; 1726 hash = Math.random() * 0x3fffffff | 0;
1727 object.$identityHash = hash; 1727 object.$identityHash = hash;
1728 } 1728 }
1729 return hash; 1729 return hash;
1730 } 1730 }
1731 static [_throwFormatException](string) { 1731 static [_throwFormatException](string) {
1732 throw new core.FormatException(string); 1732 throw new core.FormatException(string);
1733 } 1733 }
1734 static parseInt(source, radix, handleError) { 1734 static parseInt(source, radix, handleError) {
1735 if (handleError == null) 1735 if (handleError == null)
1736 handleError = dart.closureWrap(Primitives[_throwFormatException], "(Stri ng) → int"); 1736 handleError = dart.as(Primitives[_throwFormatException], dart.throw_("Un implemented type (String) → int"));
1737 checkString(source); 1737 checkString(source);
1738 let match = /^\s*[+-]?((0x[a-f0-9]+)|(\d+)|([a-z0-9]+))\s*$/i.exec(source) ; 1738 let match = /^\s*[+-]?((0x[a-f0-9]+)|(\d+)|([a-z0-9]+))\s*$/i.exec(source) ;
1739 let digitsIndex = 1; 1739 let digitsIndex = 1;
1740 let hexIndex = 2; 1740 let hexIndex = 2;
1741 let decimalIndex = 3; 1741 let decimalIndex = 3;
1742 let nonDecimalHexIndex = 4; 1742 let nonDecimalHexIndex = 4;
1743 if (radix == null) { 1743 if (radix == null) {
1744 radix = 10; 1744 radix = 10;
1745 if (match != null) { 1745 if (match != null) {
1746 if (dart.dindex(match, hexIndex) != null) { 1746 if (dart.dindex(match, hexIndex) != null) {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
1778 } 1778 }
1779 } 1779 }
1780 } 1780 }
1781 if (match == null) 1781 if (match == null)
1782 return handleError(source); 1782 return handleError(source);
1783 return parseInt(source, radix); 1783 return parseInt(source, radix);
1784 } 1784 }
1785 static parseDouble(source, handleError) { 1785 static parseDouble(source, handleError) {
1786 checkString(source); 1786 checkString(source);
1787 if (handleError == null) 1787 if (handleError == null)
1788 handleError = dart.closureWrap(Primitives[_throwFormatException], "(Stri ng) → double"); 1788 handleError = dart.as(Primitives[_throwFormatException], dart.throw_("Un implemented type (String) → double"));
1789 if (!/^\s*[+-]?(?:Infinity|NaN|(?:\.\d+|\d+(?:\.\d*)?)(?:[eE][+-]?\d+)?)\s *$/.test(source)) { 1789 if (!/^\s*[+-]?(?:Infinity|NaN|(?:\.\d+|\d+(?:\.\d*)?)(?:[eE][+-]?\d+)?)\s *$/.test(source)) {
1790 return handleError(source); 1790 return handleError(source);
1791 } 1791 }
1792 let result = parseFloat(source); 1792 let result = parseFloat(source);
1793 if (result.isNaN) { 1793 if (result.isNaN) {
1794 let trimmed = source.trim(); 1794 let trimmed = source.trim();
1795 if (dart.notNull(trimmed == 'NaN') || dart.notNull(trimmed == '+NaN') || dart.notNull(trimmed == '-NaN')) { 1795 if (dart.notNull(trimmed == 'NaN') || dart.notNull(trimmed == '+NaN') || dart.notNull(trimmed == '-NaN')) {
1796 return result; 1796 return result;
1797 } 1797 }
1798 return handleError(source); 1798 return handleError(source);
(...skipping 1864 matching lines...) Expand 10 before | Expand all | Expand 10 after
3663 class DeferredLoadCallback extends core.Function {} 3663 class DeferredLoadCallback extends core.Function {}
3664 exports.deferredLoadHook = null; 3664 exports.deferredLoadHook = null;
3665 // Function loadDeferredLibrary: (String) → Future<Null> 3665 // Function loadDeferredLibrary: (String) → Future<Null>
3666 function loadDeferredLibrary(loadId) { 3666 function loadDeferredLibrary(loadId) {
3667 let urisMap = _foreign_helper.JS_EMBEDDED_GLOBAL('', _js_embedded_names.DEFE RRED_LIBRARY_URIS); 3667 let urisMap = _foreign_helper.JS_EMBEDDED_GLOBAL('', _js_embedded_names.DEFE RRED_LIBRARY_URIS);
3668 let uris = dart.as(urisMap[loadId], core.List$(core.String)); 3668 let uris = dart.as(urisMap[loadId], core.List$(core.String));
3669 let hashesMap = _foreign_helper.JS_EMBEDDED_GLOBAL('', _js_embedded_names.DE FERRED_LIBRARY_HASHES); 3669 let hashesMap = _foreign_helper.JS_EMBEDDED_GLOBAL('', _js_embedded_names.DE FERRED_LIBRARY_HASHES);
3670 let hashes = dart.as(hashesMap[loadId], core.List$(core.String)); 3670 let hashes = dart.as(hashesMap[loadId], core.List$(core.String));
3671 if (uris == null) 3671 if (uris == null)
3672 return dart.as(new async.Future.value(null), async.Future$(core.Null)); 3672 return dart.as(new async.Future.value(null), async.Future$(core.Null));
3673 let indices = new core.List.generate(uris.length, dart.closureWrap((i) => i, "(int) → dynamic")); 3673 let indices = new core.List.generate(uris.length, dart.as((i) => i, dart.thr ow_("Unimplemented type (int) → dynamic")));
3674 let isHunkLoaded = _foreign_helper.JS_EMBEDDED_GLOBAL('', _js_embedded_names .IS_HUNK_LOADED); 3674 let isHunkLoaded = _foreign_helper.JS_EMBEDDED_GLOBAL('', _js_embedded_names .IS_HUNK_LOADED);
3675 let isHunkInitialized = _foreign_helper.JS_EMBEDDED_GLOBAL('', _js_embedded_ names.IS_HUNK_INITIALIZED); 3675 let isHunkInitialized = _foreign_helper.JS_EMBEDDED_GLOBAL('', _js_embedded_ names.IS_HUNK_INITIALIZED);
3676 let indicesToLoad = indices.where((i) => !isHunkLoaded(hashes.get(i))).toLis t(); 3676 let indicesToLoad = indices.where((i) => !isHunkLoaded(hashes.get(i))).toLis t();
3677 return dart.as(async.Future.wait(dart.as(indicesToLoad.map((i) => _loadHunk( uris.get(i))), core.Iterable$(async.Future))).then(dart.closureWrap((_) => { 3677 return dart.as(async.Future.wait(dart.as(indicesToLoad.map((i) => _loadHunk( uris.get(i))), core.Iterable$(async.Future))).then(dart.as((_) => {
3678 let indicesToInitialize = indices.where((i) => !isHunkInitialized(hashes.g et(i))).toList(); 3678 let indicesToInitialize = indices.where((i) => !isHunkInitialized(hashes.g et(i))).toList();
3679 for (let i of indicesToInitialize) { 3679 for (let i of indicesToInitialize) {
3680 let initializer = _foreign_helper.JS_EMBEDDED_GLOBAL('', _js_embedded_na mes.INITIALIZE_LOADED_HUNK); 3680 let initializer = _foreign_helper.JS_EMBEDDED_GLOBAL('', _js_embedded_na mes.INITIALIZE_LOADED_HUNK);
3681 initializer(hashes.get(i)); 3681 initializer(hashes.get(i));
3682 } 3682 }
3683 let updated = exports._loadedLibraries.add(loadId); 3683 let updated = exports._loadedLibraries.add(loadId);
3684 if (dart.notNull(updated) && dart.notNull(exports.deferredLoadHook != null )) { 3684 if (dart.notNull(updated) && dart.notNull(exports.deferredLoadHook != null )) {
3685 exports.deferredLoadHook(); 3685 exports.deferredLoadHook();
3686 } 3686 }
3687 }, "(List<dynamic>) → dynamic")), async.Future$(core.Null)); 3687 }, dart.throw_("Unimplemented type (List<dynamic>) → dynamic"))), async.Futu re$(core.Null));
3688 } 3688 }
3689 // Function _loadHunk: (String) → Future<Null> 3689 // Function _loadHunk: (String) → Future<Null>
3690 function _loadHunk(hunkName) { 3690 function _loadHunk(hunkName) {
3691 let future = exports._loadingLibraries.get(hunkName); 3691 let future = exports._loadingLibraries.get(hunkName);
3692 if (future != null) { 3692 if (future != null) {
3693 return dart.as(future.then(dart.closureWrap((_) => null, "(Null) → dynamic ")), async.Future$(core.Null)); 3693 return dart.as(future.then(dart.as((_) => null, dart.throw_("Unimplemented type (Null) → dynamic"))), async.Future$(core.Null));
3694 } 3694 }
3695 let uri = _isolate_helper.IsolateNatives.thisScript; 3695 let uri = _isolate_helper.IsolateNatives.thisScript;
3696 let index = uri.lastIndexOf('/'); 3696 let index = uri.lastIndexOf('/');
3697 uri = `${uri.substring(0, dart.notNull(index) + 1)}${hunkName}`; 3697 uri = `${uri.substring(0, dart.notNull(index) + 1)}${hunkName}`;
3698 if (dart.notNull(Primitives.isJsshell) || dart.notNull(Primitives.isD8)) { 3698 if (dart.notNull(Primitives.isJsshell) || dart.notNull(Primitives.isD8)) {
3699 return exports._loadingLibraries.set(hunkName, new (async.Future$(core.Nul l))(() => { 3699 return exports._loadingLibraries.set(hunkName, new (async.Future$(core.Nul l))(() => {
3700 try { 3700 try {
3701 new Function(`load("${uri}")`)(); 3701 new Function(`load("${uri}")`)();
3702 } catch (error) { 3702 } catch (error) {
3703 let stackTrace = dart.stackTrace(error); 3703 let stackTrace = dart.stackTrace(error);
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
4003 exports.jsonEncodeNative = jsonEncodeNative; 4003 exports.jsonEncodeNative = jsonEncodeNative;
4004 exports.getIsolateAffinityTag = getIsolateAffinityTag; 4004 exports.getIsolateAffinityTag = getIsolateAffinityTag;
4005 exports.LoadLibraryFunctionType = LoadLibraryFunctionType; 4005 exports.LoadLibraryFunctionType = LoadLibraryFunctionType;
4006 exports.DeferredLoadCallback = DeferredLoadCallback; 4006 exports.DeferredLoadCallback = DeferredLoadCallback;
4007 exports.loadDeferredLibrary = loadDeferredLibrary; 4007 exports.loadDeferredLibrary = loadDeferredLibrary;
4008 exports.MainError = MainError; 4008 exports.MainError = MainError;
4009 exports.missingMain = missingMain; 4009 exports.missingMain = missingMain;
4010 exports.badMain = badMain; 4010 exports.badMain = badMain;
4011 exports.mainHasTooManyParameters = mainHasTooManyParameters; 4011 exports.mainHasTooManyParameters = mainHasTooManyParameters;
4012 })(_js_helper || (_js_helper = {})); 4012 })(_js_helper || (_js_helper = {}));
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698