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