OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |