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

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

Issue 861733002: Do not use full substitution when only computing single type variables. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 11 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 class ClassEmitter extends CodeEmitterHelper { 7 class ClassEmitter extends CodeEmitterHelper {
8 8
9 ClassStubGenerator get _stubGenerator => 9 ClassStubGenerator get _stubGenerator =>
10 new ClassStubGenerator(compiler, namer, backend); 10 new ClassStubGenerator(compiler, namer, backend);
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 } 594 }
595 } 595 }
596 superclass = superclass.superclass; 596 superclass = superclass.superclass;
597 } 597 }
598 } 598 }
599 599
600 void emitTypeVariableReader(ClassElement cls, 600 void emitTypeVariableReader(ClassElement cls,
601 ClassBuilder builder, 601 ClassBuilder builder,
602 TypeVariableElement element) { 602 TypeVariableElement element) {
603 String name = namer.readTypeVariableName(element); 603 String name = namer.readTypeVariableName(element);
604 jsAst.Expression index = 604 int index = RuntimeTypes.getTypeVariableIndex(element);
605 js.number(RuntimeTypes.getTypeVariableIndex(element));
606 jsAst.Expression computeTypeVariable; 605 jsAst.Expression computeTypeVariable;
607 606
608 Substitution substitution = 607 Substitution substitution =
609 backend.rti.computeSubstitution( 608 backend.rti.computeSubstitution(
610 cls, element.typeDeclaration, alwaysGenerateFunction: true); 609 cls, element.typeDeclaration, alwaysGenerateFunction: true);
611 if (substitution != null) { 610 if (substitution != null) {
612 jsAst.Expression typeArguments = 611 computeTypeVariable =
613 js(r'#.apply(null, this.$builtinTypeInfo)', 612 js(r'#(this.$builtinTypeInfo)',
614 substitution.getCode(backend.rti)); 613 substitution.getCodeForVariable(index, backend.rti));
615 computeTypeVariable = js('#[#]', [typeArguments, index]);
616 } else { 614 } else {
617 // TODO(ahe): These can be generated dynamically. 615 // TODO(ahe): These can be generated dynamically.
618 computeTypeVariable = 616 computeTypeVariable =
619 js(r'this.$builtinTypeInfo && this.$builtinTypeInfo[#]', index); 617 js(r'this.$builtinTypeInfo && this.$builtinTypeInfo[#]',
618 js.number(index));
620 } 619 }
621 jsAst.Expression convertRtiToRuntimeType = emitter 620 jsAst.Expression convertRtiToRuntimeType = emitter
622 .staticFunctionAccess(backend.findHelper('convertRtiToRuntimeType')); 621 .staticFunctionAccess(backend.findHelper('convertRtiToRuntimeType'));
623 compiler.dumpInfoTask.registerElementAst(element, 622 compiler.dumpInfoTask.registerElementAst(element,
624 builder.addProperty(name, 623 builder.addProperty(name,
625 js('function () { return #(#) }', 624 js('function () { return #(#) }',
626 [convertRtiToRuntimeType, computeTypeVariable]))); 625 [convertRtiToRuntimeType, computeTypeVariable])));
627 } 626 }
628 } 627 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_backend/runtime_types.dart ('k') | pkg/compiler/lib/src/js_emitter/old_emitter/emitter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698