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

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

Issue 1011403003: cps-ir: Set runtime type information for new objects that require it. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address 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 library code_generator_dependencies; 5 library code_generator_dependencies;
6 6
7 import '../js_backend.dart'; 7 import '../js_backend.dart';
8 import '../../dart2jslib.dart'; 8 import '../../dart2jslib.dart';
9 import '../../js_emitter/js_emitter.dart'; 9 import '../../js_emitter/js_emitter.dart';
10 import '../../js/js.dart' as js; 10 import '../../js/js.dart' as js;
11 import '../../constants/values.dart'; 11 import '../../constants/values.dart';
12 import '../../elements/elements.dart'; 12 import '../../elements/elements.dart';
13 import '../../constants/expressions.dart'; 13 import '../../constants/expressions.dart';
14 import '../../dart_types.dart' show TypeVariableType; 14 import '../../dart_types.dart' show DartType, TypeVariableType;
15 15
16 /// Encapsulates the dependencies of the function-compiler to the compiler, 16 /// Encapsulates the dependencies of the function-compiler to the compiler,
17 /// backend and emitter. 17 /// backend and emitter.
18 // TODO(sigurdm): Should be refactored when we have a better feeling for the 18 // TODO(sigurdm): Should be refactored when we have a better feeling for the
19 // interface. 19 // interface.
20 class Glue { 20 class Glue {
21 final Compiler _compiler; 21 final Compiler _compiler;
22 22
23 JavaScriptBackend get _backend => _compiler.backend; 23 JavaScriptBackend get _backend => _compiler.backend;
24 24
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 147
148 bool needsSubstitutionForTypeVariableAccess(ClassElement cls) { 148 bool needsSubstitutionForTypeVariableAccess(ClassElement cls) {
149 ClassWorld classWorld = _compiler.world; 149 ClassWorld classWorld = _compiler.world;
150 if (classWorld.isUsedAsMixin(cls)) return true; 150 if (classWorld.isUsedAsMixin(cls)) return true;
151 151
152 Iterable<ClassElement> subclasses = _compiler.world.strictSubclassesOf(cls); 152 Iterable<ClassElement> subclasses = _compiler.world.strictSubclassesOf(cls);
153 return subclasses.any((ClassElement subclass) { 153 return subclasses.any((ClassElement subclass) {
154 return !_backend.rti.isTrivialSubstitution(subclass, cls); 154 return !_backend.rti.isTrivialSubstitution(subclass, cls);
155 }); 155 });
156 } 156 }
157
158 FunctionElement getAddRuntimeTypeInformation() {
159 return _backend.getSetRuntimeTypeInfo();
160 }
161
162 js.Expression generateTypeRepresentation(DartType dartType,
163 List<js.Expression> arguments) {
164 int variableIndex = 0;
165 js.Expression representation = _backend.rti.getTypeRepresentation(
166 dartType,
167 (_) => arguments[variableIndex++]);
168 assert(variableIndex == arguments.length);
169 return representation;
170 }
157 } 171 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_backend/codegen/codegen.dart ('k') | pkg/compiler/lib/src/js_backend/codegen/js_tree_builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698