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

Side by Side Diff: pkg/compiler/lib/src/js_backend/backend.dart

Issue 753113002: Encode super calls via extra properties on prototypes. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Incremental Compilation Support restored. Created 6 years 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 part of js_backend; 5 part of js_backend;
6 6
7 const VERBOSE_OPTIMIZER_HINTS = false; 7 const VERBOSE_OPTIMIZER_HINTS = false;
8 8
9 const bool USE_CPS_IR = const bool.fromEnvironment("USE_CPS_IR"); 9 const bool USE_CPS_IR = const bool.fromEnvironment("USE_CPS_IR");
10 10
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 * (unintercepted) classes. 324 * (unintercepted) classes.
325 */ 325 */
326 final Set<ClassElement> classesMixedIntoInterceptedClasses = 326 final Set<ClassElement> classesMixedIntoInterceptedClasses =
327 new Set<ClassElement>(); 327 new Set<ClassElement>();
328 328
329 /** 329 /**
330 * Set of classes whose `operator ==` methods handle `null` themselves. 330 * Set of classes whose `operator ==` methods handle `null` themselves.
331 */ 331 */
332 final Set<ClassElement> specialOperatorEqClasses = new Set<ClassElement>(); 332 final Set<ClassElement> specialOperatorEqClasses = new Set<ClassElement>();
333 333
334 /**
335 * A set of members that are called from subclasses via `super`.
336 */
337 final Set<FunctionElement> aliasedSuperMembers =
338 new Setlet<FunctionElement>();
339
334 List<CompilerTask> get tasks { 340 List<CompilerTask> get tasks {
335 List<CompilerTask> result = functionCompiler.tasks; 341 List<CompilerTask> result = functionCompiler.tasks;
336 result.add(emitter); 342 result.add(emitter);
337 result.add(patchResolverTask); 343 result.add(patchResolverTask);
338 return result; 344 return result;
339 } 345 }
340 346
341 final RuntimeTypes rti; 347 final RuntimeTypes rti;
342 348
343 /// Holds the method "disableTreeShaking" in js_mirrors when 349 /// Holds the method "disableTreeShaking" in js_mirrors when
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 String registerOneShotInterceptor(Selector selector) { 547 String registerOneShotInterceptor(Selector selector) {
542 Set<ClassElement> classes = getInterceptedClassesOn(selector.name); 548 Set<ClassElement> classes = getInterceptedClassesOn(selector.name);
543 String name = namer.getOneShotInterceptorName(selector, classes); 549 String name = namer.getOneShotInterceptorName(selector, classes);
544 if (!oneShotInterceptors.containsKey(name)) { 550 if (!oneShotInterceptors.containsKey(name)) {
545 registerSpecializedGetInterceptor(classes); 551 registerSpecializedGetInterceptor(classes);
546 oneShotInterceptors[name] = selector; 552 oneShotInterceptors[name] = selector;
547 } 553 }
548 return name; 554 return name;
549 } 555 }
550 556
557 /**
558 * Record that [method] is called from a subclass via `super`.
559 */
560 void registerAliasedSuperMember(FunctionElement method) {
561 aliasedSuperMembers.add(method);
562 }
563
564 /**
565 * Returns `true` if [member] is called from a subclass via `super`.
566 */
567 bool isAliasedSuperMember(FunctionElement member) {
568 return aliasedSuperMembers.contains(member);
569 }
570
551 bool isInterceptedMethod(Element element) { 571 bool isInterceptedMethod(Element element) {
552 if (!element.isInstanceMember) return false; 572 if (!element.isInstanceMember) return false;
553 if (element.isGenerativeConstructorBody) { 573 if (element.isGenerativeConstructorBody) {
554 return Elements.isNativeOrExtendsNative(element.enclosingClass); 574 return Elements.isNativeOrExtendsNative(element.enclosingClass);
555 } 575 }
556 return interceptedElements[element.name] != null; 576 return interceptedElements[element.name] != null;
557 } 577 }
558 578
559 bool fieldHasInterceptedGetter(Element element) { 579 bool fieldHasInterceptedGetter(Element element) {
560 assert(element.isField); 580 assert(element.isField);
(...skipping 1691 matching lines...) Expand 10 before | Expand all | Expand 10 after
2252 2272
2253 FunctionElement helperForMissingMain() => findHelper('missingMain'); 2273 FunctionElement helperForMissingMain() => findHelper('missingMain');
2254 2274
2255 FunctionElement helperForMainArity() { 2275 FunctionElement helperForMainArity() {
2256 return findHelper('mainHasTooManyParameters'); 2276 return findHelper('mainHasTooManyParameters');
2257 } 2277 }
2258 2278
2259 void forgetElement(Element element) { 2279 void forgetElement(Element element) {
2260 constants.forgetElement(element); 2280 constants.forgetElement(element);
2261 constantCompilerTask.dartConstantCompiler.forgetElement(element); 2281 constantCompilerTask.dartConstantCompiler.forgetElement(element);
2282 aliasedSuperMembers.remove(element);
2262 } 2283 }
2263 2284
2264 void registerMainHasArguments(Enqueuer enqueuer) { 2285 void registerMainHasArguments(Enqueuer enqueuer) {
2265 // If the main method takes arguments, this compilation could be the target 2286 // If the main method takes arguments, this compilation could be the target
2266 // of Isolate.spawnUri. Strictly speaking, that can happen also if main 2287 // of Isolate.spawnUri. Strictly speaking, that can happen also if main
2267 // takes no arguments, but in this case the spawned isolate can't 2288 // takes no arguments, but in this case the spawned isolate can't
2268 // communicate with the spawning isolate. 2289 // communicate with the spawning isolate.
2269 enqueuer.enableIsolateSupport(); 2290 enqueuer.enableIsolateSupport();
2270 } 2291 }
2271 } 2292 }
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
2467 } 2488 }
2468 } 2489 }
2469 2490
2470 /// Records that [constant] is used by the element behind [registry]. 2491 /// Records that [constant] is used by the element behind [registry].
2471 class Dependency { 2492 class Dependency {
2472 final ConstantValue constant; 2493 final ConstantValue constant;
2473 final Element annotatedElement; 2494 final Element annotatedElement;
2474 2495
2475 const Dependency(this.constant, this.annotatedElement); 2496 const Dependency(this.constant, this.annotatedElement);
2476 } 2497 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/js_backend/namer.dart » ('j') | pkg/compiler/lib/src/js_emitter/old_emitter/emitter.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698