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

Side by Side Diff: pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart

Issue 1913033002: dart2js: Pass type information to constructor rather than add later. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: rebase Created 4 years, 4 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.js_emitter.program_builder; 5 library dart2js.js_emitter.program_builder;
6 6
7 import '../../closure.dart' show ClosureFieldElement; 7 import '../../closure.dart' show ClosureFieldElement;
8 import '../../common.dart'; 8 import '../../common.dart';
9 import '../../common/names.dart' show Names, Selectors; 9 import '../../common/names.dart' show Names, Selectors;
10 import '../../compiler.dart' show Compiler; 10 import '../../compiler.dart' show Compiler;
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 /// Returns a class that contains the fields of a class. 492 /// Returns a class that contains the fields of a class.
493 Class buildFieldsHackForIncrementalCompilation(ClassElement element) { 493 Class buildFieldsHackForIncrementalCompilation(ClassElement element) {
494 assert(_compiler.options.hasIncrementalSupport); 494 assert(_compiler.options.hasIncrementalSupport);
495 495
496 List<Field> instanceFields = _buildFields(element, false); 496 List<Field> instanceFields = _buildFields(element, false);
497 js.Name name = namer.className(element); 497 js.Name name = namer.className(element);
498 498
499 return new Class( 499 return new Class(
500 element, name, null, [], instanceFields, [], [], [], [], [], [], null, 500 element, name, null, [], instanceFields, [], [], [], [], [], [], null,
501 isDirectlyInstantiated: true, 501 isDirectlyInstantiated: true,
502 hasRti: true, // TODO(sra): fix this.
Siggi Cherem (dart-lang) 2016/08/19 16:39:46 explain what needs to be fixed?
502 onlyForRti: false, 503 onlyForRti: false,
503 isNative: backend.isNative(element)); 504 isNative: backend.isNative(element));
504 } 505 }
505 506
506 Class _buildClass(ClassElement element) { 507 Class _buildClass(ClassElement element) {
507 bool onlyForRti = collector.classesOnlyNeededForRti.contains(element); 508 bool onlyForRti = collector.classesOnlyNeededForRti.contains(element);
509 bool hasRti = backend.classNeedsRti(element);
508 if (backend.isJsInterop(element)) { 510 if (backend.isJsInterop(element)) {
509 // TODO(jacobr): check whether the class has any active static fields 511 // TODO(jacobr): check whether the class has any active static fields
510 // if it does not we can suppress it completely. 512 // if it does not we can suppress it completely.
511 onlyForRti = true; 513 onlyForRti = true;
512 } 514 }
513 515
514 List<Method> methods = []; 516 List<Method> methods = [];
515 List<StubMethod> callStubs = <StubMethod>[]; 517 List<StubMethod> callStubs = <StubMethod>[];
516 518
517 ClassStubGenerator classStubGenerator = 519 ClassStubGenerator classStubGenerator =
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 name, 630 name,
629 holder, 631 holder,
630 instanceFields, 632 instanceFields,
631 staticFieldsForReflection, 633 staticFieldsForReflection,
632 callStubs, 634 callStubs,
633 typeVariableReaderStubs, 635 typeVariableReaderStubs,
634 checkedSetters, 636 checkedSetters,
635 isChecks, 637 isChecks,
636 typeTests.functionTypeIndex, 638 typeTests.functionTypeIndex,
637 isDirectlyInstantiated: isInstantiated, 639 isDirectlyInstantiated: isInstantiated,
640 hasRti: hasRti,
638 onlyForRti: onlyForRti); 641 onlyForRti: onlyForRti);
639 } else { 642 } else {
640 result = new Class( 643 result = new Class(
641 element, 644 element,
642 name, 645 name,
643 holder, 646 holder,
644 methods, 647 methods,
645 instanceFields, 648 instanceFields,
646 staticFieldsForReflection, 649 staticFieldsForReflection,
647 callStubs, 650 callStubs,
648 typeVariableReaderStubs, 651 typeVariableReaderStubs,
649 noSuchMethodStubs, 652 noSuchMethodStubs,
650 checkedSetters, 653 checkedSetters,
651 isChecks, 654 isChecks,
652 typeTests.functionTypeIndex, 655 typeTests.functionTypeIndex,
653 isDirectlyInstantiated: isInstantiated, 656 isDirectlyInstantiated: isInstantiated,
657 hasRti: hasRti,
654 onlyForRti: onlyForRti, 658 onlyForRti: onlyForRti,
655 isNative: backend.isNative(element)); 659 isNative: backend.isNative(element));
656 } 660 }
657 _classes[element] = result; 661 _classes[element] = result;
658 return result; 662 return result;
659 } 663 }
660 664
661 bool _methodNeedsStubs(FunctionElement method) { 665 bool _methodNeedsStubs(FunctionElement method) {
662 return !method.functionSignature.optionalParameters.isEmpty; 666 return !method.functionSignature.optionalParameters.isEmpty;
663 } 667 }
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
975 Constant constant = new Constant(name, holder, constantValue); 979 Constant constant = new Constant(name, holder, constantValue);
976 _constants[constantValue] = constant; 980 _constants[constantValue] = constant;
977 } 981 }
978 } 982 }
979 983
980 Holder _registerStaticStateHolder() { 984 Holder _registerStaticStateHolder() {
981 return _registry.registerHolder(namer.staticStateHolder, 985 return _registry.registerHolder(namer.staticStateHolder,
982 isStaticStateHolder: true); 986 isStaticStateHolder: true);
983 } 987 }
984 } 988 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698