| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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; | 5 part of dart2js.js_emitter; |
| 6 | 6 |
| 7 | 7 |
| 8 class OldEmitter implements Emitter { | 8 class OldEmitter implements Emitter { |
| 9 final Compiler compiler; | 9 final Compiler compiler; |
| 10 final CodeEmitterTask task; | 10 final CodeEmitterTask task; |
| (...skipping 1685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1696 getReflectionDataParser(classesCollector, backend), | 1696 getReflectionDataParser(classesCollector, backend), |
| 1697 compiler)) | 1697 compiler)) |
| 1698 ..write(')') | 1698 ..write(')') |
| 1699 ..write('([$n') | 1699 ..write('([$n') |
| 1700 ..add(libraryBuffer) | 1700 ..add(libraryBuffer) |
| 1701 ..write('])$N'); | 1701 ..write('])$N'); |
| 1702 | 1702 |
| 1703 emitFinishClassesInvocationIfNecessary(mainBuffer); | 1703 emitFinishClassesInvocationIfNecessary(mainBuffer); |
| 1704 } | 1704 } |
| 1705 | 1705 |
| 1706 typeTestEmitter.emitRuntimeTypeSupport(mainBuffer, mainOutputUnit); |
| 1706 interceptorEmitter.emitGetInterceptorMethods(mainBuffer); | 1707 interceptorEmitter.emitGetInterceptorMethods(mainBuffer); |
| 1707 interceptorEmitter.emitOneShotInterceptors(mainBuffer); | 1708 interceptorEmitter.emitOneShotInterceptors(mainBuffer); |
| 1708 | 1709 |
| 1709 if (task.outputContainsConstantList) { | 1710 if (task.outputContainsConstantList) { |
| 1710 emitMakeConstantList(mainBuffer); | 1711 emitMakeConstantList(mainBuffer); |
| 1711 } | 1712 } |
| 1712 | 1713 |
| 1713 // Constants in checked mode call into RTI code to set type information | 1714 // Constants in checked mode call into RTI code to set type information |
| 1714 // which may need getInterceptor (and one-shot interceptor) methods, so | 1715 // which may need getInterceptor (and one-shot interceptor) methods, so |
| 1715 // we have to make sure that [emitGetInterceptorMethods] and | 1716 // we have to make sure that [emitGetInterceptorMethods] and |
| (...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2166 // Set the currentIsolate variable to the current isolate (which is | 2167 // Set the currentIsolate variable to the current isolate (which is |
| 2167 // provided as second argument). | 2168 // provided as second argument). |
| 2168 // We need to do this, because we use the same variable for setting up | 2169 // We need to do this, because we use the same variable for setting up |
| 2169 // the isolate-properties and for storing the current isolate. During | 2170 // the isolate-properties and for storing the current isolate. During |
| 2170 // the setup (the code above this lines) we must set the variable to | 2171 // the setup (the code above this lines) we must set the variable to |
| 2171 // the isolate-properties. | 2172 // the isolate-properties. |
| 2172 // After we have done the setup (finishing with `finishClasses`) it must | 2173 // After we have done the setup (finishing with `finishClasses`) it must |
| 2173 // point to the current Isolate. Otherwise all methods/functions | 2174 // point to the current Isolate. Otherwise all methods/functions |
| 2174 // accessing isolate variables will access the wrong object. | 2175 // accessing isolate variables will access the wrong object. |
| 2175 outputBuffer.write("${namer.currentIsolate}$_=${_}arguments[1]$N"); | 2176 outputBuffer.write("${namer.currentIsolate}$_=${_}arguments[1]$N"); |
| 2177 typeTestEmitter.emitRuntimeTypeSupport(outputBuffer, outputUnit); |
| 2176 | 2178 |
| 2177 emitCompileTimeConstants(outputBuffer, outputUnit); | 2179 emitCompileTimeConstants(outputBuffer, outputUnit); |
| 2178 emitStaticNonFinalFieldInitializations(outputBuffer, outputUnit); | 2180 emitStaticNonFinalFieldInitializations(outputBuffer, outputUnit); |
| 2179 outputBuffer.write('}$N'); | 2181 outputBuffer.write('}$N'); |
| 2180 | 2182 |
| 2181 if (compiler.useContentSecurityPolicy) { | 2183 if (compiler.useContentSecurityPolicy) { |
| 2182 jsAst.FunctionDeclaration precompiledFunctionAst = | 2184 jsAst.FunctionDeclaration precompiledFunctionAst = |
| 2183 buildCspPrecompiledFunctionFor(outputUnit); | 2185 buildCspPrecompiledFunctionFor(outputUnit); |
| 2184 | 2186 |
| 2185 outputBuffer.write( | 2187 outputBuffer.write( |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2261 for (Element element in compiler.enqueuer.codegen.newlyEnqueuedElements) { | 2263 for (Element element in compiler.enqueuer.codegen.newlyEnqueuedElements) { |
| 2262 if (element.isInstanceMember) { | 2264 if (element.isInstanceMember) { |
| 2263 cachedClassBuilders.remove(element.enclosingClass); | 2265 cachedClassBuilders.remove(element.enclosingClass); |
| 2264 | 2266 |
| 2265 nativeEmitter.cachedBuilders.remove(element.enclosingClass); | 2267 nativeEmitter.cachedBuilders.remove(element.enclosingClass); |
| 2266 | 2268 |
| 2267 } | 2269 } |
| 2268 } | 2270 } |
| 2269 } | 2271 } |
| 2270 } | 2272 } |
| OLD | NEW |