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

Unified Diff: sdk/lib/_internal/compiler/implementation/ssa/nodes.dart

Issue 87783003: Add UInt32 and UInt31 types to better infer bit operations. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 1 month 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: sdk/lib/_internal/compiler/implementation/ssa/nodes.dart
===================================================================
--- sdk/lib/_internal/compiler/implementation/ssa/nodes.dart (revision 30666)
+++ sdk/lib/_internal/compiler/implementation/ssa/nodes.dart (working copy)
@@ -162,30 +162,10 @@
return result;
}
- static TypeMask mapConstantTypeToSsaType(Constant constant,
- Compiler compiler) {
- JavaScriptBackend backend = compiler.backend;
- if (constant.isNull()) return backend.nullType;
- if (constant.isBool()) return backend.boolType;
- if (constant.isInt()) return backend.intType;
- if (constant.isDouble()) return backend.doubleType;
- if (constant.isString()) return backend.stringType;
- if (constant.isList()) return backend.readableArrayType;
- if (constant.isFunction()) return backend.nonNullType;
- if (constant.isSentinel()) return backend.nonNullType;
- // TODO(sra): What is the type of the prototype of an interceptor?
- if (constant.isInterceptor()) return backend.nonNullType;
- ObjectConstant objectConstant = constant;
- if (backend.isInterceptorClass(objectConstant.type.element)) {
- return backend.nonNullType;
- }
- return new TypeMask.nonNullExact(objectConstant.type.element);
- }
-
HConstant addConstant(Constant constant, Compiler compiler) {
HConstant result = constants[constant];
if (result == null) {
- TypeMask type = mapConstantTypeToSsaType(constant, compiler);
+ TypeMask type = constant.computeMask(compiler);
result = new HConstant.internal(constant, type);
entry.addAtExit(result);
constants[constant] = result;
@@ -921,6 +901,18 @@
&& !instructionType.isNullable;
}
+ bool isUInt32(Compiler compiler) {
+ JavaScriptBackend backend = compiler.backend;
+ return !instructionType.isNullable
+ && instructionType.satisfies(backend.jsUInt32Class, compiler);
+ }
+
+ bool isUInt31(Compiler compiler) {
+ JavaScriptBackend backend = compiler.backend;
+ return !instructionType.isNullable
+ && instructionType.satisfies(backend.jsUInt31Class, compiler);
+ }
+
bool isIntegerOrNull(Compiler compiler) {
return instructionType.containsOnlyInt(compiler);
}

Powered by Google App Engine
This is Rietveld 408576698