| 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 Map<String, dynamic> holes = { | 96 Map<String, dynamic> holes = { |
| 97 'needsClassSupport': emitter.needsClassSupport, | 97 'needsClassSupport': emitter.needsClassSupport, |
| 98 'libraries': librariesAccess, | 98 'libraries': librariesAccess, |
| 99 'mangledNames': mangledNamesAccess, | 99 'mangledNames': mangledNamesAccess, |
| 100 'mangledGlobalNames': mangledGlobalNamesAccess, | 100 'mangledGlobalNames': mangledGlobalNamesAccess, |
| 101 'statics': staticsAccess, | 101 'statics': staticsAccess, |
| 102 'staticsPropertyName': namer.staticsPropertyName, | 102 'staticsPropertyName': namer.staticsPropertyName, |
| 103 'staticsPropertyNameString': js.quoteName(namer.staticsPropertyName), | 103 'staticsPropertyNameString': js.quoteName(namer.staticsPropertyName), |
| 104 'typeInformation': typeInformationAccess, | 104 'typeInformation': typeInformationAccess, |
| 105 'globalFunctions': globalFunctionsAccess, | 105 'globalFunctions': globalFunctionsAccess, |
| 106 'enabledInvokeOn': backend.hasInvokeOnSupport, | 106 'enabledInvokeOn': backend.backendUsage.isInvokeOnUsed, |
| 107 'interceptedNames': interceptedNamesAccess, | 107 'interceptedNames': interceptedNamesAccess, |
| 108 'interceptedNamesSet': emitter.generateInterceptedNamesSet(), | 108 'interceptedNamesSet': emitter.generateInterceptedNamesSet(), |
| 109 'notInCspMode': !compiler.options.useContentSecurityPolicy, | 109 'notInCspMode': !compiler.options.useContentSecurityPolicy, |
| 110 'inCspMode': compiler.options.useContentSecurityPolicy, | 110 'inCspMode': compiler.options.useContentSecurityPolicy, |
| 111 'deferredAction': namer.deferredAction, | 111 'deferredAction': namer.deferredAction, |
| 112 'hasIsolateSupport': program.hasIsolateSupport, | 112 'hasIsolateSupport': program.hasIsolateSupport, |
| 113 'fieldNamesProperty': js.string(Emitter.FIELD_NAMES_PROPERTY_NAME), | 113 'fieldNamesProperty': js.string(Emitter.FIELD_NAMES_PROPERTY_NAME), |
| 114 'createNewIsolateFunction': createNewIsolateFunctionAccess, | 114 'createNewIsolateFunction': createNewIsolateFunctionAccess, |
| 115 'isolateName': namer.isolateName, | 115 'isolateName': namer.isolateName, |
| 116 'classIdExtractor': classIdExtractorAccess, | 116 'classIdExtractor': classIdExtractorAccess, |
| (...skipping 12 matching lines...) Expand all Loading... |
| 129 'isInterceptorClass': namer.operatorIs(backend.helpers.jsInterceptorClass), | 129 'isInterceptorClass': namer.operatorIs(backend.helpers.jsInterceptorClass), |
| 130 'isObject': namer.operatorIs(compiler.commonElements.objectClass), | 130 'isObject': namer.operatorIs(compiler.commonElements.objectClass), |
| 131 'specProperty': js.string(namer.nativeSpecProperty), | 131 'specProperty': js.string(namer.nativeSpecProperty), |
| 132 'trivialNsmHandlers': emitter.buildTrivialNsmHandlers(), | 132 'trivialNsmHandlers': emitter.buildTrivialNsmHandlers(), |
| 133 'hasRetainedMetadata': backend.mirrorsData.hasRetainedMetadata, | 133 'hasRetainedMetadata': backend.mirrorsData.hasRetainedMetadata, |
| 134 'types': typesAccess, | 134 'types': typesAccess, |
| 135 'objectClassName': js.quoteName( | 135 'objectClassName': js.quoteName( |
| 136 namer.runtimeTypeName(compiler.commonElements.objectClass as Entity)), | 136 namer.runtimeTypeName(compiler.commonElements.objectClass as Entity)), |
| 137 'needsStructuredMemberInfo': emitter.needsStructuredMemberInfo, | 137 'needsStructuredMemberInfo': emitter.needsStructuredMemberInfo, |
| 138 'usesMangledNames': compiler.commonElements.mirrorsLibrary != null || | 138 'usesMangledNames': compiler.commonElements.mirrorsLibrary != null || |
| 139 backend.hasFunctionApplySupport, | 139 backend.backendUsage.isFunctionApplyUsed, |
| 140 'tearOffCode': buildTearOffCode(backend), | 140 'tearOffCode': buildTearOffCode(backend), |
| 141 'nativeInfoHandler': nativeInfoHandler, | 141 'nativeInfoHandler': nativeInfoHandler, |
| 142 'operatorIsPrefix': js.string(namer.operatorIsPrefix), | 142 'operatorIsPrefix': js.string(namer.operatorIsPrefix), |
| 143 'deferredActionString': js.string(namer.deferredAction) | 143 'deferredActionString': js.string(namer.deferredAction) |
| 144 }; | 144 }; |
| 145 String skeleton = ''' | 145 String skeleton = ''' |
| 146 function $setupProgramName(programData, typesOffset) { | 146 function $setupProgramName(programData, typesOffset) { |
| 147 "use strict"; | 147 "use strict"; |
| 148 if (#needsClassSupport) { | 148 if (#needsClassSupport) { |
| 149 | 149 |
| (...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 841 (function() { | 841 (function() { |
| 842 var result = $array[$index]; | 842 var result = $array[$index]; |
| 843 if ($check) { | 843 if ($check) { |
| 844 throw new Error( | 844 throw new Error( |
| 845 name + ": expected value of type \'$type\' at index " + ($index) + | 845 name + ": expected value of type \'$type\' at index " + ($index) + |
| 846 " but got " + (typeof result)); | 846 " but got " + (typeof result)); |
| 847 } | 847 } |
| 848 return result; | 848 return result; |
| 849 })()'''; | 849 })()'''; |
| 850 } | 850 } |
| OLD | NEW |