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

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

Issue 885093002: dart2js: Fix types in new emitter. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix more types. Created 5 years, 10 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
« no previous file with comments | « pkg/compiler/lib/src/js_emitter/new_emitter/model_emitter.dart ('k') | 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 library dart2js.js_emitter.program_builder; 5 library dart2js.js_emitter.program_builder;
6 6
7 import 'js_emitter.dart' show computeMixinClass; 7 import 'js_emitter.dart' show computeMixinClass;
8 import 'model.dart'; 8 import 'model.dart';
9 9
10 import '../common.dart'; 10 import '../common.dart';
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 Map<String, Set<ClassElement>> specializedGetInterceptors = 472 Map<String, Set<ClassElement>> specializedGetInterceptors =
473 backend.specializedGetInterceptors; 473 backend.specializedGetInterceptors;
474 for (Set<ClassElement> classes in specializedGetInterceptors.values) { 474 for (Set<ClassElement> classes in specializedGetInterceptors.values) {
475 for (ClassElement element in classes) { 475 for (ClassElement element in classes) {
476 Class cls = _classes[element]; 476 Class cls = _classes[element];
477 if (cls != null) cls.isEager = true; 477 if (cls != null) cls.isEager = true;
478 } 478 }
479 } 479 }
480 } 480 }
481 481
482 Iterable<StaticMethod> _generateGetInterceptorMethods() { 482 Iterable<StaticStubMethod> _generateGetInterceptorMethods() {
483 InterceptorStubGenerator stubGenerator = 483 InterceptorStubGenerator stubGenerator =
484 new InterceptorStubGenerator(_compiler, namer, backend); 484 new InterceptorStubGenerator(_compiler, namer, backend);
485 485
486 String holderName = namer.globalObjectFor(backend.interceptorsLibrary); 486 String holderName = namer.globalObjectFor(backend.interceptorsLibrary);
487 Holder holder = _registry.registerHolder(holderName); 487 Holder holder = _registry.registerHolder(holderName);
488 488
489 Map<String, Set<ClassElement>> specializedGetInterceptors = 489 Map<String, Set<ClassElement>> specializedGetInterceptors =
490 backend.specializedGetInterceptors; 490 backend.specializedGetInterceptors;
491 List<String> names = specializedGetInterceptors.keys.toList()..sort(); 491 List<String> names = specializedGetInterceptors.keys.toList()..sort();
492 return names.map((String name) { 492 return names.map((String name) {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 } 535 }
536 536
537 fields.add(new Field(field, name, accessorName, 537 fields.add(new Field(field, name, accessorName,
538 getterFlags, setterFlags, 538 getterFlags, setterFlags,
539 needsCheckedSetter)); 539 needsCheckedSetter));
540 }); 540 });
541 541
542 return fields; 542 return fields;
543 } 543 }
544 544
545 Iterable<StaticMethod> _generateOneShotInterceptors() { 545 Iterable<StaticStubMethod> _generateOneShotInterceptors() {
546 InterceptorStubGenerator stubGenerator = 546 InterceptorStubGenerator stubGenerator =
547 new InterceptorStubGenerator(_compiler, namer, backend); 547 new InterceptorStubGenerator(_compiler, namer, backend);
548 548
549 String holderName = namer.globalObjectFor(backend.interceptorsLibrary); 549 String holderName = namer.globalObjectFor(backend.interceptorsLibrary);
550 Holder holder = _registry.registerHolder(holderName); 550 Holder holder = _registry.registerHolder(holderName);
551 551
552 List<String> names = backend.oneShotInterceptors.keys.toList()..sort(); 552 List<String> names = backend.oneShotInterceptors.keys.toList()..sort();
553 return names.map((String name) { 553 return names.map((String name) {
554 js.Expression code = stubGenerator.generateOneShotInterceptor(name); 554 js.Expression code = stubGenerator.generateOneShotInterceptor(name);
555 return new StaticStubMethod(name, holder, code); 555 return new StaticStubMethod(name, holder, code);
556 }); 556 });
557 } 557 }
558 558
559 StaticMethod _buildStaticMethod(FunctionElement element) { 559 StaticDartMethod _buildStaticMethod(FunctionElement element) {
560 String name = namer.getNameOfMember(element); 560 String name = namer.getNameOfMember(element);
561 String holder = namer.globalObjectFor(element); 561 String holder = namer.globalObjectFor(element);
562 js.Expression code = backend.generatedCode[element]; 562 js.Expression code = backend.generatedCode[element];
563 563
564 final bool isNotApplyTarget = !element.isConstructor && !element.isAccessor; 564 final bool isNotApplyTarget = !element.isConstructor && !element.isAccessor;
565 final bool needsStubs = _methodNeedsStubs(element); 565 final bool needsStubs = _methodNeedsStubs(element);
566 final bool canBeApplied = _methodCanBeApplied(element); 566 final bool canBeApplied = _methodCanBeApplied(element);
567 final bool canBeReflected = _methodCanBeReflected(element); 567 final bool canBeReflected = _methodCanBeReflected(element);
568 568
569 final bool needsTearOff = isNotApplyTarget && (canBeReflected || 569 final bool needsTearOff = isNotApplyTarget && (canBeReflected ||
570 universe.staticFunctionsNeedingGetter.contains(element)); 570 universe.staticFunctionsNeedingGetter.contains(element));
571 571
572 final String tearOffName = 572 final String tearOffName =
573 needsTearOff ? namer.getStaticClosureName(element) : null; 573 needsTearOff ? namer.getStaticClosureName(element) : null;
574 574
575 return new StaticMethod(element, 575 return new StaticDartMethod(element,
576 name, _registry.registerHolder(holder), code, 576 name, _registry.registerHolder(holder), code,
577 needsTearOff: needsTearOff, 577 needsTearOff: needsTearOff,
578 tearOffName: tearOffName, 578 tearOffName: tearOffName,
579 canBeApplied: canBeApplied, 579 canBeApplied: canBeApplied,
580 canBeReflected: canBeReflected, 580 canBeReflected: canBeReflected,
581 needsStubs: needsStubs); 581 needsStubs: needsStubs);
582 } 582 }
583 583
584 void _registerConstants(OutputUnit outputUnit, 584 void _registerConstants(OutputUnit outputUnit,
585 Iterable<ConstantValue> constantValues) { 585 Iterable<ConstantValue> constantValues) {
586 // `constantValues` is null if an outputUnit doesn't contain any constants. 586 // `constantValues` is null if an outputUnit doesn't contain any constants.
587 if (constantValues == null) return; 587 if (constantValues == null) return;
588 for (ConstantValue constantValue in constantValues) { 588 for (ConstantValue constantValue in constantValues) {
589 _registry.registerConstant(outputUnit, constantValue); 589 _registry.registerConstant(outputUnit, constantValue);
590 assert(!_constants.containsKey(constantValue)); 590 assert(!_constants.containsKey(constantValue));
591 String name = namer.constantName(constantValue); 591 String name = namer.constantName(constantValue);
592 String constantObject = namer.globalObjectForConstant(constantValue); 592 String constantObject = namer.globalObjectForConstant(constantValue);
593 Holder holder = _registry.registerHolder(constantObject); 593 Holder holder = _registry.registerHolder(constantObject);
594 Constant constant = new Constant(name, holder, constantValue); 594 Constant constant = new Constant(name, holder, constantValue);
595 _constants[constantValue] = constant; 595 _constants[constantValue] = constant;
596 } 596 }
597 } 597 }
598 } 598 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_emitter/new_emitter/model_emitter.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698