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

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

Issue 2949293002: Add ScopeInfo class for variable information that doesn't actually involve closures. (Closed)
Patch Set: . 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/locals_handler.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 587 matching lines...) Expand 10 before | Expand all | Expand 10 after
598 localsHandler.updateLocal(parameter, argument); 598 localsHandler.updateLocal(parameter, argument);
599 } 599 }
600 600
601 constructor.function.positionalParameters.forEach(handleParameter); 601 constructor.function.positionalParameters.forEach(handleParameter);
602 constructor.function.namedParameters.toList() 602 constructor.function.namedParameters.toList()
603 ..sort(namedOrdering) 603 ..sort(namedOrdering)
604 ..forEach(handleParameter); 604 ..forEach(handleParameter);
605 605
606 // Set the locals handler state as if we were inlining the constructor. 606 // Set the locals handler state as if we were inlining the constructor.
607 ConstructorEntity astElement = _elementMap.getConstructor(constructor); 607 ConstructorEntity astElement = _elementMap.getConstructor(constructor);
608 ClosureRepresentationInfo oldClosureData = localsHandler.closureData; 608 ClosureRepresentationInfo oldScopeInfo = localsHandler.scopeInfo;
609 ClosureRepresentationInfo newClosureData = 609 ClosureRepresentationInfo newScopeInfo =
610 closureDataLookup.getClosureRepresentationInfo(astElement); 610 closureDataLookup.getScopeInfo(astElement);
611 if (astElement is ConstructorElement) { 611 if (astElement is ConstructorElement) {
612 // TODO(johnniwinther): Support constructor (body) entities. 612 // TODO(johnniwinther): Support constructor (body) entities.
613 ResolvedAst resolvedAst = astElement.resolvedAst; 613 ResolvedAst resolvedAst = astElement.resolvedAst;
614 localsHandler.closureData = newClosureData; 614 localsHandler.scopeInfo = newScopeInfo;
615 if (resolvedAst.kind == ResolvedAstKind.PARSED) { 615 if (resolvedAst.kind == ResolvedAstKind.PARSED) {
616 localsHandler.enterScope( 616 localsHandler.enterScope(
617 closureDataLookup.getClosureAnalysisInfo(resolvedAst.node), 617 closureDataLookup.getClosureAnalysisInfo(resolvedAst.node),
618 forGenerativeConstructorBody: 618 forGenerativeConstructorBody:
619 astElement.isGenerativeConstructorBody); 619 astElement.isGenerativeConstructorBody);
620 } 620 }
621 } 621 }
622 inlinedFrom(astElement, () { 622 inlinedFrom(astElement, () {
623 _buildInitializers(constructor, constructorChain, fieldValues); 623 _buildInitializers(constructor, constructorChain, fieldValues);
624 }); 624 });
625 localsHandler.closureData = oldClosureData; 625 localsHandler.scopeInfo = oldScopeInfo;
626 } 626 }
627 627
628 /// Builds generative constructor body. 628 /// Builds generative constructor body.
629 void buildConstructorBody(ir.Constructor constructor) { 629 void buildConstructorBody(ir.Constructor constructor) {
630 openFunction(constructor.function); 630 openFunction(constructor.function);
631 _addClassTypeVariablesIfNeeded(constructor); 631 _addClassTypeVariablesIfNeeded(constructor);
632 constructor.function.body.accept(this); 632 constructor.function.body.accept(this);
633 closeFunction(); 633 closeFunction();
634 } 634 }
635 635
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 function.namedParameters.toList() 698 function.namedParameters.toList()
699 ..sort(namedOrdering) 699 ..sort(namedOrdering)
700 ..forEach(handleParameter); 700 ..forEach(handleParameter);
701 } 701 }
702 702
703 HBasicBlock block = graph.addNewBlock(); 703 HBasicBlock block = graph.addNewBlock();
704 open(graph.entry); 704 open(graph.entry);
705 705
706 localsHandler.startFunction( 706 localsHandler.startFunction(
707 targetElement, 707 targetElement,
708 closureDataLookup.getClosureRepresentationInfo(targetElement), 708 closureDataLookup.getScopeInfo(targetElement),
709 closureDataLookup.getClosureAnalysisInfo(functionNode), 709 closureDataLookup.getClosureAnalysisInfo(functionNode),
710 parameterMap, 710 parameterMap,
711 isGenerativeConstructorBody: _targetIsConstructorBody); 711 isGenerativeConstructorBody: _targetIsConstructorBody);
712 close(new HGoto()).addSuccessor(block); 712 close(new HGoto()).addSuccessor(block);
713 713
714 open(block); 714 open(block);
715 } 715 }
716 716
717 void closeFunction() { 717 void closeFunction() {
718 if (!isAborted()) closeAndGotoExit(new HGoto()); 718 if (!isAborted()) closeAndGotoExit(new HGoto());
(...skipping 2768 matching lines...) Expand 10 before | Expand all | Expand 10 after
3487 enterBlock.setBlockFlow( 3487 enterBlock.setBlockFlow(
3488 new HTryBlockInformation( 3488 new HTryBlockInformation(
3489 kernelBuilder.wrapStatementGraph(bodyGraph), 3489 kernelBuilder.wrapStatementGraph(bodyGraph),
3490 exception, 3490 exception,
3491 kernelBuilder.wrapStatementGraph(catchGraph), 3491 kernelBuilder.wrapStatementGraph(catchGraph),
3492 kernelBuilder.wrapStatementGraph(finallyGraph)), 3492 kernelBuilder.wrapStatementGraph(finallyGraph)),
3493 exitBlock); 3493 exitBlock);
3494 kernelBuilder.inTryStatement = previouslyInTryStatement; 3494 kernelBuilder.inTryStatement = previouslyInTryStatement;
3495 } 3495 }
3496 } 3496 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/ssa/builder.dart ('k') | pkg/compiler/lib/src/ssa/locals_handler.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698