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/ssa/builder_kernel.dart

Issue 2541753002: Use precomputed constant for determining if static is lazy-init (Closed)
Patch Set: fix type Created 4 years 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
« no previous file with comments | « no previous file | pkg/compiler/lib/src/ssa/kernel_ast_adapter.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 import 'package:kernel/ast.dart' as ir; 5 import 'package:kernel/ast.dart' as ir;
6 6
7 import '../common.dart'; 7 import '../common.dart';
8 import '../common/codegen.dart' show CodegenRegistry, CodegenWorkItem; 8 import '../common/codegen.dart' show CodegenRegistry, CodegenWorkItem;
9 import '../common/names.dart'; 9 import '../common/names.dart';
10 import '../common/tasks.dart' show CompilerTask; 10 import '../common/tasks.dart' show CompilerTask;
(...skipping 923 matching lines...) Expand 10 before | Expand all | Expand 10 after
934 if (staticTarget is ir.Procedure && 934 if (staticTarget is ir.Procedure &&
935 staticTarget.kind == ir.ProcedureKind.Getter) { 935 staticTarget.kind == ir.ProcedureKind.Getter) {
936 // Invoke the getter 936 // Invoke the getter
937 _pushStaticInvocation(staticTarget, const <HInstruction>[], 937 _pushStaticInvocation(staticTarget, const <HInstruction>[],
938 astAdapter.returnTypeOf(staticTarget)); 938 astAdapter.returnTypeOf(staticTarget));
939 } else if (staticTarget is ir.Field && staticTarget.isConst) { 939 } else if (staticTarget is ir.Field && staticTarget.isConst) {
940 assert(staticTarget.initializer != null); 940 assert(staticTarget.initializer != null);
941 stack.add(graph.addConstant( 941 stack.add(graph.addConstant(
942 astAdapter.getConstantFor(staticTarget.initializer), compiler)); 942 astAdapter.getConstantFor(staticTarget.initializer), compiler));
943 } else { 943 } else {
944 push(new HStatic(astAdapter.getMember(staticTarget), 944 if (_isLazyStatic(staticTarget)) {
945 astAdapter.inferredTypeOf(staticTarget))); 945 push(new HLazyStatic(astAdapter.getField(staticTarget),
946 astAdapter.inferredTypeOf(staticTarget)));
947 } else {
948 push(new HStatic(astAdapter.getMember(staticTarget),
949 astAdapter.inferredTypeOf(staticTarget)));
950 }
946 } 951 }
947 } 952 }
948 953
954 bool _isLazyStatic(ir.Member target) {
955 return astAdapter.isLazyStatic(target);
956 }
957
949 @override 958 @override
950 void visitStaticSet(ir.StaticSet staticSet) { 959 void visitStaticSet(ir.StaticSet staticSet) {
951 staticSet.value.accept(this); 960 staticSet.value.accept(this);
952 HInstruction value = pop(); 961 HInstruction value = pop();
953 962
954 var staticTarget = staticSet.target; 963 var staticTarget = staticSet.target;
955 if (staticTarget is ir.Procedure) { 964 if (staticTarget is ir.Procedure) {
956 // Invoke the setter 965 // Invoke the setter
957 _pushStaticInvocation(staticTarget, <HInstruction>[value], 966 _pushStaticInvocation(staticTarget, <HInstruction>[value],
958 astAdapter.returnTypeOf(staticTarget)); 967 astAdapter.returnTypeOf(staticTarget));
(...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after
1657 push(new HNot(popBoolified(), backend.boolType)); 1666 push(new HNot(popBoolified(), backend.boolType));
1658 } 1667 }
1659 1668
1660 @override 1669 @override
1661 void visitStringConcatenation(ir.StringConcatenation stringConcat) { 1670 void visitStringConcatenation(ir.StringConcatenation stringConcat) {
1662 KernelStringBuilder stringBuilder = new KernelStringBuilder(this); 1671 KernelStringBuilder stringBuilder = new KernelStringBuilder(this);
1663 stringConcat.accept(stringBuilder); 1672 stringConcat.accept(stringBuilder);
1664 stack.add(stringBuilder.result); 1673 stack.add(stringBuilder.result);
1665 } 1674 }
1666 } 1675 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/ssa/kernel_ast_adapter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698