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

Side by Side Diff: pkg/compiler/lib/src/js_emitter/program_builder/collector.dart

Issue 2916893002: Handle int constant (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
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 part of dart2js.js_emitter.program_builder; 5 part of dart2js.js_emitter.program_builder;
6 6
7 /** 7 /**
8 * Generates the code for all used classes in the program. Static fields (even 8 * Generates the code for all used classes in the program. Static fields (even
9 * in classes) are ignored, since they can be treated as non-class elements. 9 * in classes) are ignored, since they can be treated as non-class elements.
10 * 10 *
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 this._interceptorData, 65 this._interceptorData,
66 this._oneShotInterceptorData, 66 this._oneShotInterceptorData,
67 this._mirrorsData, 67 this._mirrorsData,
68 this._closedWorld, 68 this._closedWorld,
69 this._rtiNeededClasses, 69 this._rtiNeededClasses,
70 this._generatedCode, 70 this._generatedCode,
71 this._sorter); 71 this._sorter);
72 72
73 Set<ClassElement> computeInterceptorsReferencedFromConstants() { 73 Set<ClassElement> computeInterceptorsReferencedFromConstants() {
74 Set<ClassElement> classes = new Set<ClassElement>(); 74 Set<ClassElement> classes = new Set<ClassElement>();
75 JavaScriptConstantCompiler handler = _constantHandler; 75 List<ConstantValue> constants = _worldBuilder.getConstantsForEmission();
76 List<ConstantValue> constants = handler.getConstantsForEmission();
77 for (ConstantValue constant in constants) { 76 for (ConstantValue constant in constants) {
78 if (constant is InterceptorConstantValue) { 77 if (constant is InterceptorConstantValue) {
79 InterceptorConstantValue interceptorConstant = constant; 78 InterceptorConstantValue interceptorConstant = constant;
80 classes.add(interceptorConstant.cls); 79 classes.add(interceptorConstant.cls);
81 } 80 }
82 } 81 }
83 return classes; 82 return classes;
84 } 83 }
85 84
86 /** 85 /**
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 if (needsAccessor && 166 if (needsAccessor &&
168 _mirrorsData.isMemberAccessibleByReflection(member)) { 167 _mirrorsData.isMemberAccessibleByReflection(member)) {
169 _mirrorsData.retainMetadataOfMember(member); 168 _mirrorsData.retainMetadataOfMember(member);
170 } 169 }
171 }, cls: cls); 170 }, cls: cls);
172 } 171 }
173 } 172 }
174 typedefsNeededForReflection.forEach(_mirrorsData.retainMetadataOfTypedef); 173 typedefsNeededForReflection.forEach(_mirrorsData.retainMetadataOfTypedef);
175 } 174 }
176 175
177 JavaScriptConstantCompiler handler = _constantHandler;
178 List<ConstantValue> constants = 176 List<ConstantValue> constants =
179 handler.getConstantsForEmission(_emitter.compareConstants); 177 _worldBuilder.getConstantsForEmission(_emitter.compareConstants);
180 for (ConstantValue constant in constants) { 178 for (ConstantValue constant in constants) {
181 if (_emitter.isConstantInlinedOrAlreadyEmitted(constant)) continue; 179 if (_emitter.isConstantInlinedOrAlreadyEmitted(constant)) continue;
182 180
183 if (constant.isList) outputContainsConstantList = true; 181 if (constant.isList) outputContainsConstantList = true;
184 182
185 OutputUnit constantUnit = 183 OutputUnit constantUnit =
186 _deferredLoadTask.outputUnitForConstant(constant); 184 _deferredLoadTask.outputUnitForConstant(constant);
187 if (constantUnit == null) { 185 if (constantUnit == null) {
188 // The back-end introduces some constants, like "InterceptorConstant" or 186 // The back-end introduces some constants, like "InterceptorConstant" or
189 // some list constants. They are emitted in the main output-unit. 187 // some list constants. They are emitted in the main output-unit.
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 } 355 }
358 356
359 void collect() { 357 void collect() {
360 computeNeededDeclarations(); 358 computeNeededDeclarations();
361 computeNeededConstants(); 359 computeNeededConstants();
362 computeNeededStatics(); 360 computeNeededStatics();
363 computeNeededStaticNonFinalFields(); 361 computeNeededStaticNonFinalFields();
364 computeNeededLibraries(); 362 computeNeededLibraries();
365 } 363 }
366 } 364 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698