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

Unified Diff: sdk/lib/_internal/compiler/implementation/js_backend/backend.dart

Issue 94303002: Add another type JSPositiveInt to show a range analysis in the inferrer would be very beneficial :-… (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 30754)
+++ sdk/lib/_internal/compiler/implementation/js_backend/backend.dart (working copy)
@@ -194,6 +194,7 @@
ClassElement jsMutableArrayClass;
ClassElement jsFixedArrayClass;
ClassElement jsExtendableArrayClass;
+ ClassElement jsPositiveIntClass;
ClassElement jsUInt32Class;
ClassElement jsUInt31Class;
@@ -231,6 +232,7 @@
TypeMask get intType => compiler.typesTask.intType;
TypeMask get uint32Type => compiler.typesTask.uint32Type;
TypeMask get uint31Type => compiler.typesTask.uint31Type;
+ TypeMask get positiveIntType => compiler.typesTask.positiveIntType;
TypeMask get numType => compiler.typesTask.numType;
TypeMask get boolType => compiler.typesTask.boolType;
TypeMask get dynamicType => compiler.typesTask.dynamicType;
@@ -580,6 +582,7 @@
// 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'),
+ jsPositiveIntClass = compiler.findInterceptor('JSPositiveInt'),
jsUInt32Class = compiler.findInterceptor('JSUInt32'),
jsUInt31Class = compiler.findInterceptor('JSUInt31'),
jsDoubleClass = compiler.findInterceptor('JSDouble'),
@@ -853,6 +856,7 @@
addInterceptors(jsExtendableArrayClass, enqueuer, elements);
} else if (cls == compiler.intClass || cls == jsIntClass) {
addInterceptors(jsIntClass, enqueuer, elements);
+ addInterceptors(jsPositiveIntClass, enqueuer, elements);
addInterceptors(jsUInt32Class, enqueuer, elements);
addInterceptors(jsUInt31Class, enqueuer, elements);
addInterceptors(jsNumberClass, enqueuer, elements);
@@ -865,6 +869,7 @@
addInterceptors(jsNullClass, enqueuer, elements);
} else if (cls == compiler.numClass || cls == jsNumberClass) {
addInterceptors(jsIntClass, enqueuer, elements);
+ addInterceptors(jsPositiveIntClass, enqueuer, elements);
addInterceptors(jsUInt32Class, enqueuer, elements);
addInterceptors(jsUInt31Class, enqueuer, elements);
addInterceptors(jsDoubleClass, enqueuer, elements);
@@ -1426,7 +1431,8 @@
? 'boolTypeCast'
: 'boolTypeCheck';
} else if (element == jsIntClass || element == compiler.intClass
- || element == jsUInt32Class || element == jsUInt31Class) {
+ || element == jsUInt32Class || element == jsUInt31Class
+ || element == jsPositiveIntClass) {
if (nativeCheckOnly) return null;
return typeCast
? 'intTypeCast'
@@ -1646,6 +1652,7 @@
ClassElement get intImplementation => jsIntClass;
ClassElement get uint32Implementation => jsUInt32Class;
ClassElement get uint31Implementation => jsUInt31Class;
+ ClassElement get positiveIntImplementation => jsPositiveIntClass;
ClassElement get doubleImplementation => jsDoubleClass;
ClassElement get numImplementation => jsNumberClass;
ClassElement get stringImplementation => jsStringClass;

Powered by Google App Engine
This is Rietveld 408576698