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

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

Issue 1071393007: fuse List and js Array together and a few other misc fixes. (Closed) Base URL: git@github.com:dart-lang/dart-dev-compiler.git@master
Patch Set: ptal 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
« no previous file with comments | « no previous file | lib/runtime/dart/collection.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 866 matching lines...) Expand 10 before | Expand all | Expand 10 after
877 let _typeName = Symbol('_typeName'); 877 let _typeName = Symbol('_typeName');
878 let _unmangledName = Symbol('_unmangledName'); 878 let _unmangledName = Symbol('_unmangledName');
879 class TypeImpl extends core.Object { 879 class TypeImpl extends core.Object {
880 TypeImpl(typeName) { 880 TypeImpl(typeName) {
881 this[_typeName] = typeName; 881 this[_typeName] = typeName;
882 this[_unmangledName] = null; 882 this[_unmangledName] = null;
883 } 883 }
884 toString() { 884 toString() {
885 if (this[_unmangledName] != null) 885 if (this[_unmangledName] != null)
886 return this[_unmangledName]; 886 return this[_unmangledName];
887 let unmangledName = _js_names.unmangleAllIdentifiersIfPreservedAnyways(thi s[_typeName]); 887 let unmangledName = unmangleAllIdentifiersIfPreservedAnyways(this[_typeNam e]);
888 return this[_unmangledName] = unmangledName; 888 return this[_unmangledName] = unmangledName;
889 } 889 }
890 get hashCode() { 890 get hashCode() {
891 return this[_typeName].hashCode; 891 return this[_typeName].hashCode;
892 } 892 }
893 ['=='](other) { 893 ['=='](other) {
894 return dart.is(other, TypeImpl) && dart.equals(this[_typeName], dart.dload (other, _typeName)); 894 return dart.is(other, TypeImpl) && dart.equals(this[_typeName], dart.dload (other, _typeName));
895 } 895 }
896 } 896 }
897 TypeImpl[dart.implements] = () => [core.Type]; 897 TypeImpl[dart.implements] = () => [core.Type];
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
1327 return typeof o == 'object'; 1327 return typeof o == 'object';
1328 } 1328 }
1329 // Function isIdentical: (dynamic, dynamic) → bool 1329 // Function isIdentical: (dynamic, dynamic) → bool
1330 function isIdentical(s, t) { 1330 function isIdentical(s, t) {
1331 return s === t; 1331 return s === t;
1332 } 1332 }
1333 // Function isNotIdentical: (dynamic, dynamic) → bool 1333 // Function isNotIdentical: (dynamic, dynamic) → bool
1334 function isNotIdentical(s, t) { 1334 function isNotIdentical(s, t) {
1335 return s !== t; 1335 return s !== t;
1336 } 1336 }
1337 // Function unmangleGlobalNameIfPreservedAnyways: (String) → String
1338 function unmangleGlobalNameIfPreservedAnyways(str) {
1339 return str;
1340 }
1341 // Function unmangleAllIdentifiersIfPreservedAnyways: (String) → String
1342 function unmangleAllIdentifiersIfPreservedAnyways(str) {
1343 return str;
1344 }
1337 class _Patch extends core.Object { 1345 class _Patch extends core.Object {
1338 _Patch() { 1346 _Patch() {
1339 } 1347 }
1340 } 1348 }
1341 let patch = new _Patch(); 1349 let patch = new _Patch();
1342 class InternalMap extends core.Object {} 1350 class InternalMap extends core.Object {}
1343 // Function requiresPreamble: () → dynamic 1351 // Function requiresPreamble: () → dynamic
1344 function requiresPreamble() { 1352 function requiresPreamble() {
1345 } 1353 }
1346 // Function isJsIndexable: (dynamic, dynamic) → bool 1354 // Function isJsIndexable: (dynamic, dynamic) → bool
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
1800 if (result.isNaN) { 1808 if (result.isNaN) {
1801 let trimmed = source.trim(); 1809 let trimmed = source.trim();
1802 if (trimmed == 'NaN' || trimmed == '+NaN' || trimmed == '-NaN') { 1810 if (trimmed == 'NaN' || trimmed == '+NaN' || trimmed == '-NaN') {
1803 return result; 1811 return result;
1804 } 1812 }
1805 return handleError(source); 1813 return handleError(source);
1806 } 1814 }
1807 return result; 1815 return result;
1808 } 1816 }
1809 static formatType(className, typeArguments) { 1817 static formatType(className, typeArguments) {
1810 return _js_names.unmangleAllIdentifiersIfPreservedAnyways(`${className}${j oinArguments(typeArguments, 0)}`); 1818 return unmangleAllIdentifiersIfPreservedAnyways(`${className}${joinArgumen ts(typeArguments, 0)}`);
1811 } 1819 }
1812 static objectTypeName(object) { 1820 static objectTypeName(object) {
1813 let name = constructorNameFallback(_interceptors.getInterceptor(object)); 1821 let name = Primitives.constructorNameFallback(object);
1814 if (name == 'Object') { 1822 if (name == 'Object') {
1815 let decompiled = String(object.constructor).match(/^\s*function\s*(\S*)\ s*\(/)[1]; 1823 let decompiled = String(object.constructor).match(/^\s*function\s*(\S*)\ s*\(/)[1];
1816 if (typeof decompiled == 'string') 1824 if (typeof decompiled == 'string')
1817 if (/^\w+$/.test(decompiled)) 1825 if (/^\w+$/.test(decompiled))
1818 name = dart.as(decompiled, core.String); 1826 name = dart.as(decompiled, core.String);
1819 } 1827 }
1820 if (dart.notNull(name.length) > 1 && dart.notNull(core.identical(name.code UnitAt(0), Primitives.DOLLAR_CHAR_VALUE))) {
1821 name = name.substring(1);
1822 }
1823 return Primitives.formatType(name, dart.as(getRuntimeTypeInfo(object), cor e.List)); 1828 return Primitives.formatType(name, dart.as(getRuntimeTypeInfo(object), cor e.List));
1824 } 1829 }
1825 static objectToString(object) { 1830 static objectToString(object) {
1826 let name = Primitives.objectTypeName(object); 1831 let name = Primitives.objectTypeName(object);
1827 return `Instance of '${name}'`; 1832 return `Instance of '${name}'`;
1828 } 1833 }
1829 static dateNow() { 1834 static dateNow() {
1830 return Date.now(); 1835 return Date.now();
1831 } 1836 }
1832 static initTicker() { 1837 static initTicker() {
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
2116 } 2121 }
2117 static extractStackTrace(error) { 2122 static extractStackTrace(error) {
2118 return getTraceFromException(error.$thrownJsError); 2123 return getTraceFromException(error.$thrownJsError);
2119 } 2124 }
2120 } 2125 }
2121 Primitives.mirrorFunctionCacheName = '$cachedFunction'; 2126 Primitives.mirrorFunctionCacheName = '$cachedFunction';
2122 Primitives.mirrorInvokeCacheName = '$cachedInvocation'; 2127 Primitives.mirrorInvokeCacheName = '$cachedInvocation';
2123 Primitives.DOLLAR_CHAR_VALUE = 36; 2128 Primitives.DOLLAR_CHAR_VALUE = 36;
2124 Primitives.timerFrequency = null; 2129 Primitives.timerFrequency = null;
2125 Primitives.timerTicks = null; 2130 Primitives.timerTicks = null;
2131 dart.defineLazyProperties(Primitives, {
2132 get constructorNameFallback() {
2133 return function getTagFallback(o) {
2134 var constructor = o.constructor;
2135 if (typeof constructor == "function") {
2136 var name = constructor.name;
2137 if (typeof name == "string" && name.length > 2 && name !== "Object" && name !== "Function.prototype") {
2138 return name;
2139 }
2140 }
2141 var s = Object.prototype.toString.call(o);
2142 return s.substring(8, s.length - 1);
2143 };
2144 },
2145 set constructorNameFallback(_) {}
2146 });
2126 class JsCache extends core.Object { 2147 class JsCache extends core.Object {
2127 static allocate() { 2148 static allocate() {
2128 let result = Object.create(null); 2149 let result = Object.create(null);
2129 result.x = 0; 2150 result.x = 0;
2130 delete result.x; 2151 delete result.x;
2131 return result; 2152 return result;
2132 } 2153 }
2133 static fetch(cache, key) { 2154 static fetch(cache, key) {
2134 return cache[key]; 2155 return cache[key];
2135 } 2156 }
(...skipping 1789 matching lines...) Expand 10 before | Expand all | Expand 10 after
3925 exports.getField = getField; 3946 exports.getField = getField;
3926 exports.getIndex = getIndex; 3947 exports.getIndex = getIndex;
3927 exports.getLength = getLength; 3948 exports.getLength = getLength;
3928 exports.isJsArray = isJsArray; 3949 exports.isJsArray = isJsArray;
3929 exports.hasField = hasField; 3950 exports.hasField = hasField;
3930 exports.hasNoField = hasNoField; 3951 exports.hasNoField = hasNoField;
3931 exports.isJsFunction = isJsFunction; 3952 exports.isJsFunction = isJsFunction;
3932 exports.isJsObject = isJsObject; 3953 exports.isJsObject = isJsObject;
3933 exports.isIdentical = isIdentical; 3954 exports.isIdentical = isIdentical;
3934 exports.isNotIdentical = isNotIdentical; 3955 exports.isNotIdentical = isNotIdentical;
3956 exports.unmangleGlobalNameIfPreservedAnyways = unmangleGlobalNameIfPreservedAn yways;
3957 exports.unmangleAllIdentifiersIfPreservedAnyways = unmangleAllIdentifiersIfPre servedAnyways;
3935 exports.patch = patch; 3958 exports.patch = patch;
3936 exports.InternalMap = InternalMap; 3959 exports.InternalMap = InternalMap;
3937 exports.requiresPreamble = requiresPreamble; 3960 exports.requiresPreamble = requiresPreamble;
3938 exports.isJsIndexable = isJsIndexable; 3961 exports.isJsIndexable = isJsIndexable;
3939 exports.S = S; 3962 exports.S = S;
3940 exports.createInvocationMirror = createInvocationMirror; 3963 exports.createInvocationMirror = createInvocationMirror;
3941 exports.createUnmangledInvocationMirror = createUnmangledInvocationMirror; 3964 exports.createUnmangledInvocationMirror = createUnmangledInvocationMirror;
3942 exports.throwInvalidReflectionError = throwInvalidReflectionError; 3965 exports.throwInvalidReflectionError = throwInvalidReflectionError;
3943 exports.traceHelper = traceHelper; 3966 exports.traceHelper = traceHelper;
3944 exports.JSInvocationMirror = JSInvocationMirror; 3967 exports.JSInvocationMirror = JSInvocationMirror;
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
4044 exports.jsonEncodeNative = jsonEncodeNative; 4067 exports.jsonEncodeNative = jsonEncodeNative;
4045 exports.getIsolateAffinityTag = getIsolateAffinityTag; 4068 exports.getIsolateAffinityTag = getIsolateAffinityTag;
4046 exports.LoadLibraryFunctionType = LoadLibraryFunctionType; 4069 exports.LoadLibraryFunctionType = LoadLibraryFunctionType;
4047 exports.DeferredLoadCallback = DeferredLoadCallback; 4070 exports.DeferredLoadCallback = DeferredLoadCallback;
4048 exports.loadDeferredLibrary = loadDeferredLibrary; 4071 exports.loadDeferredLibrary = loadDeferredLibrary;
4049 exports.MainError = MainError; 4072 exports.MainError = MainError;
4050 exports.missingMain = missingMain; 4073 exports.missingMain = missingMain;
4051 exports.badMain = badMain; 4074 exports.badMain = badMain;
4052 exports.mainHasTooManyParameters = mainHasTooManyParameters; 4075 exports.mainHasTooManyParameters = mainHasTooManyParameters;
4053 })(_js_helper || (_js_helper = {})); 4076 })(_js_helper || (_js_helper = {}));
OLDNEW
« no previous file with comments | « no previous file | lib/runtime/dart/collection.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698