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

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

Issue 2937203002: Add J-elements (Closed)
Patch Set: Updated cf. comments Created 3 years, 6 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/ssa/builder.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 27 matching lines...) Expand all
38 import 'jump_handler.dart'; 38 import 'jump_handler.dart';
39 import 'kernel_ast_adapter.dart'; 39 import 'kernel_ast_adapter.dart';
40 import 'kernel_string_builder.dart'; 40 import 'kernel_string_builder.dart';
41 import 'locals_handler.dart'; 41 import 'locals_handler.dart';
42 import 'loop_handler.dart'; 42 import 'loop_handler.dart';
43 import 'nodes.dart'; 43 import 'nodes.dart';
44 import 'ssa_branch_builder.dart'; 44 import 'ssa_branch_builder.dart';
45 import 'switch_continue_analysis.dart'; 45 import 'switch_continue_analysis.dart';
46 import 'type_builder.dart'; 46 import 'type_builder.dart';
47 47
48 class KernelSsaBuilder extends ir.Visitor with GraphBuilder { 48 class KernelSsaGraphBuilder extends ir.Visitor with GraphBuilder {
49 final ir.Node target; 49 final ir.Node target;
50 final bool _targetIsConstructorBody; 50 final bool _targetIsConstructorBody;
51 final MemberEntity targetElement; 51 final MemberEntity targetElement;
52 52
53 /// The root node of [targetElement]. This is used as the key into the 53 /// The root node of [targetElement]. This is used as the key into the
54 /// [startFunction] of the locals handler. 54 /// [startFunction] of the locals handler.
55 // TODO(johnniwinther,efortuna): Avoid the need for AST nodes in the locals 55 // TODO(johnniwinther,efortuna): Avoid the need for AST nodes in the locals
56 // handler. 56 // handler.
57 final Node functionNode; 57 final Node functionNode;
58 final ClosedWorld closedWorld; 58 final ClosedWorld closedWorld;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 LoopHandler<ir.Node> loopHandler; 91 LoopHandler<ir.Node> loopHandler;
92 TypeBuilder typeBuilder; 92 TypeBuilder typeBuilder;
93 93
94 final Map<ir.VariableDeclaration, HInstruction> letBindings = 94 final Map<ir.VariableDeclaration, HInstruction> letBindings =
95 <ir.VariableDeclaration, HInstruction>{}; 95 <ir.VariableDeclaration, HInstruction>{};
96 96
97 /// True if we are visiting the expression of a throw statement; we assume 97 /// True if we are visiting the expression of a throw statement; we assume
98 /// this is a slow path. 98 /// this is a slow path.
99 bool _inExpressionOfThrow = false; 99 bool _inExpressionOfThrow = false;
100 100
101 KernelSsaBuilder( 101 KernelSsaGraphBuilder(
102 this.targetElement, 102 this.targetElement,
103 ClassEntity contextClass, 103 ClassEntity contextClass,
104 this.target, 104 this.target,
105 this.compiler, 105 this.compiler,
106 this._elementMap, 106 this._elementMap,
107 this._typeInferenceMap, 107 this._typeInferenceMap,
108 this.localsMap, 108 this.localsMap,
109 this.closedWorld, 109 this.closedWorld,
110 this._worldBuilder, 110 this._worldBuilder,
111 this.registry, 111 this.registry,
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 // Collect field values for the current class. 266 // Collect field values for the current class.
267 Map<FieldEntity, HInstruction> fieldValues = 267 Map<FieldEntity, HInstruction> fieldValues =
268 _collectFieldValues(constructedClass); 268 _collectFieldValues(constructedClass);
269 List<ir.Constructor> constructorChain = <ir.Constructor>[]; 269 List<ir.Constructor> constructorChain = <ir.Constructor>[];
270 _buildInitializers(constructor, constructorChain, fieldValues); 270 _buildInitializers(constructor, constructorChain, fieldValues);
271 271
272 final constructorArguments = <HInstruction>[]; 272 final constructorArguments = <HInstruction>[];
273 // Doing this instead of fieldValues.forEach because we haven't defined the 273 // Doing this instead of fieldValues.forEach because we haven't defined the
274 // order of the arguments here. We can define that with JElements. 274 // order of the arguments here. We can define that with JElements.
275 ClassEntity cls = _elementMap.getClass(constructedClass); 275 ClassEntity cls = _elementMap.getClass(constructedClass);
276 InterfaceType thisType = _elementMap.getThisType(cls); 276 InterfaceType thisType = _elementMap.elementEnvironment.getThisType(cls);
277 _worldBuilder.forEachInstanceField(cls, 277 _worldBuilder.forEachInstanceField(cls,
278 (ClassEntity enclosingClass, FieldEntity member) { 278 (ClassEntity enclosingClass, FieldEntity member) {
279 var value = fieldValues[member]; 279 var value = fieldValues[member];
280 assert(value != null, 'No value for field ${member}'); 280 assert(value != null, 'No value for field ${member}');
281 constructorArguments.add(value); 281 constructorArguments.add(value);
282 }); 282 });
283 283
284 // Create the runtime type information, if needed. 284 // Create the runtime type information, if needed.
285 bool hasRtiInput = backend.rtiNeed.classNeedsRtiField(cls); 285 bool hasRtiInput = backend.rtiNeed.classNeedsRtiField(cls);
286 if (hasRtiInput) { 286 if (hasRtiInput) {
(...skipping 2974 matching lines...) Expand 10 before | Expand all | Expand 10 after
3261 HBasicBlock enterBlock; 3261 HBasicBlock enterBlock;
3262 HBasicBlock startTryBlock; 3262 HBasicBlock startTryBlock;
3263 HBasicBlock endTryBlock; 3263 HBasicBlock endTryBlock;
3264 HBasicBlock startCatchBlock; 3264 HBasicBlock startCatchBlock;
3265 HBasicBlock endCatchBlock; 3265 HBasicBlock endCatchBlock;
3266 HBasicBlock startFinallyBlock; 3266 HBasicBlock startFinallyBlock;
3267 HBasicBlock endFinallyBlock; 3267 HBasicBlock endFinallyBlock;
3268 HBasicBlock exitBlock; 3268 HBasicBlock exitBlock;
3269 HTry tryInstruction; 3269 HTry tryInstruction;
3270 HLocalValue exception; 3270 HLocalValue exception;
3271 KernelSsaBuilder kernelBuilder; 3271 KernelSsaGraphBuilder kernelBuilder;
3272 3272
3273 /// True if the code surrounding this try statement was also part of a 3273 /// True if the code surrounding this try statement was also part of a
3274 /// try/catch/finally statement. 3274 /// try/catch/finally statement.
3275 bool previouslyInTryStatement; 3275 bool previouslyInTryStatement;
3276 3276
3277 SubGraph bodyGraph; 3277 SubGraph bodyGraph;
3278 SubGraph catchGraph; 3278 SubGraph catchGraph;
3279 SubGraph finallyGraph; 3279 SubGraph finallyGraph;
3280 3280
3281 // The original set of locals that were defined before this try block. 3281 // The original set of locals that were defined before this try block.
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
3471 enterBlock.setBlockFlow( 3471 enterBlock.setBlockFlow(
3472 new HTryBlockInformation( 3472 new HTryBlockInformation(
3473 kernelBuilder.wrapStatementGraph(bodyGraph), 3473 kernelBuilder.wrapStatementGraph(bodyGraph),
3474 exception, 3474 exception,
3475 kernelBuilder.wrapStatementGraph(catchGraph), 3475 kernelBuilder.wrapStatementGraph(catchGraph),
3476 kernelBuilder.wrapStatementGraph(finallyGraph)), 3476 kernelBuilder.wrapStatementGraph(finallyGraph)),
3477 exitBlock); 3477 exitBlock);
3478 kernelBuilder.inTryStatement = previouslyInTryStatement; 3478 kernelBuilder.inTryStatement = previouslyInTryStatement;
3479 } 3479 }
3480 } 3480 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/ssa/builder.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