| 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 jsAst.Expression instanceFromClassIdAccess = emitter | 65 jsAst.Expression instanceFromClassIdAccess = emitter |
| 66 .generateEmbeddedGlobalAccess(embeddedNames.INSTANCE_FROM_CLASS_ID); | 66 .generateEmbeddedGlobalAccess(embeddedNames.INSTANCE_FROM_CLASS_ID); |
| 67 | 67 |
| 68 String reflectableField = namer.reflectableField; | 68 String reflectableField = namer.reflectableField; |
| 69 String reflectionInfoField = namer.reflectionInfoField; | 69 String reflectionInfoField = namer.reflectionInfoField; |
| 70 String reflectionNameField = namer.reflectionNameField; | 70 String reflectionNameField = namer.reflectionNameField; |
| 71 String metadataIndexField = namer.metadataIndexField; | 71 String metadataIndexField = namer.metadataIndexField; |
| 72 String defaultValuesField = namer.defaultValuesField; | 72 String defaultValuesField = namer.defaultValuesField; |
| 73 String methodsWithOptionalArgumentsField = | 73 String methodsWithOptionalArgumentsField = |
| 74 namer.methodsWithOptionalArgumentsField; | 74 namer.methodsWithOptionalArgumentsField; |
| 75 String unmangledNameIndex = backend.mustRetainMetadata | 75 String unmangledNameIndex = backend.mirrorsData.mustRetainMetadata |
| 76 ? ' 3 * optionalParameterCount + 2 * requiredParameterCount + 3' | 76 ? ' 3 * optionalParameterCount + 2 * requiredParameterCount + 3' |
| 77 : ' 2 * optionalParameterCount + requiredParameterCount + 3'; | 77 : ' 2 * optionalParameterCount + requiredParameterCount + 3'; |
| 78 String receiverParamName = | 78 String receiverParamName = |
| 79 compiler.options.enableMinification ? "r" : "receiver"; | 79 compiler.options.enableMinification ? "r" : "receiver"; |
| 80 String valueParamName = compiler.options.enableMinification ? "v" : "value"; | 80 String valueParamName = compiler.options.enableMinification ? "v" : "value"; |
| 81 String space = compiler.options.enableMinification ? "" : " "; | 81 String space = compiler.options.enableMinification ? "" : " "; |
| 82 String _ = space; | 82 String _ = space; |
| 83 | 83 |
| 84 String specProperty = '"${namer.nativeSpecProperty}"'; // "%" | 84 String specProperty = '"${namer.nativeSpecProperty}"'; // "%" |
| 85 jsAst.Expression nativeInfoAccess = js('prototype[$specProperty]', []); | 85 jsAst.Expression nativeInfoAccess = js('prototype[$specProperty]', []); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 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, |
| 117 'classFieldsExtractor': classFieldsExtractorAccess, | 117 'classFieldsExtractor': classFieldsExtractorAccess, |
| 118 'instanceFromClassId': instanceFromClassIdAccess, | 118 'instanceFromClassId': instanceFromClassIdAccess, |
| 119 'initializeEmptyInstance': initializeEmptyInstanceAccess, | 119 'initializeEmptyInstance': initializeEmptyInstanceAccess, |
| 120 'allClasses': allClassesAccess, | 120 'allClasses': allClassesAccess, |
| 121 'debugFastObjects': DEBUG_FAST_OBJECTS, | 121 'debugFastObjects': DEBUG_FAST_OBJECTS, |
| 122 'isTreeShakingDisabled': backend.isTreeShakingDisabled, | 122 'isTreeShakingDisabled': backend.mirrorsData.isTreeShakingDisabled, |
| 123 'precompiled': precompiledAccess, | 123 'precompiled': precompiledAccess, |
| 124 'finishedClassesAccess': finishedClassesAccess, | 124 'finishedClassesAccess': finishedClassesAccess, |
| 125 'needsMixinSupport': emitter.needsMixinSupport, | 125 'needsMixinSupport': emitter.needsMixinSupport, |
| 126 'needsNativeSupport': program.needsNativeSupport, | 126 'needsNativeSupport': program.needsNativeSupport, |
| 127 'enabledJsInterop': backend.jsInteropAnalysis.enabledJsInterop, | 127 'enabledJsInterop': backend.jsInteropAnalysis.enabledJsInterop, |
| 128 'jsInteropBoostrap': backend.jsInteropAnalysis.buildJsInteropBootstrap(), | 128 'jsInteropBoostrap': backend.jsInteropAnalysis.buildJsInteropBootstrap(), |
| 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.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.hasFunctionApplySupport, |
| 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) |
| (...skipping 697 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 |