Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(303)

Side by Side Diff: pkg/dart2js_incremental/lib/library_updater.dart

Issue 1226733010: dart2js: Remove oldEmitter field in emitter-task. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 library dart2js_incremental.library_updater; 5 library dart2js_incremental.library_updater;
6 6
7 import 'dart:async' show 7 import 'dart:async' show
8 Future; 8 Future;
9 9
10 import 'dart:convert' show 10 import 'dart:convert' show
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 import 'package:compiler/src/js/js.dart' show 56 import 'package:compiler/src/js/js.dart' show
57 js; 57 js;
58 58
59 import 'package:compiler/src/js/js.dart' as jsAst; 59 import 'package:compiler/src/js/js.dart' as jsAst;
60 60
61 import 'package:compiler/src/js_emitter/js_emitter.dart' show 61 import 'package:compiler/src/js_emitter/js_emitter.dart' show
62 ClassBuilder, 62 ClassBuilder,
63 ClassEmitter, 63 ClassEmitter,
64 CodeEmitterTask, 64 CodeEmitterTask,
65 ContainerBuilder, 65 ContainerBuilder,
66 OldEmitter,
66 MemberInfo, 67 MemberInfo,
67 computeMixinClass; 68 computeMixinClass;
68 69
69 import 'package:compiler/src/js_emitter/model.dart' show 70 import 'package:compiler/src/js_emitter/model.dart' show
70 Class, 71 Class,
71 Method; 72 Method;
72 73
73 import 'package:compiler/src/js_emitter/program_builder/program_builder.dart' 74 import 'package:compiler/src/js_emitter/program_builder/program_builder.dart'
74 show ProgramBuilder; 75 show ProgramBuilder;
75 76
(...skipping 814 matching lines...) Expand 10 before | Expand all | Expand 10 after
890 compiler.backend.constants.compiledConstants); 891 compiler.backend.constants.compiledConstants);
891 newConstants.removeAll(_compiledConstants); 892 newConstants.removeAll(_compiledConstants);
892 893
893 if (!newConstants.isEmpty) { 894 if (!newConstants.isEmpty) {
894 _ensureAllNeededEntitiesComputed(); 895 _ensureAllNeededEntitiesComputed();
895 List<ConstantValue> constants = 896 List<ConstantValue> constants =
896 emitter.outputConstantLists[compiler.deferredLoadTask.mainOutputUnit]; 897 emitter.outputConstantLists[compiler.deferredLoadTask.mainOutputUnit];
897 if (constants != null) { 898 if (constants != null) {
898 for (ConstantValue constant in constants) { 899 for (ConstantValue constant in constants) {
899 if (!_compiledConstants.contains(constant)) { 900 if (!_compiledConstants.contains(constant)) {
901 OldEmitter fullEmitter = emitter.emitter;
900 jsAst.Statement constantInitializer = 902 jsAst.Statement constantInitializer =
901 emitter.oldEmitter.buildConstantInitializer(constant) 903 fullEmitter.buildConstantInitializer(constant).toStatement();
902 .toStatement();
903 updates.add(constantInitializer); 904 updates.add(constantInitializer);
904 } 905 }
905 } 906 }
906 } 907 }
907 } 908 }
908 909
909 updates.add(js.statement(r''' 910 updates.add(js.statement(r'''
910 if (this.pendingStubs) { 911 if (this.pendingStubs) {
911 this.pendingStubs.map(function(e) { return e(); }); 912 this.pendingStubs.map(function(e) { return e(); });
912 this.pendingStubs = void 0; 913 this.pendingStubs = void 0;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
969 } 970 }
970 971
971 List<jsAst.Statement> computeFieldUpdateJs(FieldElementX element) { 972 List<jsAst.Statement> computeFieldUpdateJs(FieldElementX element) {
972 if (element.isInstanceMember) { 973 if (element.isInstanceMember) {
973 // Any initializers are inlined in factory methods, and the field is 974 // Any initializers are inlined in factory methods, and the field is
974 // declared by adding its class to [_classesWithSchemaChanges]. 975 // declared by adding its class to [_classesWithSchemaChanges].
975 return const <jsAst.Statement>[]; 976 return const <jsAst.Statement>[];
976 } 977 }
977 // A static (or top-level) field. 978 // A static (or top-level) field.
978 if (backend.constants.lazyStatics.contains(element)) { 979 if (backend.constants.lazyStatics.contains(element)) {
980 OldEmitter fullEmitter = emitter.emitter;
979 jsAst.Expression init = 981 jsAst.Expression init =
980 emitter.oldEmitter.buildLazilyInitializedStaticField( 982 fullEmitter.buildLazilyInitializedStaticField(
981 element, isolateProperties: namer.currentIsolate); 983 element, isolateProperties: namer.currentIsolate);
982 if (init == null) { 984 if (init == null) {
983 throw new StateError("Initializer optimized away for $element"); 985 throw new StateError("Initializer optimized away for $element");
984 } 986 }
985 return <jsAst.Statement>[init.toStatement()]; 987 return <jsAst.Statement>[init.toStatement()];
986 } else { 988 } else {
987 // TODO(ahe): When a field is referenced it is enqueued. If the field has 989 // TODO(ahe): When a field is referenced it is enqueued. If the field has
988 // no initializer, it will not have any associated code, so it will 990 // no initializer, it will not have any associated code, so it will
989 // appear as if it was newly enqueued. 991 // appear as if it was newly enqueued.
990 if (element.initializer == null) { 992 if (element.initializer == null) {
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
1463 1465
1464 abstract class JsFeatures { 1466 abstract class JsFeatures {
1465 Compiler get compiler; 1467 Compiler get compiler;
1466 1468
1467 JavaScriptBackend get backend => compiler.backend; 1469 JavaScriptBackend get backend => compiler.backend;
1468 1470
1469 Namer get namer => backend.namer; 1471 Namer get namer => backend.namer;
1470 1472
1471 CodeEmitterTask get emitter => backend.emitter; 1473 CodeEmitterTask get emitter => backend.emitter;
1472 1474
1473 ContainerBuilder get containerBuilder => emitter.oldEmitter.containerBuilder; 1475 ContainerBuilder get containerBuilder {
1476 OldEmitter fullEmitter = emitter.emitter;
1477 return fullEmitter.containerBuilder;
1478 }
1474 1479
1475 EnqueueTask get enqueuer => compiler.enqueuer; 1480 EnqueueTask get enqueuer => compiler.enqueuer;
1476 } 1481 }
1477 1482
1478 class EmitterHelper extends JsFeatures { 1483 class EmitterHelper extends JsFeatures {
1479 final Compiler compiler; 1484 final Compiler compiler;
1480 1485
1481 EmitterHelper(this.compiler); 1486 EmitterHelper(this.compiler);
1482 1487
1483 ClassEmitter get classEmitter => backend.emitter.oldEmitter.classEmitter; 1488 ClassEmitter get classEmitter {
1489 OldEmitter fullEmitter = emitter.emitter;
1490 return fullEmitter.classEmitter;
1491 }
1484 1492
1485 List<String> computeFields(ClassElement classElement) { 1493 List<String> computeFields(ClassElement classElement) {
1486 Class cls = new ProgramBuilder(compiler, namer, emitter) 1494 Class cls = new ProgramBuilder(compiler, namer, emitter)
1487 .buildFieldsHackForIncrementalCompilation(classElement); 1495 .buildFieldsHackForIncrementalCompilation(classElement);
1488 // TODO(ahe): Rewrite for new emitter. 1496 // TODO(ahe): Rewrite for new emitter.
1489 ClassBuilder builder = new ClassBuilder(classElement, namer); 1497 ClassBuilder builder = new ClassBuilder(classElement, namer);
1490 classEmitter.emitFields(cls, builder); 1498 classEmitter.emitFields(cls, builder);
1491 return builder.fields; 1499 return builder.fields;
1492 } 1500 }
1493 } 1501 }
1494 1502
1495 // TODO(ahe): Remove this method. 1503 // TODO(ahe): Remove this method.
1496 NO_WARN(x) => x; 1504 NO_WARN(x) => x;
OLDNEW
« no previous file with comments | « pkg/dart2js_incremental/lib/dart2js_incremental.dart ('k') | tests/compiler/dart2js/mirrors_used_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698