| 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 1014 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1025 output.addBuffer(jsAst.prettyPrint(invokeMain, | 1025 output.addBuffer(jsAst.prettyPrint(invokeMain, |
| 1026 compiler, monitor: compiler.dumpInfoTask)); | 1026 compiler, monitor: compiler.dumpInfoTask)); |
| 1027 output.add(N); | 1027 output.add(N); |
| 1028 addComment('END invoke [main].', output); | 1028 addComment('END invoke [main].', output); |
| 1029 } | 1029 } |
| 1030 | 1030 |
| 1031 void emitInitFunction(CodeOutput output) { | 1031 void emitInitFunction(CodeOutput output) { |
| 1032 String isolate = namer.currentIsolate; | 1032 String isolate = namer.currentIsolate; |
| 1033 jsAst.Expression allClassesAccess = | 1033 jsAst.Expression allClassesAccess = |
| 1034 generateEmbeddedGlobalAccess(embeddedNames.ALL_CLASSES); | 1034 generateEmbeddedGlobalAccess(embeddedNames.ALL_CLASSES); |
| 1035 jsAst.Expression getTypeFromNameAccess = |
| 1036 generateEmbeddedGlobalAccess(embeddedNames.GET_TYPE_FROM_NAME); |
| 1035 jsAst.Expression interceptorsByTagAccess = | 1037 jsAst.Expression interceptorsByTagAccess = |
| 1036 generateEmbeddedGlobalAccess(embeddedNames.INTERCEPTORS_BY_TAG); | 1038 generateEmbeddedGlobalAccess(embeddedNames.INTERCEPTORS_BY_TAG); |
| 1037 jsAst.Expression leafTagsAccess = | 1039 jsAst.Expression leafTagsAccess = |
| 1038 generateEmbeddedGlobalAccess(embeddedNames.LEAF_TAGS); | 1040 generateEmbeddedGlobalAccess(embeddedNames.LEAF_TAGS); |
| 1039 jsAst.Expression finishedClassesAccess = | 1041 jsAst.Expression finishedClassesAccess = |
| 1040 generateEmbeddedGlobalAccess(embeddedNames.FINISHED_CLASSES); | 1042 generateEmbeddedGlobalAccess(embeddedNames.FINISHED_CLASSES); |
| 1041 jsAst.Expression cyclicThrow = | 1043 jsAst.Expression cyclicThrow = |
| 1042 staticFunctionAccess(backend.getCyclicThrowHelper()); | 1044 staticFunctionAccess(backend.getCyclicThrowHelper()); |
| 1043 jsAst.Expression laziesAccess = | 1045 jsAst.Expression laziesAccess = |
| 1044 generateEmbeddedGlobalAccess(embeddedNames.LAZIES); | 1046 generateEmbeddedGlobalAccess(embeddedNames.LAZIES); |
| 1045 | 1047 |
| 1046 jsAst.FunctionDeclaration decl = js.statement(''' | 1048 jsAst.FunctionDeclaration decl = js.statement(''' |
| 1047 function init() { | 1049 function init() { |
| 1048 $isolateProperties = Object.create(null); | 1050 $isolateProperties = Object.create(null); |
| 1049 #allClasses = Object.create(null); | 1051 #allClasses = Object.create(null); |
| 1052 #getTypeFromName = function(name) {return #allClasses[name];}; |
| 1050 #interceptorsByTag = Object.create(null); | 1053 #interceptorsByTag = Object.create(null); |
| 1051 #leafTags = Object.create(null); | 1054 #leafTags = Object.create(null); |
| 1052 #finishedClasses = Object.create(null); | 1055 #finishedClasses = Object.create(null); |
| 1053 | 1056 |
| 1054 if (#needsLazyInitializer) { | 1057 if (#needsLazyInitializer) { |
| 1055 $lazyInitializerName = function (prototype, staticName, fieldName, | 1058 $lazyInitializerName = function (prototype, staticName, fieldName, |
| 1056 getterName, lazyValue) { | 1059 getterName, lazyValue) { |
| 1057 if (!#lazies) #lazies = Object.create(null); | 1060 if (!#lazies) #lazies = Object.create(null); |
| 1058 #lazies[fieldName] = getterName; | 1061 #lazies[fieldName] = getterName; |
| 1059 | 1062 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1132 Isolate.#makeConstListProperty = oldIsolate.#makeConstListProperty; | 1135 Isolate.#makeConstListProperty = oldIsolate.#makeConstListProperty; |
| 1133 } | 1136 } |
| 1134 if (#hasIncrementalSupport) { | 1137 if (#hasIncrementalSupport) { |
| 1135 Isolate.#lazyInitializerProperty = | 1138 Isolate.#lazyInitializerProperty = |
| 1136 oldIsolate.#lazyInitializerProperty; | 1139 oldIsolate.#lazyInitializerProperty; |
| 1137 } | 1140 } |
| 1138 return Isolate; | 1141 return Isolate; |
| 1139 } | 1142 } |
| 1140 | 1143 |
| 1141 }''', {'allClasses': allClassesAccess, | 1144 }''', {'allClasses': allClassesAccess, |
| 1145 'getTypeFromName': getTypeFromNameAccess, |
| 1142 'interceptorsByTag': interceptorsByTagAccess, | 1146 'interceptorsByTag': interceptorsByTagAccess, |
| 1143 'leafTags': leafTagsAccess, | 1147 'leafTags': leafTagsAccess, |
| 1144 'finishedClasses': finishedClassesAccess, | 1148 'finishedClasses': finishedClassesAccess, |
| 1145 'needsLazyInitializer': needsLazyInitializer, | 1149 'needsLazyInitializer': needsLazyInitializer, |
| 1146 'lazies': laziesAccess, 'cyclicThrow': cyclicThrow, | 1150 'lazies': laziesAccess, 'cyclicThrow': cyclicThrow, |
| 1147 'isolatePropertiesName': namer.isolatePropertiesName, | 1151 'isolatePropertiesName': namer.isolatePropertiesName, |
| 1148 'outputContainsConstantList': task.outputContainsConstantList, | 1152 'outputContainsConstantList': task.outputContainsConstantList, |
| 1149 'makeConstListProperty': makeConstListProperty, | 1153 'makeConstListProperty': makeConstListProperty, |
| 1150 'hasIncrementalSupport': compiler.hasIncrementalSupport, | 1154 'hasIncrementalSupport': compiler.hasIncrementalSupport, |
| 1151 'lazyInitializerProperty': lazyInitializerProperty,}); | 1155 'lazyInitializerProperty': lazyInitializerProperty,}); |
| (...skipping 948 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2100 for (Element element in compiler.enqueuer.codegen.newlyEnqueuedElements) { | 2104 for (Element element in compiler.enqueuer.codegen.newlyEnqueuedElements) { |
| 2101 if (element.isInstanceMember) { | 2105 if (element.isInstanceMember) { |
| 2102 cachedClassBuilders.remove(element.enclosingClass); | 2106 cachedClassBuilders.remove(element.enclosingClass); |
| 2103 | 2107 |
| 2104 nativeEmitter.cachedBuilders.remove(element.enclosingClass); | 2108 nativeEmitter.cachedBuilders.remove(element.enclosingClass); |
| 2105 | 2109 |
| 2106 } | 2110 } |
| 2107 } | 2111 } |
| 2108 } | 2112 } |
| 2109 } | 2113 } |
| OLD | NEW |