| 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 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 Loading... |
| 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 hasRtiField: backend.classNeedsRtiField(element), | |
| 503 onlyForRti: false, | 502 onlyForRti: false, |
| 504 isNative: backend.isNative(element)); | 503 isNative: backend.isNative(element)); |
| 505 } | 504 } |
| 506 | 505 |
| 507 Class _buildClass(ClassElement element) { | 506 Class _buildClass(ClassElement element) { |
| 508 bool onlyForRti = collector.classesOnlyNeededForRti.contains(element); | 507 bool onlyForRti = collector.classesOnlyNeededForRti.contains(element); |
| 509 bool hasRtiField = backend.classNeedsRtiField(element); | |
| 510 if (backend.isJsInterop(element)) { | 508 if (backend.isJsInterop(element)) { |
| 511 // TODO(jacobr): check whether the class has any active static fields | 509 // TODO(jacobr): check whether the class has any active static fields |
| 512 // if it does not we can suppress it completely. | 510 // if it does not we can suppress it completely. |
| 513 onlyForRti = true; | 511 onlyForRti = true; |
| 514 } | 512 } |
| 515 | 513 |
| 516 List<Method> methods = []; | 514 List<Method> methods = []; |
| 517 List<StubMethod> callStubs = <StubMethod>[]; | 515 List<StubMethod> callStubs = <StubMethod>[]; |
| 518 | 516 |
| 519 ClassStubGenerator classStubGenerator = | 517 ClassStubGenerator classStubGenerator = |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 630 name, | 628 name, |
| 631 holder, | 629 holder, |
| 632 instanceFields, | 630 instanceFields, |
| 633 staticFieldsForReflection, | 631 staticFieldsForReflection, |
| 634 callStubs, | 632 callStubs, |
| 635 typeVariableReaderStubs, | 633 typeVariableReaderStubs, |
| 636 checkedSetters, | 634 checkedSetters, |
| 637 isChecks, | 635 isChecks, |
| 638 typeTests.functionTypeIndex, | 636 typeTests.functionTypeIndex, |
| 639 isDirectlyInstantiated: isInstantiated, | 637 isDirectlyInstantiated: isInstantiated, |
| 640 hasRtiField: hasRtiField, | |
| 641 onlyForRti: onlyForRti); | 638 onlyForRti: onlyForRti); |
| 642 } else { | 639 } else { |
| 643 result = new Class( | 640 result = new Class( |
| 644 element, | 641 element, |
| 645 name, | 642 name, |
| 646 holder, | 643 holder, |
| 647 methods, | 644 methods, |
| 648 instanceFields, | 645 instanceFields, |
| 649 staticFieldsForReflection, | 646 staticFieldsForReflection, |
| 650 callStubs, | 647 callStubs, |
| 651 typeVariableReaderStubs, | 648 typeVariableReaderStubs, |
| 652 noSuchMethodStubs, | 649 noSuchMethodStubs, |
| 653 checkedSetters, | 650 checkedSetters, |
| 654 isChecks, | 651 isChecks, |
| 655 typeTests.functionTypeIndex, | 652 typeTests.functionTypeIndex, |
| 656 isDirectlyInstantiated: isInstantiated, | 653 isDirectlyInstantiated: isInstantiated, |
| 657 hasRtiField: hasRtiField, | |
| 658 onlyForRti: onlyForRti, | 654 onlyForRti: onlyForRti, |
| 659 isNative: backend.isNative(element)); | 655 isNative: backend.isNative(element)); |
| 660 } | 656 } |
| 661 _classes[element] = result; | 657 _classes[element] = result; |
| 662 return result; | 658 return result; |
| 663 } | 659 } |
| 664 | 660 |
| 665 bool _methodNeedsStubs(FunctionElement method) { | 661 bool _methodNeedsStubs(FunctionElement method) { |
| 666 return !method.functionSignature.optionalParameters.isEmpty; | 662 return !method.functionSignature.optionalParameters.isEmpty; |
| 667 } | 663 } |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 979 Constant constant = new Constant(name, holder, constantValue); | 975 Constant constant = new Constant(name, holder, constantValue); |
| 980 _constants[constantValue] = constant; | 976 _constants[constantValue] = constant; |
| 981 } | 977 } |
| 982 } | 978 } |
| 983 | 979 |
| 984 Holder _registerStaticStateHolder() { | 980 Holder _registerStaticStateHolder() { |
| 985 return _registry.registerHolder(namer.staticStateHolder, | 981 return _registry.registerHolder(namer.staticStateHolder, |
| 986 isStaticStateHolder: true); | 982 isStaticStateHolder: true); |
| 987 } | 983 } |
| 988 } | 984 } |
| OLD | NEW |