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

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

Issue 1110813005: cps-ir: Implement type tests for interface types without type arguments. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 5 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: pkg/compiler/lib/src/js_backend/codegen/glue.dart
diff --git a/pkg/compiler/lib/src/js_backend/codegen/glue.dart b/pkg/compiler/lib/src/js_backend/codegen/glue.dart
index ec9918bf517246742126f737b05a8b8c38d7c0ce..47d5b3956ccca842e1fe3a74be87e34211e0696a 100644
--- a/pkg/compiler/lib/src/js_backend/codegen/glue.dart
+++ b/pkg/compiler/lib/src/js_backend/codegen/glue.dart
@@ -11,7 +11,7 @@ import '../../js/js.dart' as js;
import '../../constants/values.dart';
import '../../elements/elements.dart';
import '../../constants/expressions.dart';
-import '../../dart_types.dart' show DartType, TypeVariableType;
+import '../../dart_types.dart' show DartType, TypeVariableType, InterfaceType;
/// Encapsulates the dependencies of the function-compiler to the compiler,
/// backend and emitter.
@@ -20,9 +20,14 @@ import '../../dart_types.dart' show DartType, TypeVariableType;
class Glue {
final Compiler _compiler;
+ CodegenEnqueuer get _enqueuer => _compiler.enqueuer.codegen;
+
+ FunctionElement get getInterceptorMethod => _backend.getInterceptorMethod;
+
JavaScriptBackend get _backend => _compiler.backend;
CodeEmitterTask get _emitter => _backend.emitter;
+
Namer get _namer => _backend.namer;
Glue(this._compiler);
@@ -71,10 +76,8 @@ class Glue {
return _namer.invocationName(selector);
}
- FunctionElement get getInterceptorMethod => _backend.getInterceptorMethod;
-
void registerUseInterceptorInCodegen() {
- _backend.registerUseInterceptor(_compiler.enqueuer.codegen);
+ _backend.registerUseInterceptor(_enqueuer);
}
bool isInterceptedSelector(Selector selector) {
@@ -149,6 +152,10 @@ class Glue {
return _backend.getGetTypeArgumentByIndex();
}
+ FunctionElement getAddRuntimeTypeInformation() {
+ return _backend.getSetRuntimeTypeInfo();
+ }
+
js.Expression getSubstitutionName(ClassElement cls) {
return js.string(_namer.substitutionName(cls));
}
@@ -167,10 +174,6 @@ class Glue {
});
}
- FunctionElement getAddRuntimeTypeInformation() {
- return _backend.getSetRuntimeTypeInfo();
- }
-
js.Expression generateTypeRepresentation(DartType dartType,
List<js.Expression> arguments) {
int variableIndex = 0;
@@ -180,4 +183,28 @@ class Glue {
assert(variableIndex == arguments.length);
return representation;
}
+
+ bool isNativePrimitiveType(DartType type) {
+ if (type is! InterfaceType) return false;
+ return _backend.isNativePrimitiveType(type.element);
+ }
+
+ void registerIsCheck(DartType type, Registry registry) {
+ _enqueuer.registerIsCheck(type, registry);
+ _backend.registerIsCheckForCodegen(type, _enqueuer, registry);
+ }
+
+ bool isIntClass(ClassElement cls) => cls == _compiler.intClass;
+
+ bool isStringClass(ClassElement cls) => cls == _compiler.stringClass;
+
+ bool isBoolClass(ClassElement cls) => cls == _compiler.boolClass;
+
+ bool isNumClass(ClassElement cls) => cls == _compiler.numClass;
+
+ bool isDoubleClass(ClassElement cls) => cls == _compiler.doubleClass;
+
+ String getTypeTestTag(DartType type) {
+ return _backend.namer.operatorIsType(type);
+ }
}
« no previous file with comments | « pkg/compiler/lib/src/js_backend/codegen/codegen.dart ('k') | pkg/compiler/lib/src/js_backend/codegen/type_test_emitter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698