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

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

Issue 1558353002: cpsir: add support for deferred code (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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; 5 library dart2js.ir_builder;
6 6
7 import '../closure.dart' hide ClosureScope; 7 import '../closure.dart' hide ClosureScope;
8 import '../common.dart'; 8 import '../common.dart';
9 import '../common/names.dart' show 9 import '../common/names.dart' show
10 Names, 10 Names,
(...skipping 1037 matching lines...) Expand 10 before | Expand all | Expand 10 after
1048 /// Create a read access of a static [field] that might not have been 1048 /// Create a read access of a static [field] that might not have been
1049 /// initialized yet. 1049 /// initialized yet.
1050 ir.Primitive buildStaticFieldLazyGet(FieldElement field, 1050 ir.Primitive buildStaticFieldLazyGet(FieldElement field,
1051 SourceInformation sourceInformation) { 1051 SourceInformation sourceInformation) {
1052 return addPrimitive(new ir.GetLazyStatic(field, sourceInformation)); 1052 return addPrimitive(new ir.GetLazyStatic(field, sourceInformation));
1053 } 1053 }
1054 1054
1055 /// Create a getter invocation of the static [getter]. 1055 /// Create a getter invocation of the static [getter].
1056 ir.Primitive buildStaticGetterGet(MethodElement getter, 1056 ir.Primitive buildStaticGetterGet(MethodElement getter,
1057 SourceInformation sourceInformation) { 1057 SourceInformation sourceInformation) {
1058 Selector selector = new Selector.getter(getter.memberName); 1058 if (getter.isDeferredLoaderGetter) {
1059 return _buildInvokeStatic( 1059 PrefixElement prefix = getter.enclosingElement;
1060 getter, selector, const <ir.Primitive>[], sourceInformation); 1060 ir.Primitive loadId =
1061 buildStringConstant(program.getImportDeferName(prefix));
1062 return buildStaticFunctionInvocation(program.loadLibraryFunction,
1063 CallStructure.ONE_ARG, <ir.Primitive>[loadId],
1064 sourceInformation: sourceInformation);
1065 } else {
1066 Selector selector = new Selector.getter(getter.memberName);
1067 return _buildInvokeStatic(
1068 getter, selector, const <ir.Primitive>[], sourceInformation);
1069 }
1061 } 1070 }
1062 1071
1063 /// Create a read access of the static [function], i.e. a closurization of 1072 /// Create a read access of the static [function], i.e. a closurization of
1064 /// [function]. 1073 /// [function].
1065 ir.Primitive buildStaticFunctionGet(MethodElement function, 1074 ir.Primitive buildStaticFunctionGet(MethodElement function,
1066 {SourceInformation sourceInformation}) { 1075 {SourceInformation sourceInformation}) {
1067 return addPrimitive(new ir.GetStatic(function, sourceInformation)); 1076 return addPrimitive(new ir.GetStatic(function, sourceInformation));
1068 } 1077 }
1069 1078
1070 /// Create a write access to the static [field] with the [value]. 1079 /// Create a write access to the static [field] with the [value].
(...skipping 1845 matching lines...) Expand 10 before | Expand all | Expand 10 after
2916 } 2925 }
2917 2926
2918 class SwitchCaseInfo { 2927 class SwitchCaseInfo {
2919 final List<ir.Primitive> constants = <ir.Primitive>[]; 2928 final List<ir.Primitive> constants = <ir.Primitive>[];
2920 final SubbuildFunction buildBody; 2929 final SubbuildFunction buildBody;
2921 2930
2922 SwitchCaseInfo(this.buildBody); 2931 SwitchCaseInfo(this.buildBody);
2923 2932
2924 void addConstant(ir.Primitive constant) => constants.add(constant); 2933 void addConstant(ir.Primitive constant) => constants.add(constant);
2925 } 2934 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart » ('j') | tests/language/language_dart2js.status » ('J')

Powered by Google App Engine
This is Rietveld 408576698