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

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

Issue 1394213002: Split RuntimesTypes into RuntimeTypes and RuntimeTypesEncoder (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments. Created 5 years, 2 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
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 '../../common/registry.dart' show 8 import '../../common/registry.dart' show
9 Registry; 9 Registry;
10 import '../../common/codegen.dart' show 10 import '../../common/codegen.dart' show
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 /// subtypeOfRuntimeTypeCast(value, runtimeType) 220 /// subtypeOfRuntimeTypeCast(value, runtimeType)
221 FunctionElement getSubtypeOfRuntimeTypeCast() { 221 FunctionElement getSubtypeOfRuntimeTypeCast() {
222 return _backend.getSubtypeOfRuntimeTypeCast(); 222 return _backend.getSubtypeOfRuntimeTypeCast();
223 } 223 }
224 224
225 js.Expression getRuntimeTypeName(ClassElement cls) { 225 js.Expression getRuntimeTypeName(ClassElement cls) {
226 return js.quoteName(_namer.runtimeTypeName(cls)); 226 return js.quoteName(_namer.runtimeTypeName(cls));
227 } 227 }
228 228
229 int getTypeVariableIndex(TypeVariableType variable) { 229 int getTypeVariableIndex(TypeVariableType variable) {
230 return RuntimeTypes.getTypeVariableIndex(variable.element); 230 return variable.element.index;
231 } 231 }
232 232
233 bool needsSubstitutionForTypeVariableAccess(ClassElement cls) { 233 bool needsSubstitutionForTypeVariableAccess(ClassElement cls) {
234 ClassWorld classWorld = _compiler.world; 234 ClassWorld classWorld = _compiler.world;
235 if (classWorld.isUsedAsMixin(cls)) return true; 235 if (classWorld.isUsedAsMixin(cls)) return true;
236 236
237 Iterable<ClassElement> subclasses = _compiler.world.strictSubclassesOf(cls); 237 Iterable<ClassElement> subclasses = _compiler.world.strictSubclassesOf(cls);
238 return subclasses.any((ClassElement subclass) { 238 return subclasses.any((ClassElement subclass) {
239 return !_backend.rti.isTrivialSubstitution(subclass, cls); 239 return !_backend.rti.isTrivialSubstitution(subclass, cls);
240 }); 240 });
241 } 241 }
242 242
243 js.Expression generateTypeRepresentation(DartType dartType, 243 js.Expression generateTypeRepresentation(DartType dartType,
244 List<js.Expression> arguments, 244 List<js.Expression> arguments,
245 CodegenRegistry registry) { 245 CodegenRegistry registry) {
246 int variableIndex = 0; 246 int variableIndex = 0;
247 js.Expression representation = _backend.rti.getTypeRepresentation( 247 js.Expression representation = _backend.rtiEncoder.getTypeRepresentation(
248 dartType, 248 dartType,
249 (_) => arguments[variableIndex++]); 249 (_) => arguments[variableIndex++]);
250 assert(variableIndex == arguments.length); 250 assert(variableIndex == arguments.length);
251 // Representation contains JavaScript Arrays. 251 // Representation contains JavaScript Arrays.
252 registry.registerInstantiatedClass(_backend.jsArrayClass); 252 registry.registerInstantiatedClass(_backend.jsArrayClass);
253 return representation; 253 return representation;
254 } 254 }
255 255
256 void registerIsCheck(DartType type, Registry registry) { 256 void registerIsCheck(DartType type, Registry registry) {
257 _enqueuer.registerIsCheck(type); 257 _enqueuer.registerIsCheck(type);
(...skipping 29 matching lines...) Expand all
287 bool isBoolClass(ClassElement classElement) => 287 bool isBoolClass(ClassElement classElement) =>
288 classElement == _backend.jsBoolClass || 288 classElement == _backend.jsBoolClass ||
289 classElement == _compiler.boolClass; 289 classElement == _compiler.boolClass;
290 290
291 // TODO(sra): Should this be part of CodegenRegistry? 291 // TODO(sra): Should this be part of CodegenRegistry?
292 void registerNativeBehavior(NativeBehavior nativeBehavior, node) { 292 void registerNativeBehavior(NativeBehavior nativeBehavior, node) {
293 if (nativeBehavior == null) return; 293 if (nativeBehavior == null) return;
294 _enqueuer.nativeEnqueuer.registerNativeBehavior(nativeBehavior, node); 294 _enqueuer.nativeEnqueuer.registerNativeBehavior(nativeBehavior, node);
295 } 295 }
296 } 296 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_backend/backend.dart ('k') | pkg/compiler/lib/src/js_backend/constant_emitter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698