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

Unified Diff: sdk/lib/_internal/compiler/implementation/js_backend/backend.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/js_backend/backend.dart
===================================================================
--- sdk/lib/_internal/compiler/implementation/js_backend/backend.dart (revision 30666)
+++ sdk/lib/_internal/compiler/implementation/js_backend/backend.dart (working copy)
@@ -194,6 +194,8 @@
ClassElement jsMutableArrayClass;
ClassElement jsFixedArrayClass;
ClassElement jsExtendableArrayClass;
+ ClassElement jsUInt32Class;
+ ClassElement jsUInt31Class;
Element jsIndexableLength;
Element jsArrayTypedConstructor;
@@ -227,6 +229,8 @@
TypeMask get stringType => compiler.typesTask.stringType;
TypeMask get doubleType => compiler.typesTask.doubleType;
TypeMask get intType => compiler.typesTask.intType;
+ TypeMask get uint32Type => compiler.typesTask.uint32Type;
+ TypeMask get uint31Type => compiler.typesTask.uint31Type;
TypeMask get numType => compiler.typesTask.numType;
TypeMask get boolType => compiler.typesTask.boolType;
TypeMask get dynamicType => compiler.typesTask.dynamicType;
@@ -576,6 +580,8 @@
// The int class must be before the double class, because the
// emitter relies on this list for the order of type checks.
jsIntClass = compiler.findInterceptor('JSInt'),
+ jsUInt32Class = compiler.findInterceptor('JSUInt32'),
+ jsUInt31Class = compiler.findInterceptor('JSUInt31'),
jsDoubleClass = compiler.findInterceptor('JSDouble'),
jsNumberClass = compiler.findInterceptor('JSNumber'),
jsNullClass = compiler.findInterceptor('JSNull'),
@@ -847,6 +853,8 @@
addInterceptors(jsExtendableArrayClass, enqueuer, elements);
} else if (cls == compiler.intClass || cls == jsIntClass) {
addInterceptors(jsIntClass, enqueuer, elements);
+ addInterceptors(jsUInt32Class, enqueuer, elements);
+ addInterceptors(jsUInt31Class, enqueuer, elements);
addInterceptors(jsNumberClass, enqueuer, elements);
} else if (cls == compiler.doubleClass || cls == jsDoubleClass) {
addInterceptors(jsDoubleClass, enqueuer, elements);
@@ -857,6 +865,8 @@
addInterceptors(jsNullClass, enqueuer, elements);
} else if (cls == compiler.numClass || cls == jsNumberClass) {
addInterceptors(jsIntClass, enqueuer, elements);
+ addInterceptors(jsUInt32Class, enqueuer, elements);
+ addInterceptors(jsUInt31Class, enqueuer, elements);
addInterceptors(jsDoubleClass, enqueuer, elements);
addInterceptors(jsNumberClass, enqueuer, elements);
} else if (cls == jsPlainJavaScriptObjectClass) {
@@ -1415,7 +1425,8 @@
return typeCast
? 'boolTypeCast'
: 'boolTypeCheck';
- } else if (element == jsIntClass || element == compiler.intClass) {
+ } else if (element == jsIntClass || element == compiler.intClass
+ || element == jsUInt32Class || element == jsUInt31Class) {
if (nativeCheckOnly) return null;
return typeCast
? 'intTypeCast'
@@ -1633,6 +1644,8 @@
}
ClassElement get intImplementation => jsIntClass;
+ ClassElement get uint32Implementation => jsUInt32Class;
+ ClassElement get uint31Implementation => jsUInt31Class;
ClassElement get doubleImplementation => jsDoubleClass;
ClassElement get numImplementation => jsNumberClass;
ClassElement get stringImplementation => jsStringClass;

Powered by Google App Engine
This is Rietveld 408576698