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

Side by Side Diff: pkg/compiler/lib/src/ssa/builder_kernel.dart

Issue 3009593002: It's alive (first kernel inference test) (Closed)
Patch Set: Updated cf. comment Created 3 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
« no previous file with comments | « pkg/compiler/lib/src/kernel/env.dart ('k') | 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 '../closure.dart'; 7 import '../closure.dart';
8 import '../common.dart'; 8 import '../common.dart';
9 import '../common/codegen.dart' show CodegenRegistry; 9 import '../common/codegen.dart' show CodegenRegistry;
10 import '../common/names.dart'; 10 import '../common/names.dart';
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 212
213 function.positionalParameters 213 function.positionalParameters
214 .skip(function.requiredParameterCount) 214 .skip(function.requiredParameterCount)
215 .forEach(registerDefaultValue); 215 .forEach(registerDefaultValue);
216 function.namedParameters.forEach(registerDefaultValue); 216 function.namedParameters.forEach(registerDefaultValue);
217 } 217 }
218 218
219 @override 219 @override
220 ConstantValue getFieldInitialConstantValue(FieldEntity field) { 220 ConstantValue getFieldInitialConstantValue(FieldEntity field) {
221 assert(field == targetElement); 221 assert(field == targetElement);
222 MemberDefinition definition = _elementMap.getMemberDefinition(field); 222 return _elementMap.getFieldConstantValue(field);
223 assert(definition.kind == MemberKind.regular,
224 failedAt(field, "Unexpected member definition: $definition"));
225 return _elementMap.getFieldConstantValue(definition.node);
226 } 223 }
227 224
228 void buildField(ir.Field field) { 225 void buildField(ir.Field field) {
229 openFunction(); 226 openFunction();
230 if (field.initializer != null) { 227 if (field.initializer != null) {
231 field.initializer.accept(this); 228 field.initializer.accept(this);
232 HInstruction fieldValue = pop(); 229 HInstruction fieldValue = pop();
233 HInstruction checkInstruction = typeBuilder.potentiallyCheckOrTrustType( 230 HInstruction checkInstruction = typeBuilder.potentiallyCheckOrTrustType(
234 fieldValue, _getDartTypeIfValid(field.type)); 231 fieldValue, _getDartTypeIfValid(field.type));
235 stack.add(checkInstruction); 232 stack.add(checkInstruction);
(...skipping 1993 matching lines...) Expand 10 before | Expand all | Expand 10 after
2229 void visitStaticGet(ir.StaticGet staticGet) { 2226 void visitStaticGet(ir.StaticGet staticGet) {
2230 ir.Member staticTarget = staticGet.target; 2227 ir.Member staticTarget = staticGet.target;
2231 if (staticTarget is ir.Procedure && 2228 if (staticTarget is ir.Procedure &&
2232 staticTarget.kind == ir.ProcedureKind.Getter) { 2229 staticTarget.kind == ir.ProcedureKind.Getter) {
2233 FunctionEntity getter = _elementMap.getMember(staticTarget); 2230 FunctionEntity getter = _elementMap.getMember(staticTarget);
2234 // Invoke the getter 2231 // Invoke the getter
2235 _pushStaticInvocation(getter, const <HInstruction>[], 2232 _pushStaticInvocation(getter, const <HInstruction>[],
2236 _typeInferenceMap.getReturnTypeOf(getter)); 2233 _typeInferenceMap.getReturnTypeOf(getter));
2237 } else if (staticTarget is ir.Field) { 2234 } else if (staticTarget is ir.Field) {
2238 FieldEntity field = _elementMap.getField(staticTarget); 2235 FieldEntity field = _elementMap.getField(staticTarget);
2239 ConstantValue value = _elementMap.getFieldConstantValue(staticTarget); 2236 ConstantValue value = _elementMap.getFieldConstantValue(field);
2240 if (value != null) { 2237 if (value != null) {
2241 if (!field.isAssignable) { 2238 if (!field.isAssignable) {
2242 stack.add(graph.addConstant(value, closedWorld)); 2239 stack.add(graph.addConstant(value, closedWorld));
2243 } else { 2240 } else {
2244 push(new HStatic(field, _typeInferenceMap.getInferredTypeOf(field))); 2241 push(new HStatic(field, _typeInferenceMap.getInferredTypeOf(field)));
2245 } 2242 }
2246 } else { 2243 } else {
2247 push( 2244 push(
2248 new HLazyStatic(field, _typeInferenceMap.getInferredTypeOf(field))); 2245 new HLazyStatic(field, _typeInferenceMap.getInferredTypeOf(field)));
2249 } 2246 }
(...skipping 1485 matching lines...) Expand 10 before | Expand all | Expand 10 after
3735 enterBlock.setBlockFlow( 3732 enterBlock.setBlockFlow(
3736 new HTryBlockInformation( 3733 new HTryBlockInformation(
3737 kernelBuilder.wrapStatementGraph(bodyGraph), 3734 kernelBuilder.wrapStatementGraph(bodyGraph),
3738 exception, 3735 exception,
3739 kernelBuilder.wrapStatementGraph(catchGraph), 3736 kernelBuilder.wrapStatementGraph(catchGraph),
3740 kernelBuilder.wrapStatementGraph(finallyGraph)), 3737 kernelBuilder.wrapStatementGraph(finallyGraph)),
3741 exitBlock); 3738 exitBlock);
3742 kernelBuilder.inTryStatement = previouslyInTryStatement; 3739 kernelBuilder.inTryStatement = previouslyInTryStatement;
3743 } 3740 }
3744 } 3741 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/kernel/env.dart ('k') | pkg/compiler/lib/src/ssa/kernel_ast_adapter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698