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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/universe/universe.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
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 library universe; 5 library universe;
6 6
7 import '../closure.dart'; 7 import '../closure.dart';
8 import '../elements/elements.dart'; 8 import '../elements/elements.dart';
9 import '../dart2jslib.dart'; 9 import '../dart2jslib.dart';
10 import '../dart_types.dart'; 10 import '../dart_types.dart';
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 /** 477 /**
478 * Check if [element] will be the one used at runtime when being 478 * Check if [element] will be the one used at runtime when being
479 * invoked on an instance of [cls]. 479 * invoked on an instance of [cls].
480 */ 480 */
481 bool hasElementIn(ClassElement cls, Element element) { 481 bool hasElementIn(ClassElement cls, Element element) {
482 return cls.lookupSelector(this) == element; 482 return cls.lookupSelector(this) == element;
483 } 483 }
484 484
485 bool appliesUnnamed(Element element, Compiler compiler) { 485 bool appliesUnnamed(Element element, Compiler compiler) {
486 assert(sameNameHack(element, compiler)); 486 assert(sameNameHack(element, compiler));
487 // [TypedSelector] are only used when compiling.
488 assert(compiler.phase == Compiler.PHASE_COMPILING);
kasperl 2013/03/07 14:09:17 Maybe check that we're after resolution?
ngeoffray 2013/03/08 11:32:37 Done.
489 if (!element.isMember()) return false; 487 if (!element.isMember()) return false;
490 488
491 // A closure can be called through any typed selector: 489 // A closure can be called through any typed selector:
492 // class A { 490 // class A {
493 // get foo => () => 42; 491 // get foo => () => 42;
494 // bar() => foo(); // The call to 'foo' is a typed selector. 492 // bar() => foo(); // The call to 'foo' is a typed selector.
495 // } 493 // }
496 ClassElement other = element.getEnclosingClass(); 494 ClassElement other = element.getEnclosingClass();
497 if (identical(other.superclass, compiler.closureClass)) { 495 if (identical(other.superclass, compiler.closureClass)) {
498 return appliesUntyped(element, compiler); 496 return appliesUntyped(element, compiler);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 ClassElement cls = self; 528 ClassElement cls = self;
531 if (cls.isSubclassOf(other)) { 529 if (cls.isSubclassOf(other)) {
532 // Resolve an invocation of [element.name] on [self]. If it 530 // Resolve an invocation of [element.name] on [self]. If it
533 // is found, this selector is a candidate. 531 // is found, this selector is a candidate.
534 return hasElementIn(cls, element) && appliesUntyped(element, compiler); 532 return hasElementIn(cls, element) && appliesUntyped(element, compiler);
535 } 533 }
536 } 534 }
537 return false; 535 return false;
538 } 536 }
539 } 537 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698