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

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

Issue 957973006: dart2js: don't emit unneeded native info. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed comments. Created 5 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) 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 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 }() 449 }()
450 """, { 'operatorIsPrefix' : js.string(namer.operatorIsPrefix), 450 """, { 'operatorIsPrefix' : js.string(namer.operatorIsPrefix),
451 'isObject' : namer.operatorIs(compiler.objectClass) }); 451 'isObject' : namer.operatorIs(compiler.objectClass) });
452 if (compiler.hasIncrementalSupport) { 452 if (compiler.hasIncrementalSupport) {
453 result = js( 453 result = js(
454 r'#.inheritFrom = #', [namer.accessIncrementalHelper, result]); 454 r'#.inheritFrom = #', [namer.accessIncrementalHelper, result]);
455 } 455 }
456 return js(r'var inheritFrom = #', [result]); 456 return js(r'var inheritFrom = #', [result]);
457 } 457 }
458 458
459 jsAst.Statement buildFinishClass(bool hasNativeClasses) { 459 jsAst.Statement buildFinishClass(bool needsNativeSupport) {
460 String specProperty = '"${namer.nativeSpecProperty}"'; // "%" 460 String specProperty = '"${namer.nativeSpecProperty}"'; // "%"
461 461
462 jsAst.Expression finishedClassesAccess = 462 jsAst.Expression finishedClassesAccess =
463 generateEmbeddedGlobalAccess(embeddedNames.FINISHED_CLASSES); 463 generateEmbeddedGlobalAccess(embeddedNames.FINISHED_CLASSES);
464 464
465 jsAst.Expression nativeInfoAccess = js('prototype[$specProperty]', []); 465 jsAst.Expression nativeInfoAccess = js('prototype[$specProperty]', []);
466 jsAst.Expression constructorAccess = js('constructor', []); 466 jsAst.Expression constructorAccess = js('constructor', []);
467 Function subclassReadGenerator = 467 Function subclassReadGenerator =
468 (jsAst.Expression subclass) => js('allClasses[#]', subclass); 468 (jsAst.Expression subclass) => js('allClasses[#]', subclass);
469 jsAst.Expression interceptorsByTagAccess = 469 jsAst.Expression interceptorsByTagAccess =
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 } 517 }
518 finishClass(superclass); 518 finishClass(superclass);
519 var superConstructor = allClasses[superclass]; 519 var superConstructor = allClasses[superclass];
520 520
521 if (!superConstructor) 521 if (!superConstructor)
522 superConstructor = existingIsolateProperties[superclass]; 522 superConstructor = existingIsolateProperties[superclass];
523 523
524 var constructor = allClasses[cls]; 524 var constructor = allClasses[cls];
525 var prototype = inheritFrom(constructor, superConstructor); 525 var prototype = inheritFrom(constructor, superConstructor);
526 526
527 if (#hasNativeClasses) 527 if (#needsNativeSupport)
528 if (Object.prototype.hasOwnProperty.call(prototype, $specProperty)) 528 if (Object.prototype.hasOwnProperty.call(prototype, $specProperty))
529 #nativeInfoHandler 529 #nativeInfoHandler
530 } 530 }
531 }''', {'finishedClassesAccess': finishedClassesAccess, 531 }''', {'finishedClassesAccess': finishedClassesAccess,
532 'needsMixinSupport': needsMixinSupport, 532 'needsMixinSupport': needsMixinSupport,
533 'hasNativeClasses': hasNativeClasses, 533 'needsNativeSupport': needsNativeSupport,
534 'nativeInfoHandler': nativeInfoHandler}); 534 'nativeInfoHandler': nativeInfoHandler});
535 } 535 }
536 536
537 void emitFinishIsolateConstructorInvocation(CodeOutput output) { 537 void emitFinishIsolateConstructorInvocation(CodeOutput output) {
538 String isolate = namer.isolateName; 538 String isolate = namer.isolateName;
539 output.add("$isolate = $finishIsolateConstructorName($isolate)$N"); 539 output.add("$isolate = $finishIsolateConstructorName($isolate)$N");
540 } 540 }
541 541
542 /// In minified mode we want to keep the name for the most common core types. 542 /// In minified mode we want to keep the name for the most common core types.
543 bool _isNativeTypeNeedingReflectionName(Element element) { 543 bool _isNativeTypeNeedingReflectionName(Element element) {
(...skipping 867 matching lines...) Expand 10 before | Expand all | Expand 10 after
1411 emitMangledNames(mainOutput); 1411 emitMangledNames(mainOutput);
1412 1412
1413 checkEverythingEmitted(elementDescriptors.keys); 1413 checkEverythingEmitted(elementDescriptors.keys);
1414 1414
1415 CodeBuffer libraryBuffer = new CodeBuffer(); 1415 CodeBuffer libraryBuffer = new CodeBuffer();
1416 for (LibraryElement library in Elements.sortedByPosition(libraries)) { 1416 for (LibraryElement library in Elements.sortedByPosition(libraries)) {
1417 writeLibraryDescriptors(libraryBuffer, library); 1417 writeLibraryDescriptors(libraryBuffer, library);
1418 elementDescriptors.remove(library); 1418 elementDescriptors.remove(library);
1419 } 1419 }
1420 1420
1421 bool hasNativeClasses = program.outputContainsNativeClasses; 1421 bool needsNativeSupport = program.needsNativeSupport;
1422 mainOutput 1422 mainOutput
1423 ..addBuffer( 1423 ..addBuffer(
1424 jsAst.prettyPrint( 1424 jsAst.prettyPrint(
1425 getReflectionDataParser(this, backend, hasNativeClasses), 1425 getReflectionDataParser(this, backend, needsNativeSupport),
1426 compiler)) 1426 compiler))
1427 ..add(n); 1427 ..add(n);
1428 1428
1429 // The argument to reflectionDataParser is assigned to a temporary 'dart' 1429 // The argument to reflectionDataParser is assigned to a temporary 'dart'
1430 // so that 'dart.' will appear as the prefix to dart methods in stack 1430 // so that 'dart.' will appear as the prefix to dart methods in stack
1431 // traces and profile entries. 1431 // traces and profile entries.
1432 mainOutput..add('var dart = [$n') 1432 mainOutput..add('var dart = [$n')
1433 ..addBuffer(libraryBuffer) 1433 ..addBuffer(libraryBuffer)
1434 ..add(']$N') 1434 ..add(']$N')
1435 ..add('$parseReflectionDataName(dart)$N'); 1435 ..add('$parseReflectionDataName(dart)$N');
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after
2001 for (Element element in compiler.enqueuer.codegen.newlyEnqueuedElements) { 2001 for (Element element in compiler.enqueuer.codegen.newlyEnqueuedElements) {
2002 if (element.isInstanceMember) { 2002 if (element.isInstanceMember) {
2003 cachedClassBuilders.remove(element.enclosingClass); 2003 cachedClassBuilders.remove(element.enclosingClass);
2004 2004
2005 nativeEmitter.cachedBuilders.remove(element.enclosingClass); 2005 nativeEmitter.cachedBuilders.remove(element.enclosingClass);
2006 2006
2007 } 2007 }
2008 } 2008 }
2009 } 2009 }
2010 } 2010 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698