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

Side by Side Diff: pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart

Issue 1750583002: Revert "dart2js cps: Refactor tracking of side effects." (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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.ir_builder_task; 5 library dart2js.ir_builder_task;
6 6
7 import '../closure.dart' as closure; 7 import '../closure.dart' as closure;
8 import '../common.dart'; 8 import '../common.dart';
9 import '../common/names.dart' show 9 import '../common/names.dart' show
10 Identifiers, 10 Identifiers,
(...skipping 860 matching lines...) Expand 10 before | Expand all | Expand 10 after
871 callStructure.getOrderedNamedArguments()); 871 callStructure.getOrderedNamedArguments());
872 } 872 }
873 873
874 /// Read the value of [field]. 874 /// Read the value of [field].
875 ir.Primitive buildStaticFieldGet(FieldElement field, SourceInformation src) { 875 ir.Primitive buildStaticFieldGet(FieldElement field, SourceInformation src) {
876 ConstantValue constant = getConstantForVariable(field); 876 ConstantValue constant = getConstantForVariable(field);
877 if (constant != null && !field.isAssignable) { 877 if (constant != null && !field.isAssignable) {
878 typeMaskSystem.associateConstantValueWithElement(constant, field); 878 typeMaskSystem.associateConstantValueWithElement(constant, field);
879 return irBuilder.buildConstant(constant, sourceInformation: src); 879 return irBuilder.buildConstant(constant, sourceInformation: src);
880 } else if (backend.constants.lazyStatics.contains(field)) { 880 } else if (backend.constants.lazyStatics.contains(field)) {
881 return irBuilder.addPrimitive(new ir.GetLazyStatic(field, 881 return irBuilder.addPrimitive(new ir.GetLazyStatic(field, src));
882 sourceInformation: src,
883 isFinal: compiler.world.fieldNeverChanges(field)));
884 } else { 882 } else {
885 return irBuilder.addPrimitive(new ir.GetStatic(field, 883 return irBuilder.addPrimitive(new ir.GetStatic(field, src));
886 sourceInformation: src,
887 isFinal: compiler.world.fieldNeverChanges(field)));
888 } 884 }
889 } 885 }
890 886
891 ir.FunctionDefinition _makeFunctionBody( 887 ir.FunctionDefinition _makeFunctionBody(
892 IrBuilder builder, 888 IrBuilder builder,
893 FunctionElement element, 889 FunctionElement element,
894 ast.FunctionExpression node) { 890 ast.FunctionExpression node) {
895 FunctionSignature signature = element.functionSignature; 891 FunctionSignature signature = element.functionSignature;
896 List<Local> parameters = <Local>[]; 892 List<Local> parameters = <Local>[];
897 signature.orderedForEachParameter( 893 signature.orderedForEachParameter(
(...skipping 1035 matching lines...) Expand 10 before | Expand all | Expand 10 after
1933 LocalElement element, 1929 LocalElement element,
1934 _) { 1930 _) {
1935 return irBuilder.buildLocalGet(element); 1931 return irBuilder.buildLocalGet(element);
1936 } 1932 }
1937 1933
1938 @override 1934 @override
1939 ir.Primitive handleStaticFunctionGet( 1935 ir.Primitive handleStaticFunctionGet(
1940 ast.Send node, 1936 ast.Send node,
1941 MethodElement function, 1937 MethodElement function,
1942 _) { 1938 _) {
1943 return irBuilder.addPrimitive(new ir.GetStatic(function, isFinal: true)); 1939 return irBuilder.addPrimitive(new ir.GetStatic(function));
1944 } 1940 }
1945 1941
1946 @override 1942 @override
1947 ir.Primitive handleStaticGetterGet( 1943 ir.Primitive handleStaticGetterGet(
1948 ast.Send node, 1944 ast.Send node,
1949 FunctionElement getter, 1945 FunctionElement getter,
1950 _) { 1946 _) {
1951 return buildStaticGetterGet(getter, node); 1947 return buildStaticGetterGet(getter, node);
1952 } 1948 }
1953 1949
(...skipping 945 matching lines...) Expand 10 before | Expand all | Expand 10 after
2899 CompoundRhs rhs, 2895 CompoundRhs rhs,
2900 arg) { 2896 arg) {
2901 return translateCompounds(node, () { 2897 return translateCompounds(node, () {
2902 switch (getterKind) { 2898 switch (getterKind) {
2903 case CompoundGetter.FIELD: 2899 case CompoundGetter.FIELD:
2904 SourceInformation src = sourceInformationBuilder.buildGet(node); 2900 SourceInformation src = sourceInformationBuilder.buildGet(node);
2905 return buildStaticFieldGet(getter, src); 2901 return buildStaticFieldGet(getter, src);
2906 case CompoundGetter.GETTER: 2902 case CompoundGetter.GETTER:
2907 return buildStaticGetterGet(getter, node); 2903 return buildStaticGetterGet(getter, node);
2908 case CompoundGetter.METHOD: 2904 case CompoundGetter.METHOD:
2909 return irBuilder.addPrimitive(new ir.GetStatic(getter, 2905 return irBuilder.addPrimitive(new ir.GetStatic(getter));
2910 isFinal: true));
2911 case CompoundGetter.UNRESOLVED: 2906 case CompoundGetter.UNRESOLVED:
2912 return irBuilder.buildStaticNoSuchMethod( 2907 return irBuilder.buildStaticNoSuchMethod(
2913 new Selector.getter(new Name(getter.name, getter.library)), 2908 new Selector.getter(new Name(getter.name, getter.library)),
2914 <ir.Primitive>[]); 2909 <ir.Primitive>[]);
2915 } 2910 }
2916 }, rhs, (ir.Primitive result) { 2911 }, rhs, (ir.Primitive result) {
2917 switch (setterKind) { 2912 switch (setterKind) {
2918 case CompoundSetter.FIELD: 2913 case CompoundSetter.FIELD:
2919 irBuilder.addPrimitive(new ir.SetStatic(setter, result)); 2914 irBuilder.addPrimitive(new ir.SetStatic(setter, result));
2920 return; 2915 return;
(...skipping 19 matching lines...) Expand all
2940 ast.Node rhs, 2935 ast.Node rhs,
2941 _) { 2936 _) {
2942 return translateSetIfNull(node, () { 2937 return translateSetIfNull(node, () {
2943 switch (getterKind) { 2938 switch (getterKind) {
2944 case CompoundGetter.FIELD: 2939 case CompoundGetter.FIELD:
2945 SourceInformation src = sourceInformationBuilder.buildGet(node); 2940 SourceInformation src = sourceInformationBuilder.buildGet(node);
2946 return buildStaticFieldGet(getter, src); 2941 return buildStaticFieldGet(getter, src);
2947 case CompoundGetter.GETTER: 2942 case CompoundGetter.GETTER:
2948 return buildStaticGetterGet(getter, node); 2943 return buildStaticGetterGet(getter, node);
2949 case CompoundGetter.METHOD: 2944 case CompoundGetter.METHOD:
2950 return irBuilder.addPrimitive(new ir.GetStatic(getter, 2945 return irBuilder.addPrimitive(new ir.GetStatic(getter));
2951 isFinal: true));
2952 case CompoundGetter.UNRESOLVED: 2946 case CompoundGetter.UNRESOLVED:
2953 return irBuilder.buildStaticNoSuchMethod( 2947 return irBuilder.buildStaticNoSuchMethod(
2954 new Selector.getter(new Name(getter.name, getter.library)), 2948 new Selector.getter(new Name(getter.name, getter.library)),
2955 <ir.Primitive>[]); 2949 <ir.Primitive>[]);
2956 } 2950 }
2957 }, rhs, (ir.Primitive result) { 2951 }, rhs, (ir.Primitive result) {
2958 switch (setterKind) { 2952 switch (setterKind) {
2959 case CompoundSetter.FIELD: 2953 case CompoundSetter.FIELD:
2960 irBuilder.addPrimitive(new ir.SetStatic(setter, result)); 2954 irBuilder.addPrimitive(new ir.SetStatic(setter, result));
2961 return; 2955 return;
(...skipping 1051 matching lines...) Expand 10 before | Expand all | Expand 10 after
4013 } 4007 }
4014 4008
4015 TypeMask getTypeMaskForNativeFunction(FunctionElement function) { 4009 TypeMask getTypeMaskForNativeFunction(FunctionElement function) {
4016 return _compiler.typesTask.getGuaranteedReturnTypeOfElement(function); 4010 return _compiler.typesTask.getGuaranteedReturnTypeOfElement(function);
4017 } 4011 }
4018 4012
4019 FieldElement locateSingleField(Selector selector, TypeMask type) { 4013 FieldElement locateSingleField(Selector selector, TypeMask type) {
4020 return _compiler.world.locateSingleField(selector, type); 4014 return _compiler.world.locateSingleField(selector, type);
4021 } 4015 }
4022 4016
4023 bool fieldNeverChanges(FieldElement field) {
4024 return _compiler.world.fieldNeverChanges(field);
4025 }
4026
4027 Element get closureConverter { 4017 Element get closureConverter {
4028 return _backend.helpers.closureConverter; 4018 return _backend.helpers.closureConverter;
4029 } 4019 }
4030 4020
4031 void addNativeMethod(FunctionElement function) { 4021 void addNativeMethod(FunctionElement function) {
4032 _backend.emitter.nativeEmitter.nativeMethods.add(function); 4022 _backend.emitter.nativeEmitter.nativeMethods.add(function);
4033 } 4023 }
4034 4024
4035 bool get trustJSInteropTypeAnnotations => 4025 bool get trustJSInteropTypeAnnotations =>
4036 _compiler.trustJSInteropTypeAnnotations; 4026 _compiler.trustJSInteropTypeAnnotations;
4037 4027
4038 bool isNative(ClassElement element) => _backend.isNative(element); 4028 bool isNative(ClassElement element) => _backend.isNative(element);
4039 4029
4040 bool isJsInterop(FunctionElement element) => _backend.isJsInterop(element); 4030 bool isJsInterop(FunctionElement element) => _backend.isJsInterop(element);
4041 4031
4042 bool isJsInteropAnonymous(FunctionElement element) => 4032 bool isJsInteropAnonymous(FunctionElement element) =>
4043 _backend.jsInteropAnalysis.hasAnonymousAnnotation(element.contextClass); 4033 _backend.jsInteropAnalysis.hasAnonymousAnnotation(element.contextClass);
4044 4034
4045 String getJsInteropTargetPath(FunctionElement element) { 4035 String getJsInteropTargetPath(FunctionElement element) {
4046 return '${_backend.namer.fixedBackendPath(element)}.' 4036 return '${_backend.namer.fixedBackendPath(element)}.'
4047 '${_backend.getFixedBackendName(element)}'; 4037 '${_backend.getFixedBackendName(element)}';
4048 } 4038 }
4049 4039
4050 DartType get jsJavascriptObjectType => 4040 DartType get jsJavascriptObjectType =>
4051 _backend.helpers.jsJavaScriptObjectClass.thisType; 4041 _backend.helpers.jsJavaScriptObjectClass.thisType;
4052 } 4042 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart ('k') | pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698