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

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

Issue 2314703002: Split World usage into open, inference, and closed world. (Closed)
Patch Set: Updated cf. comments. Created 4 years, 3 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 653 matching lines...) Expand 10 before | Expand all | Expand 10 after
664 664
665 bool _methodCanBeReflected(FunctionElement method) { 665 bool _methodCanBeReflected(FunctionElement method) {
666 return backend.isAccessibleByReflection(method) || 666 return backend.isAccessibleByReflection(method) ||
667 // During incremental compilation, we have to assume that reflection 667 // During incremental compilation, we have to assume that reflection
668 // *might* get enabled. 668 // *might* get enabled.
669 _compiler.options.hasIncrementalSupport; 669 _compiler.options.hasIncrementalSupport;
670 } 670 }
671 671
672 bool _methodCanBeApplied(FunctionElement method) { 672 bool _methodCanBeApplied(FunctionElement method) {
673 return _compiler.enabledFunctionApply && 673 return _compiler.enabledFunctionApply &&
674 _compiler.world.getMightBePassedToApply(method); 674 _compiler.closedWorld.getMightBePassedToApply(method);
675 } 675 }
676 676
677 // TODO(herhut): Refactor incremental compilation and remove method. 677 // TODO(herhut): Refactor incremental compilation and remove method.
678 Method buildMethodHackForIncrementalCompilation(FunctionElement element) { 678 Method buildMethodHackForIncrementalCompilation(FunctionElement element) {
679 assert(_compiler.options.hasIncrementalSupport); 679 assert(_compiler.options.hasIncrementalSupport);
680 if (element.isInstanceMember) { 680 if (element.isInstanceMember) {
681 return _buildMethod(element); 681 return _buildMethod(element);
682 } else { 682 } else {
683 return _buildStaticMethod(element); 683 return _buildStaticMethod(element);
684 } 684 }
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
724 : null; 724 : null;
725 725
726 if (isNotApplyTarget) { 726 if (isNotApplyTarget) {
727 canTearOff = false; 727 canTearOff = false;
728 } else { 728 } else {
729 if (element.enclosingClass.isClosure) { 729 if (element.enclosingClass.isClosure) {
730 canTearOff = false; 730 canTearOff = false;
731 isClosureCallMethod = true; 731 isClosureCallMethod = true;
732 } else { 732 } else {
733 // Careful with operators. 733 // Careful with operators.
734 canTearOff = universe.hasInvokedGetter(element, _compiler.world) || 734 canTearOff =
735 (canBeReflected && !element.isOperator); 735 universe.hasInvokedGetter(element, _compiler.closedWorld) ||
736 (canBeReflected && !element.isOperator);
736 assert(canTearOff || 737 assert(canTearOff ||
737 !universe.methodsNeedingSuperGetter.contains(element)); 738 !universe.methodsNeedingSuperGetter.contains(element));
738 tearOffName = namer.getterForElement(element); 739 tearOffName = namer.getterForElement(element);
739 } 740 }
740 } 741 }
741 742
742 if (canTearOff) { 743 if (canTearOff) {
743 assert(invariant(element, !element.isGenerativeConstructor)); 744 assert(invariant(element, !element.isGenerativeConstructor));
744 assert(invariant(element, !element.isGenerativeConstructorBody)); 745 assert(invariant(element, !element.isGenerativeConstructorBody));
745 assert(invariant(element, !element.isConstructor)); 746 assert(invariant(element, !element.isConstructor));
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
975 Constant constant = new Constant(name, holder, constantValue); 976 Constant constant = new Constant(name, holder, constantValue);
976 _constants[constantValue] = constant; 977 _constants[constantValue] = constant;
977 } 978 }
978 } 979 }
979 980
980 Holder _registerStaticStateHolder() { 981 Holder _registerStaticStateHolder() {
981 return _registry.registerHolder(namer.staticStateHolder, 982 return _registry.registerHolder(namer.staticStateHolder,
982 isStaticStateHolder: true); 983 isStaticStateHolder: true);
983 } 984 }
984 } 985 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698