| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 dart2js.js_emitter.full_emitter; | 5 part of dart2js.js_emitter.full_emitter; |
| 6 | 6 |
| 7 // TODO(ahe): Share these with js_helper.dart. | 7 // TODO(ahe): Share these with js_helper.dart. |
| 8 const FUNCTION_INDEX = 0; | 8 const FUNCTION_INDEX = 0; |
| 9 const NAME_INDEX = 1; | 9 const NAME_INDEX = 1; |
| 10 const CALL_NAME_INDEX = 2; | 10 const CALL_NAME_INDEX = 2; |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 'classFieldsExtractor': classFieldsExtractorAccess, | 120 'classFieldsExtractor': classFieldsExtractorAccess, |
| 121 'instanceFromClassId': instanceFromClassIdAccess, | 121 'instanceFromClassId': instanceFromClassIdAccess, |
| 122 'initializeEmptyInstance': initializeEmptyInstanceAccess, | 122 'initializeEmptyInstance': initializeEmptyInstanceAccess, |
| 123 'allClasses': allClassesAccess, | 123 'allClasses': allClassesAccess, |
| 124 'debugFastObjects': DEBUG_FAST_OBJECTS, | 124 'debugFastObjects': DEBUG_FAST_OBJECTS, |
| 125 'isTreeShakingDisabled': backend.isTreeShakingDisabled, | 125 'isTreeShakingDisabled': backend.isTreeShakingDisabled, |
| 126 'precompiled': precompiledAccess, | 126 'precompiled': precompiledAccess, |
| 127 'finishedClassesAccess': finishedClassesAccess, | 127 'finishedClassesAccess': finishedClassesAccess, |
| 128 'needsMixinSupport': emitter.needsMixinSupport, | 128 'needsMixinSupport': emitter.needsMixinSupport, |
| 129 'needsNativeSupport': program.needsNativeSupport, | 129 'needsNativeSupport': program.needsNativeSupport, |
| 130 'enabledJsInterop': backend.jsInteropAnalysis.enabledJsInterop, |
| 131 'jsInteropBoostrap':backend.jsInteropAnalysis.buildJsInteropBootstrap(), |
| 130 'isInterceptorClass': namer.operatorIs(backend.jsInterceptorClass), | 132 'isInterceptorClass': namer.operatorIs(backend.jsInterceptorClass), |
| 131 'isObject' : namer.operatorIs(compiler.objectClass), | 133 'isObject' : namer.operatorIs(compiler.objectClass), |
| 132 'specProperty': js.string(namer.nativeSpecProperty), | 134 'specProperty': js.string(namer.nativeSpecProperty), |
| 133 'trivialNsmHandlers': emitter.buildTrivialNsmHandlers(), | 135 'trivialNsmHandlers': emitter.buildTrivialNsmHandlers(), |
| 134 'hasRetainedMetadata': backend.hasRetainedMetadata, | 136 'hasRetainedMetadata': backend.hasRetainedMetadata, |
| 135 'types': typesAccess, | 137 'types': typesAccess, |
| 136 'objectClassName': js.quoteName( | 138 'objectClassName': js.quoteName( |
| 137 namer.runtimeTypeName(compiler.objectClass)), | 139 namer.runtimeTypeName(compiler.objectClass)), |
| 138 'needsStructuredMemberInfo': emitter.needsStructuredMemberInfo, | 140 'needsStructuredMemberInfo': emitter.needsStructuredMemberInfo, |
| 139 'usesMangledNames': | 141 'usesMangledNames': |
| 140 compiler.mirrorsLibrary != null || compiler.enabledFunctionApply, | 142 compiler.mirrorsLibrary != null || compiler.enabledFunctionApply, |
| 141 'tearOffCode': buildTearOffCode(backend), | 143 'tearOffCode': buildTearOffCode(backend), |
| 142 'nativeInfoHandler': nativeInfoHandler, | 144 'nativeInfoHandler': nativeInfoHandler, |
| 143 'operatorIsPrefix' : js.string(namer.operatorIsPrefix), | 145 'operatorIsPrefix' : js.string(namer.operatorIsPrefix), |
| 144 'deferredActionString': js.string(namer.deferredAction)}; | 146 'deferredActionString': js.string(namer.deferredAction)}; |
| 145 | |
| 146 String skeleton = ''' | 147 String skeleton = ''' |
| 147 function $setupProgramName(programData, typesOffset) { | 148 function $setupProgramName(programData, typesOffset) { |
| 148 "use strict"; | 149 "use strict"; |
| 149 if (#needsClassSupport) { | 150 if (#needsClassSupport) { |
| 150 | 151 |
| 151 function generateAccessor(fieldDescriptor, accessors, cls) { | 152 function generateAccessor(fieldDescriptor, accessors, cls) { |
| 152 var fieldInformation = fieldDescriptor.split("-"); | 153 var fieldInformation = fieldDescriptor.split("-"); |
| 153 var field = fieldInformation[0]; | 154 var field = fieldInformation[0]; |
| 154 var len = field.length; | 155 var len = field.length; |
| 155 var code = field.charCodeAt(len - 1); | 156 var code = field.charCodeAt(len - 1); |
| (...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 747 mangledNames[name] = reflectionName; | 748 mangledNames[name] = reflectionName; |
| 748 funcs[0].$reflectionNameField = reflectionName; | 749 funcs[0].$reflectionNameField = reflectionName; |
| 749 funcs[0].$metadataIndexField = unmangledNameIndex + 1; | 750 funcs[0].$metadataIndexField = unmangledNameIndex + 1; |
| 750 // The following line installs the [${JsGetName.CALL_CATCH_ALL}] | 751 // The following line installs the [${JsGetName.CALL_CATCH_ALL}] |
| 751 // property for closures. | 752 // property for closures. |
| 752 if (optionalParameterCount) prototype[unmangledName + "*"] = funcs[0]; | 753 if (optionalParameterCount) prototype[unmangledName + "*"] = funcs[0]; |
| 753 } | 754 } |
| 754 } | 755 } |
| 755 } | 756 } |
| 756 | 757 |
| 758 if (#enabledJsInterop) { |
| 759 #jsInteropBoostrap |
| 760 } |
| 757 #tearOffCode; | 761 #tearOffCode; |
| 758 } | 762 } |
| 759 | 763 |
| 760 if (#hasIncrementalSupport) { | 764 if (#hasIncrementalSupport) { |
| 761 #incrementalHelper.addStubs = addStubs; | 765 #incrementalHelper.addStubs = addStubs; |
| 762 } | 766 } |
| 763 | 767 |
| 764 var functionCounter = 0; | 768 var functionCounter = 0; |
| 765 if (!#libraries) #libraries = []; | 769 if (!#libraries) #libraries = []; |
| 766 if (!#mangledNames) #mangledNames = map(); | 770 if (!#mangledNames) #mangledNames = map(); |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 848 (function() { | 852 (function() { |
| 849 var result = $array[$index]; | 853 var result = $array[$index]; |
| 850 if ($check) { | 854 if ($check) { |
| 851 throw new Error( | 855 throw new Error( |
| 852 name + ": expected value of type \'$type\' at index " + ($index) + | 856 name + ": expected value of type \'$type\' at index " + ($index) + |
| 853 " but got " + (typeof result)); | 857 " but got " + (typeof result)); |
| 854 } | 858 } |
| 855 return result; | 859 return result; |
| 856 })()'''; | 860 })()'''; |
| 857 } | 861 } |
| OLD | NEW |