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

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

Issue 743383002: Redo "Revert "Encode super calls via extra properties on prototypes."" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month 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 | pkg/compiler/lib/src/js_backend/minify_namer.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 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
340 List<CompilerTask> get tasks { 334 List<CompilerTask> get tasks {
341 List<CompilerTask> result = functionCompiler.tasks; 335 List<CompilerTask> result = functionCompiler.tasks;
342 result.add(emitter); 336 result.add(emitter);
343 return result; 337 return result;
344 } 338 }
345 339
346 final RuntimeTypes rti; 340 final RuntimeTypes rti;
347 341
348 /// Holds the method "disableTreeShaking" in js_mirrors when 342 /// Holds the method "disableTreeShaking" in js_mirrors when
349 /// dart:mirrors has been loaded. 343 /// dart:mirrors has been loaded.
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 String registerOneShotInterceptor(Selector selector) { 531 String registerOneShotInterceptor(Selector selector) {
538 Set<ClassElement> classes = getInterceptedClassesOn(selector.name); 532 Set<ClassElement> classes = getInterceptedClassesOn(selector.name);
539 String name = namer.getOneShotInterceptorName(selector, classes); 533 String name = namer.getOneShotInterceptorName(selector, classes);
540 if (!oneShotInterceptors.containsKey(name)) { 534 if (!oneShotInterceptors.containsKey(name)) {
541 registerSpecializedGetInterceptor(classes); 535 registerSpecializedGetInterceptor(classes);
542 oneShotInterceptors[name] = selector; 536 oneShotInterceptors[name] = selector;
543 } 537 }
544 return name; 538 return name;
545 } 539 }
546 540
547 /**
548 * Record that [method] is called from a subclass via `super`.
549 */
550 void registerAliasedSuperMember(FunctionElement method) {
551 aliasedSuperMembers.add(method);
552 }
553
554 /**
555 * Returns `true` is [member] is called from a subclass via `super`.
556 */
557 bool isAliasedSuperMember(FunctionElement member) {
558 return aliasedSuperMembers.contains(member);
559 }
560
561 bool isInterceptedMethod(Element element) { 541 bool isInterceptedMethod(Element element) {
562 if (!element.isInstanceMember) return false; 542 if (!element.isInstanceMember) return false;
563 if (element.isGenerativeConstructorBody) { 543 if (element.isGenerativeConstructorBody) {
564 return Elements.isNativeOrExtendsNative(element.enclosingClass); 544 return Elements.isNativeOrExtendsNative(element.enclosingClass);
565 } 545 }
566 return interceptedElements[element.name] != null; 546 return interceptedElements[element.name] != null;
567 } 547 }
568 548
569 bool fieldHasInterceptedGetter(Element element) { 549 bool fieldHasInterceptedGetter(Element element) {
570 assert(element.isField); 550 assert(element.isField);
(...skipping 1683 matching lines...) Expand 10 before | Expand all | Expand 10 after
2254 2234
2255 FunctionElement helperForMissingMain() => findHelper('missingMain'); 2235 FunctionElement helperForMissingMain() => findHelper('missingMain');
2256 2236
2257 FunctionElement helperForMainArity() { 2237 FunctionElement helperForMainArity() {
2258 return findHelper('mainHasTooManyParameters'); 2238 return findHelper('mainHasTooManyParameters');
2259 } 2239 }
2260 2240
2261 void forgetElement(Element element) { 2241 void forgetElement(Element element) {
2262 constants.forgetElement(element); 2242 constants.forgetElement(element);
2263 constantCompilerTask.dartConstantCompiler.forgetElement(element); 2243 constantCompilerTask.dartConstantCompiler.forgetElement(element);
2264 aliasedSuperMembers.remove(element);
2265 } 2244 }
2266 2245
2267 void registerMainHasArguments(Enqueuer enqueuer) { 2246 void registerMainHasArguments(Enqueuer enqueuer) {
2268 // If the main method takes arguments, this compilation could be the target 2247 // If the main method takes arguments, this compilation could be the target
2269 // of Isolate.spawnUri. Strictly speaking, that can happen also if main 2248 // of Isolate.spawnUri. Strictly speaking, that can happen also if main
2270 // takes no arguments, but in this case the spawned isolate can't 2249 // takes no arguments, but in this case the spawned isolate can't
2271 // communicate with the spawning isolate. 2250 // communicate with the spawning isolate.
2272 enqueuer.enableIsolateSupport(); 2251 enqueuer.enableIsolateSupport();
2273 } 2252 }
2274 } 2253 }
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
2470 } 2449 }
2471 } 2450 }
2472 2451
2473 /// Records that [constant] is used by the element behind [registry]. 2452 /// Records that [constant] is used by the element behind [registry].
2474 class Dependency { 2453 class Dependency {
2475 final ConstantValue constant; 2454 final ConstantValue constant;
2476 final Element annotatedElement; 2455 final Element annotatedElement;
2477 2456
2478 const Dependency(this.constant, this.annotatedElement); 2457 const Dependency(this.constant, this.annotatedElement);
2479 } 2458 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/js_backend/minify_namer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698