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

Side by Side Diff: pkg/compiler/lib/src/closure.dart

Issue 3011433002: Revert "Reduce use of getClosureInfoForMember and cleanup closure_test" (Closed)
Patch Set: 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 | « no previous file | pkg/compiler/lib/src/js_emitter/runtime_type_generator.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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 'common/names.dart' show Identifiers; 5 import 'common/names.dart' show Identifiers;
6 import 'common/resolution.dart' show ParsingContext, Resolution; 6 import 'common/resolution.dart' show ParsingContext, Resolution;
7 import 'common/tasks.dart' show CompilerTask, Measurer; 7 import 'common/tasks.dart' show CompilerTask, Measurer;
8 import 'common.dart'; 8 import 'common.dart';
9 import 'compiler.dart' show Compiler; 9 import 'compiler.dart' show Compiler;
10 import 'constants/expressions.dart'; 10 import 'constants/expressions.dart';
(...skipping 28 matching lines...) Expand all
39 /// to preserve Dart semantics when compiled to JavaScript. Given a particular 39 /// to preserve Dart semantics when compiled to JavaScript. Given a particular
40 /// node to look up, it returns a information about the internal representation 40 /// node to look up, it returns a information about the internal representation
41 /// of how closure conversion is implemented. T is an ir.Node or Node. 41 /// of how closure conversion is implemented. T is an ir.Node or Node.
42 abstract class ClosureDataLookup<T> { 42 abstract class ClosureDataLookup<T> {
43 /// Look up information about the variables that have been mutated and are 43 /// Look up information about the variables that have been mutated and are
44 /// used inside the scope of [node]. 44 /// used inside the scope of [node].
45 ScopeInfo getScopeInfo(MemberEntity member); 45 ScopeInfo getScopeInfo(MemberEntity member);
46 46
47 /// This returns the same information as ScopeInfo, but can be called in 47 /// This returns the same information as ScopeInfo, but can be called in
48 /// situations when you are sure you are dealing with a closure specifically. 48 /// situations when you are sure you are dealing with a closure specifically.
49 // TODO(johnniwinther,efortuna): Remove the need for this. It is now only 49 // TODO(johnniwinther,efortuna): Can we use [getScopeInfo] instead?
50 // used in inference.
51 ClosureRepresentationInfo getClosureInfoForMember(MemberEntity member); 50 ClosureRepresentationInfo getClosureInfoForMember(MemberEntity member);
52 51
53 ClosureRepresentationInfo getClosureInfo(T localFunction); 52 ClosureRepresentationInfo getClosureInfo(T localFunction);
54 53
54 ClosureRepresentationInfo getClosureInfoForMemberTesting(MemberEntity member);
55
56 ClosureRepresentationInfo getClosureInfoForTesting(T localFunction);
57
55 /// Look up information about a loop, in case any variables it declares need 58 /// Look up information about a loop, in case any variables it declares need
56 /// to be boxed/snapshotted. 59 /// to be boxed/snapshotted.
57 CapturedLoopScope getCapturedLoopScope(T loopNode); 60 CapturedLoopScope getCapturedLoopScope(T loopNode);
58 61
59 /// Accessor to the information about scopes that closures capture. Used by 62 /// Accessor to the information about scopes that closures capture. Used by
60 /// the SSA builder. 63 /// the SSA builder.
61 CapturedScope getCapturedScope(MemberEntity entity); 64 CapturedScope getCapturedScope(MemberEntity entity);
62 } 65 }
63 66
64 /// Class that represents one level of scoping information, whether this scope 67 /// Class that represents one level of scoping information, whether this scope
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 } 292 }
290 293
291 ClosureRepresentationInfo getClosureInfoForMember(MemberEntity member) { 294 ClosureRepresentationInfo getClosureInfoForMember(MemberEntity member) {
292 return _getMemberMapping(member); 295 return _getMemberMapping(member);
293 } 296 }
294 297
295 ClosureRepresentationInfo getClosureInfo(covariant FunctionExpression node) { 298 ClosureRepresentationInfo getClosureInfo(covariant FunctionExpression node) {
296 return _getClosureMapping(node); 299 return _getClosureMapping(node);
297 } 300 }
298 301
302 ClosureRepresentationInfo getClosureInfoForMemberTesting(
303 MemberEntity member) {
304 return getClosureInfoForMember(member);
305 }
306
307 ClosureRepresentationInfo getClosureInfoForTesting(
308 covariant FunctionExpression node) {
309 return getClosureInfo(node);
310 }
311
299 CapturedLoopScope getCapturedLoopScope(Node loopNode) { 312 CapturedLoopScope getCapturedLoopScope(Node loopNode) {
300 var value = _closureInfoMap[loopNode]; 313 var value = _closureInfoMap[loopNode];
301 return value == null ? const CapturedLoopScope() : value; 314 return value == null ? const CapturedLoopScope() : value;
302 } 315 }
303 316
304 /// Returns the [ClosureClassMap] computed for [element]. 317 /// Returns the [ClosureClassMap] computed for [element].
305 ClosureClassMap _getMemberMapping(MemberElement element) { 318 ClosureClassMap _getMemberMapping(MemberElement element) {
306 return measure(() { 319 return measure(() {
307 if (element.isGenerativeConstructorBody) { 320 if (element.isGenerativeConstructorBody) {
308 ConstructorBodyElement constructorBody = element; 321 ConstructorBodyElement constructorBody = element;
(...skipping 1243 matching lines...) Expand 10 before | Expand all | Expand 10 after
1552 /// 1565 ///
1553 /// Move the below classes to a JS model eventually. 1566 /// Move the below classes to a JS model eventually.
1554 /// 1567 ///
1555 abstract class JSEntity implements MemberEntity { 1568 abstract class JSEntity implements MemberEntity {
1556 Local get declaredEntity; 1569 Local get declaredEntity;
1557 } 1570 }
1558 1571
1559 abstract class PrivatelyNamedJSEntity implements JSEntity { 1572 abstract class PrivatelyNamedJSEntity implements JSEntity {
1560 Entity get rootOfScope; 1573 Entity get rootOfScope;
1561 } 1574 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/js_emitter/runtime_type_generator.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698