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

Side by Side Diff: pkg/compiler/lib/src/js_emitter/old_emitter/emitter.dart

Issue 727403002: Only emit support for aliasing methods if super calls are present. (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 | no next file » | 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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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; 5 part of dart2js.js_emitter;
6 6
7 7
8 class OldEmitter implements Emitter { 8 class OldEmitter implements Emitter {
9 final Compiler compiler; 9 final Compiler compiler;
10 final CodeEmitterTask task; 10 final CodeEmitterTask task;
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 # = Object.create(null); // embedded leafTags. 348 # = Object.create(null); // embedded leafTags.
349 # = Object.create(null); // embedded finishedClasses 349 # = Object.create(null); // embedded finishedClasses
350 })() 350 })()
351 ''', [allClassesAccess, 351 ''', [allClassesAccess,
352 interceptorsByTagAccess, 352 interceptorsByTagAccess,
353 leafTagsAccess, 353 leafTagsAccess,
354 finishedClassesAccess]); 354 finishedClassesAccess]);
355 } 355 }
356 356
357 List buildSplitOffAliases() { 357 List buildSplitOffAliases() {
358 if (backend.aliasedSuperMembers.isEmpty) return [];
358 return [js(r''' 359 return [js(r'''
359 var splitOffAliases = function(constructor) { 360 var splitOffAliases = function(constructor) {
360 var hasOwnProperty = Object.prototype.hasOwnProperty; 361 var hasOwnProperty = Object.prototype.hasOwnProperty;
361 var properties = constructor.prototype; 362 var properties = constructor.prototype;
362 for (var member in properties) { 363 for (var member in properties) {
363 if (hasOwnProperty.call(properties, member)) { 364 if (hasOwnProperty.call(properties, member)) {
364 var s = member.split(':'); 365 var s = member.split(':');
365 if (s.length > 1) { 366 if (s.length > 1) {
366 properties[s[0]] = properties[s[1]] = properties[member]; 367 properties[s[0]] = properties[s[1]] = properties[member];
367 delete properties[member]; 368 delete properties[member];
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 function finishClass(cls) { 537 function finishClass(cls) {
537 538
538 if (finishedClasses[cls]) return; 539 if (finishedClasses[cls]) return;
539 finishedClasses[cls] = true; 540 finishedClasses[cls] = true;
540 541
541 var superclass = pendingClasses[cls]; 542 var superclass = pendingClasses[cls];
542 var constructor = allClasses[cls]; 543 var constructor = allClasses[cls];
543 544
544 // Process aliased members due to super calls. We have to do this early 545 // Process aliased members due to super calls. We have to do this early
545 // to ensure that we also hit the object class. 546 // to ensure that we also hit the object class.
546 splitOffAliases(constructor); 547 if (#) splitOffAliases(constructor);
547 548
548 // The superclass is only false (empty string) for the Dart Object 549 // The superclass is only false (empty string) for the Dart Object
549 // class. The minifier together with noSuchMethod can put methods on 550 // class. The minifier together with noSuchMethod can put methods on
550 // the Object.prototype object, and they show through here, so we check 551 // the Object.prototype object, and they show through here, so we check
551 // that we have a string. 552 // that we have a string.
552 if (!superclass || typeof superclass != "string") return; 553 if (!superclass || typeof superclass != "string") return;
553 finishClass(superclass); 554 finishClass(superclass);
554 var superConstructor = allClasses[superclass]; 555 var superConstructor = allClasses[superclass];
555 556
556 if (!superConstructor) 557 if (!superConstructor)
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
602 for (i = 0; i < tags.length; i++) { 603 for (i = 0; i < tags.length; i++) {
603 #[tags[i]] = constructor; // embedded interceptorsByTag. 604 #[tags[i]] = constructor; // embedded interceptorsByTag.
604 #[tags[i]] = false; // embedded leafTags. 605 #[tags[i]] = false; // embedded leafTags.
605 } 606 }
606 } 607 }
607 } 608 }
608 } 609 }
609 } 610 }
610 } 611 }
611 }''', [finishedClassesAccess, 612 }''', [finishedClassesAccess,
613 backend.aliasedSuperMembers.isNotEmpty,
612 !nativeClasses.isEmpty, 614 !nativeClasses.isEmpty,
613 interceptorsByTagAccess, 615 interceptorsByTagAccess,
614 leafTagsAccess, 616 leafTagsAccess,
615 true, 617 true,
616 interceptorsByTagAccess, 618 interceptorsByTagAccess,
617 leafTagsAccess]); 619 leafTagsAccess]);
618 } 620 }
619 621
620 jsAst.Fun get finishIsolateConstructorFunction { 622 jsAst.Fun get finishIsolateConstructorFunction {
621 // We replace the old Isolate function with a new one that initializes 623 // We replace the old Isolate function with a new one that initializes
(...skipping 1387 matching lines...) Expand 10 before | Expand all | Expand 10 after
2009 for (Element element in compiler.enqueuer.codegen.newlyEnqueuedElements) { 2011 for (Element element in compiler.enqueuer.codegen.newlyEnqueuedElements) {
2010 if (element.isInstanceMember) { 2012 if (element.isInstanceMember) {
2011 cachedClassBuilders.remove(element.enclosingClass); 2013 cachedClassBuilders.remove(element.enclosingClass);
2012 2014
2013 nativeEmitter.cachedBuilders.remove(element.enclosingClass); 2015 nativeEmitter.cachedBuilders.remove(element.enclosingClass);
2014 2016
2015 } 2017 }
2016 } 2018 }
2017 } 2019 }
2018 } 2020 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698