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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/compiler.dart

Issue 12528008: Implement CHA through type mask and TypedSelector in the simple type inferrer. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/js_backend/backend.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 part of dart2js; 5 part of dart2js;
6 6
7 /** 7 /**
8 * If true, print a warning for each method that was resolved, but not 8 * If true, print a warning for each method that was resolved, but not
9 * compiled. 9 * compiled.
10 */ 10 */
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 void registerThrowRuntimeError() {} 148 void registerThrowRuntimeError() {}
149 void registerAbstractClassInstantiation() {} 149 void registerAbstractClassInstantiation() {}
150 void registerFallThroughError() {} 150 void registerFallThroughError() {}
151 void registerSuperNoSuchMethod() {} 151 void registerSuperNoSuchMethod() {}
152 void registerConstantMap() {} 152 void registerConstantMap() {}
153 void registerRuntimeType() {} 153 void registerRuntimeType() {}
154 154
155 bool isNullImplementation(ClassElement cls) { 155 bool isNullImplementation(ClassElement cls) {
156 return cls == compiler.nullClass; 156 return cls == compiler.nullClass;
157 } 157 }
158 ClassElement get intImplementation => compiler.intClass;
159 ClassElement get doubleImplementation => compiler.doubleClass;
160 ClassElement get numImplementation => compiler.numClass;
161 ClassElement get stringImplementation => compiler.stringClass;
162 ClassElement get listImplementation => compiler.listClass;
163 ClassElement get mapImplementation => compiler.mapClass;
164 ClassElement get constMapImplementation => compiler.mapClass;
165 ClassElement get functionImplementation => compiler.functionClass;
166 ClassElement get typeImplementation => compiler.typeClass;
167 ClassElement get boolImplementation => compiler.boolClass;
168 ClassElement get nullImplementation => compiler.nullClass;
158 } 169 }
159 170
160 /** 171 /**
161 * Key class used in [TokenMap] in which the hash code for a token is based 172 * Key class used in [TokenMap] in which the hash code for a token is based
162 * on the [charOffset]. 173 * on the [charOffset].
163 */ 174 */
164 class TokenKey { 175 class TokenKey {
165 final Token token; 176 final Token token;
166 TokenKey(this.token); 177 TokenKey(this.token);
167 int get hashCode => token.charOffset; 178 int get hashCode => token.charOffset;
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 ClassElement boolClass; 269 ClassElement boolClass;
259 ClassElement numClass; 270 ClassElement numClass;
260 ClassElement intClass; 271 ClassElement intClass;
261 ClassElement doubleClass; 272 ClassElement doubleClass;
262 ClassElement stringClass; 273 ClassElement stringClass;
263 ClassElement functionClass; 274 ClassElement functionClass;
264 ClassElement nullClass; 275 ClassElement nullClass;
265 ClassElement listClass; 276 ClassElement listClass;
266 ClassElement typeClass; 277 ClassElement typeClass;
267 ClassElement mapClass; 278 ClassElement mapClass;
268 ClassElement mapLiteralClass;
269 ClassElement jsInvocationMirrorClass; 279 ClassElement jsInvocationMirrorClass;
270 /// Document class from dart:mirrors. 280 /// Document class from dart:mirrors.
271 ClassElement documentClass; 281 ClassElement documentClass;
272 Element assertMethod; 282 Element assertMethod;
273 Element identicalFunction; 283 Element identicalFunction;
274 Element functionApplyMethod; 284 Element functionApplyMethod;
275 Element invokeOnMethod; 285 Element invokeOnMethod;
276 Element createInvocationMirrorElement; 286 Element createInvocationMirrorElement;
277 287
278 Element get currentElement => _currentElement; 288 Element get currentElement => _currentElement;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 const SourceString('startRootIsolate'); 347 const SourceString('startRootIsolate');
338 bool enabledNoSuchMethod = false; 348 bool enabledNoSuchMethod = false;
339 bool enabledRuntimeType = false; 349 bool enabledRuntimeType = false;
340 bool enabledFunctionApply = false; 350 bool enabledFunctionApply = false;
341 bool enabledInvokeOn = false; 351 bool enabledInvokeOn = false;
342 352
343 Stopwatch progress; 353 Stopwatch progress;
344 354
345 static const int PHASE_SCANNING = 0; 355 static const int PHASE_SCANNING = 0;
346 static const int PHASE_RESOLVING = 1; 356 static const int PHASE_RESOLVING = 1;
347 static const int PHASE_COMPILING = 2; 357 static const int PHASE_DONE_RESOLVING = 2;
358 static const int PHASE_COMPILING = 3;
348 int phase; 359 int phase;
349 360
350 bool compilationFailed = false; 361 bool compilationFailed = false;
351 362
352 bool hasCrashed = false; 363 bool hasCrashed = false;
353 364
354 Compiler({this.tracer: const Tracer(), 365 Compiler({this.tracer: const Tracer(),
355 this.enableTypeAssertions: false, 366 this.enableTypeAssertions: false,
356 this.enableUserAssertions: false, 367 this.enableUserAssertions: false,
357 this.enableConcreteTypeInference: false, 368 this.enableConcreteTypeInference: false,
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 objectClass = lookupCoreClass('Object'); 564 objectClass = lookupCoreClass('Object');
554 boolClass = lookupCoreClass('bool'); 565 boolClass = lookupCoreClass('bool');
555 numClass = lookupCoreClass('num'); 566 numClass = lookupCoreClass('num');
556 intClass = lookupCoreClass('int'); 567 intClass = lookupCoreClass('int');
557 doubleClass = lookupCoreClass('double'); 568 doubleClass = lookupCoreClass('double');
558 stringClass = lookupCoreClass('String'); 569 stringClass = lookupCoreClass('String');
559 functionClass = lookupCoreClass('Function'); 570 functionClass = lookupCoreClass('Function');
560 listClass = lookupCoreClass('List'); 571 listClass = lookupCoreClass('List');
561 typeClass = lookupCoreClass('Type'); 572 typeClass = lookupCoreClass('Type');
562 mapClass = lookupCoreClass('Map'); 573 mapClass = lookupCoreClass('Map');
563 // TODO: find a proper way to get to the implementation class.
564 mapLiteralClass = lookupCoreClass('LinkedHashMap');
565 if (!missingCoreClasses.isEmpty) { 574 if (!missingCoreClasses.isEmpty) {
566 internalErrorOnElement(coreLibrary, 575 internalErrorOnElement(coreLibrary,
567 'dart:core library does not contain required classes: ' 576 'dart:core library does not contain required classes: '
568 '$missingCoreClasses'); 577 '$missingCoreClasses');
569 } 578 }
570 579
571 final List missingHelperClasses = []; 580 final List missingHelperClasses = [];
572 ClassElement lookupHelperClass(String name) { 581 ClassElement lookupHelperClass(String name) {
573 ClassElement result = jsHelperLibrary.find(new SourceString(name)); 582 ClassElement result = jsHelperLibrary.find(new SourceString(name));
574 if (result == null) { 583 if (result == null) {
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
684 if (analyzeAll) { 693 if (analyzeAll) {
685 libraries.forEach((_, lib) => fullyEnqueueLibrary(lib)); 694 libraries.forEach((_, lib) => fullyEnqueueLibrary(lib));
686 } 695 }
687 backend.enqueueHelpers(enqueuer.resolution); 696 backend.enqueueHelpers(enqueuer.resolution);
688 processQueue(enqueuer.resolution, main); 697 processQueue(enqueuer.resolution, main);
689 enqueuer.resolution.logSummary(log); 698 enqueuer.resolution.logSummary(log);
690 699
691 if (compilationFailed) return; 700 if (compilationFailed) return;
692 if (analyzeOnly) return; 701 if (analyzeOnly) return;
693 assert(main != null); 702 assert(main != null);
703 phase = PHASE_DONE_RESOLVING;
694 704
695 // TODO(ahe): Remove this line. Eventually, enqueuer.resolution 705 // TODO(ahe): Remove this line. Eventually, enqueuer.resolution
696 // should know this. 706 // should know this.
697 world.populate(); 707 world.populate();
698 708
699 log('Inferring types...'); 709 log('Inferring types...');
700 typesTask.onResolutionComplete(main); 710 typesTask.onResolutionComplete(main);
701 711
702 log('Compiling...'); 712 log('Compiling...');
703 phase = PHASE_COMPILING; 713 phase = PHASE_COMPILING;
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
1171 1181
1172 void close() {} 1182 void close() {}
1173 1183
1174 toString() => name; 1184 toString() => name;
1175 1185
1176 /// Convenience method for getting an [api.CompilerOutputProvider]. 1186 /// Convenience method for getting an [api.CompilerOutputProvider].
1177 static NullSink outputProvider(String name, String extension) { 1187 static NullSink outputProvider(String name, String extension) {
1178 return new NullSink('$name.$extension'); 1188 return new NullSink('$name.$extension');
1179 } 1189 }
1180 } 1190 }
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/js_backend/backend.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698