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

Side by Side Diff: pkg/compiler/lib/src/inferrer/node_tracer.dart

Issue 3004713002: Remove use of Compiler in inferrer engines. (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
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 library compiler.src.inferrer.node_tracer; 5 library compiler.src.inferrer.node_tracer;
6 6
7 import '../common/names.dart' show Identifiers; 7 import '../common/names.dart' show Identifiers;
8 import '../compiler.dart' show Compiler;
9 import '../elements/elements.dart'; 8 import '../elements/elements.dart';
10 import '../elements/entities.dart'; 9 import '../elements/entities.dart';
11 import '../types/types.dart' show ContainerTypeMask, MapTypeMask; 10 import '../types/types.dart' show ContainerTypeMask, MapTypeMask;
12 import '../util/util.dart' show Setlet; 11 import '../util/util.dart' show Setlet;
13 import 'debug.dart' as debug; 12 import 'debug.dart' as debug;
14 import 'inferrer_engine.dart'; 13 import 'inferrer_engine.dart';
15 import 'type_graph_nodes.dart'; 14 import 'type_graph_nodes.dart';
16 15
17 // A set of selectors we know do not escape the elements inside the 16 // A set of selectors we know do not escape the elements inside the
18 // list. 17 // list.
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 'containsValue', 68 'containsValue',
70 '[]=', 69 '[]=',
71 // [keys] only allows key values to escape, which we do not track. 70 // [keys] only allows key values to escape, which we do not track.
72 'keys' 71 'keys'
73 ]); 72 ]);
74 73
75 /// Common logic to trace a value through the type inference graph nodes. 74 /// Common logic to trace a value through the type inference graph nodes.
76 abstract class TracerVisitor implements TypeInformationVisitor { 75 abstract class TracerVisitor implements TypeInformationVisitor {
77 final TypeInformation tracedType; 76 final TypeInformation tracedType;
78 final InferrerEngine inferrer; 77 final InferrerEngine inferrer;
79 final Compiler compiler;
80 78
81 static const int MAX_ANALYSIS_COUNT = 79 static const int MAX_ANALYSIS_COUNT =
82 const int.fromEnvironment('dart2js.tracing.limit', defaultValue: 32); 80 const int.fromEnvironment('dart2js.tracing.limit', defaultValue: 32);
83 final Setlet<MemberEntity> analyzedElements = new Setlet<MemberEntity>(); 81 final Setlet<MemberEntity> analyzedElements = new Setlet<MemberEntity>();
84 82
85 TracerVisitor(this.tracedType, InferrerEngine inferrer) 83 TracerVisitor(this.tracedType, this.inferrer);
86 : this.inferrer = inferrer,
87 this.compiler = inferrer.compiler;
88 84
89 // Work list that gets populated with [TypeInformation] that could 85 // Work list that gets populated with [TypeInformation] that could
90 // contain the container. 86 // contain the container.
91 final List<TypeInformation> workList = <TypeInformation>[]; 87 final List<TypeInformation> workList = <TypeInformation>[];
92 88
93 // Work list of lists to analyze after analyzing the users of a 89 // Work list of lists to analyze after analyzing the users of a
94 // [TypeInformation]. We know the [tracedType] has been stored in these 90 // [TypeInformation]. We know the [tracedType] has been stored in these
95 // lists and we must check how it escapes from these lists. 91 // lists and we must check how it escapes from these lists.
96 final List<ListTypeInformation> listsToAnalyze = <ListTypeInformation>[]; 92 final List<ListTypeInformation> listsToAnalyze = <ListTypeInformation>[];
97 // Work list of maps to analyze after analyzing the users of a 93 // Work list of maps to analyze after analyzing the users of a
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 } 443 }
448 444
449 void visitMemberTypeInformation(MemberTypeInformation info) { 445 void visitMemberTypeInformation(MemberTypeInformation info) {
450 if (info.isClosurized) { 446 if (info.isClosurized) {
451 bailout('Returned from a closurized method'); 447 bailout('Returned from a closurized method');
452 } 448 }
453 if (isClosure(info.member)) { 449 if (isClosure(info.member)) {
454 bailout('Returned from a closure'); 450 bailout('Returned from a closure');
455 } 451 }
456 if (info.member.isField && 452 if (info.member.isField &&
457 !inferrer.compiler.backend.canFieldBeUsedForGlobalOptimizations( 453 !inferrer.canFieldBeUsedForGlobalOptimizations(info.member)) {
458 info.member, inferrer.closedWorld)) {
459 bailout('Escape to code that has special backend treatment'); 454 bailout('Escape to code that has special backend treatment');
460 } 455 }
461 addNewEscapeInformation(info); 456 addNewEscapeInformation(info);
462 } 457 }
463 458
464 void visitParameterTypeInformation(ParameterTypeInformation info) { 459 void visitParameterTypeInformation(ParameterTypeInformation info) {
465 if (inferrer.closedWorld.nativeData.isNativeMember(info.method)) { 460 if (inferrer.closedWorld.nativeData.isNativeMember(info.method)) {
466 bailout('Passed to a native method'); 461 bailout('Passed to a native method');
467 } 462 }
468 if (!inferrer.compiler.backend 463 if (!inferrer
469 .canFunctionParametersBeUsedForGlobalOptimizations( 464 .canFunctionParametersBeUsedForGlobalOptimizations(info.method)) {
470 info.method, inferrer.closedWorld)) {
471 bailout('Escape to code that has special backend treatment'); 465 bailout('Escape to code that has special backend treatment');
472 } 466 }
473 if (isParameterOfListAddingMethod(info.parameter) || 467 if (isParameterOfListAddingMethod(info.parameter) ||
474 isParameterOfMapAddingMethod(info.parameter)) { 468 isParameterOfMapAddingMethod(info.parameter)) {
475 // These elements are being handled in 469 // These elements are being handled in
476 // [visitDynamicCallSiteTypeInformation]. 470 // [visitDynamicCallSiteTypeInformation].
477 return; 471 return;
478 } 472 }
479 addNewEscapeInformation(info); 473 addNewEscapeInformation(info);
480 } 474 }
481 } 475 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/inferrer/kernel_inferrer_engine.dart ('k') | pkg/compiler/lib/src/inferrer/type_graph_dump.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698