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 ClosureTask, ClosureFieldElement; | 7 import '../../closure.dart' show ClosureTask, 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 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 } | 544 } |
545 | 545 |
546 Class _buildClass(ClassElement element) { | 546 Class _buildClass(ClassElement element) { |
547 bool onlyForRti = collector.classesOnlyNeededForRti.contains(element); | 547 bool onlyForRti = collector.classesOnlyNeededForRti.contains(element); |
548 bool hasRtiField = _rtiNeed.classNeedsRtiField(element); | 548 bool hasRtiField = _rtiNeed.classNeedsRtiField(element); |
549 if (_nativeData.isJsInteropClass(element)) { | 549 if (_nativeData.isJsInteropClass(element)) { |
550 // TODO(jacobr): check whether the class has any active static fields | 550 // TODO(jacobr): check whether the class has any active static fields |
551 // if it does not we can suppress it completely. | 551 // if it does not we can suppress it completely. |
552 onlyForRti = true; | 552 onlyForRti = true; |
553 } | 553 } |
554 bool isClosureBaseClass = element == _compiler.commonElements.closureClass; | 554 bool isClosureBaseClass = element == _commonElements.closureClass; |
555 | 555 |
556 List<Method> methods = []; | 556 List<Method> methods = []; |
557 List<StubMethod> callStubs = <StubMethod>[]; | 557 List<StubMethod> callStubs = <StubMethod>[]; |
558 | 558 |
559 ClassStubGenerator classStubGenerator = new ClassStubGenerator( | 559 ClassStubGenerator classStubGenerator = new ClassStubGenerator( |
560 _namer, _backend, _worldBuilder, _closedWorld, | 560 _namer, _backend, _worldBuilder, _closedWorld, |
561 enableMinification: _options.enableMinification); | 561 enableMinification: _options.enableMinification); |
562 RuntimeTypeGenerator runtimeTypeGenerator = new RuntimeTypeGenerator( | 562 RuntimeTypeGenerator runtimeTypeGenerator = new RuntimeTypeGenerator( |
563 _commonElements, | 563 _commonElements, |
564 _closureToClassMapper, | 564 _closureToClassMapper, |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
910 Set<ClassEntity> classes = | 910 Set<ClassEntity> classes = |
911 _oneShotInterceptorData.getSpecializedGetInterceptorsFor(name); | 911 _oneShotInterceptorData.getSpecializedGetInterceptorsFor(name); |
912 js.Expression code = stubGenerator.generateGetInterceptorMethod(classes); | 912 js.Expression code = stubGenerator.generateGetInterceptorMethod(classes); |
913 return new StaticStubMethod(name, holder, code); | 913 return new StaticStubMethod(name, holder, code); |
914 }); | 914 }); |
915 } | 915 } |
916 | 916 |
917 List<Field> _buildFields(Element holder, | 917 List<Field> _buildFields(Element holder, |
918 {bool visitStatics, bool isHolderInterceptedClass: false}) { | 918 {bool visitStatics, bool isHolderInterceptedClass: false}) { |
919 List<Field> fields = <Field>[]; | 919 List<Field> fields = <Field>[]; |
920 new FieldVisitor(_compiler, _namer, _closedWorld) | 920 new FieldVisitor(_options, _worldBuilder, _nativeData, _mirrorsData, _namer, |
| 921 _closedWorld) |
921 .visitFields(holder, visitStatics, (FieldElement field, | 922 .visitFields(holder, visitStatics, (FieldElement field, |
922 js.Name name, | 923 js.Name name, |
923 js.Name accessorName, | 924 js.Name accessorName, |
924 bool needsGetter, | 925 bool needsGetter, |
925 bool needsSetter, | 926 bool needsSetter, |
926 bool needsCheckedSetter) { | 927 bool needsCheckedSetter) { |
927 assert(invariant(field, field.isDeclaration)); | 928 assert(invariant(field, field.isDeclaration)); |
928 | 929 |
929 int getterFlags = 0; | 930 int getterFlags = 0; |
930 if (needsGetter) { | 931 if (needsGetter) { |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1055 Constant constant = new Constant(name, holder, constantValue); | 1056 Constant constant = new Constant(name, holder, constantValue); |
1056 _constants[constantValue] = constant; | 1057 _constants[constantValue] = constant; |
1057 } | 1058 } |
1058 } | 1059 } |
1059 | 1060 |
1060 Holder _registerStaticStateHolder() { | 1061 Holder _registerStaticStateHolder() { |
1061 return _registry.registerHolder(_namer.staticStateHolder, | 1062 return _registry.registerHolder(_namer.staticStateHolder, |
1062 isStaticStateHolder: true); | 1063 isStaticStateHolder: true); |
1063 } | 1064 } |
1064 } | 1065 } |
OLD | NEW |