HControlInstruction* compare;
if (stmt->switch_type() == SwitchStatement::SMI_SWITCH) {
- if (!clause->compare_type()->Is(Type::Integer31())) {
+ if (!clause->compare_type()->Is(Type::Smi())) {
AddSoftDeoptimize();
}
break;
case Token::BIT_OR: {
HValue* operand, *shift_amount;
- if (left_type->Is(Type::Integer32()) &&
- right_type->Is(Type::Integer32()) &&
+ if (left_type->Is(Type::Signed32()) &&
+ right_type->Is(Type::Signed32()) &&
MatchRotateRight(left, right, &operand, &shift_amount)) {
instr = new(zone()) HRor(context, operand, shift_amount);
} else {
Representation HOptimizedGraphBuilder::ToRepresentation(Handle<Type> type) {
if (type->Is(Type::None())) return Representation::None();
- if (type->Is(Type::Integer32())) return Representation::Integer32();
+ if (type->Is(Type::Signed32())) return Representation::Integer32();
if (type->Is(Type::Number())) return Representation::Double();
return Representation::Tagged();
}
} else {
// TODO(verwaest): Remove once ToRepresentation properly returns Smi when
// the IC measures Smi.
- if (left_type->Is(Type::Integer31())) left_rep = Representation::Smi();
- if (right_type->Is(Type::Integer31())) right_rep = Representation::Smi();
+ if (left_type->Is(Type::Smi())) left_rep = Representation::Smi();
+ if (right_type->Is(Type::Smi())) right_rep = Representation::Smi();
HCompareIDAndBranch* result =
new(zone()) HCompareIDAndBranch(left, right, op);
result->set_observed_input_representation(left_rep, right_rep);
case UNINITIALIZED:
return handle(Type::None(), isolate);
case SMI:
- return handle(Type::Integer31(), isolate);
+ return handle(Type::Smi(), isolate);
case NUMBER:
return handle(Type::Number(), isolate);
case GENERIC:
case UNINITIALIZED:
return handle(Type::None(), isolate);
case SMI:
- return handle(Type::Integer31(), isolate);
+ return handle(Type::Smi(), isolate);
case INT32:
- return handle(Type::Integer32(), isolate);
+ return handle(Type::Signed32(), isolate);
case NUMBER:
return handle(Type::Number(), isolate);
case ODDBALL:
case CompareIC::UNINITIALIZED:
return handle(Type::None(), isolate);
case CompareIC::SMI:
- return handle(Type::Integer31(), isolate);
+ return handle(Type::Smi(), isolate);
case CompareIC::NUMBER:
return handle(Type::Number(), isolate);
case CompareIC::STRING:
map = *this->as_class();
} else {
Handle<v8::internal::Object> value = this->as_constant();
- if (value->IsSmi()) return kInteger31;
+ if (value->IsSmi()) return kSmi;
map = HeapObject::cast(*value)->map();
if (map->instance_type() == ODDBALL_TYPE) {
if (value->IsUndefined()) return kUndefined;
case JS_ARRAY_BUFFER_TYPE:
case JS_TYPED_ARRAY_TYPE:
case JS_DATA_VIEW_TYPE:
+ case JS_SET_TYPE:
+ case JS_MAP_TYPE:
case JS_WEAK_MAP_TYPE:
- case JS_REGEXP_TYPE:
if (map->is_undetectable()) return kUndetectable;
return kOtherObject;
case JS_ARRAY_TYPE:
return kArray;
case JS_FUNCTION_TYPE:
return kFunction;
+ case JS_REGEXP_TYPE:
+ return kRegExp;
case JS_PROXY_TYPE:
case JS_FUNCTION_PROXY_TYPE:
return kProxy;
// T <= Any
//
// Oddball = Boolean \/ Null \/ Undefined
-// Number = Integer32 \/ Double
-// Integer31 < Integer32
+// Number = Signed32 \/ Unsigned32 \/ Double
+// Smi <= Signed32
// Name = String \/ Symbol
// UniqueName = InternalizedString \/ Symbol
// InternalizedString < String
// Receiver = Object \/ Proxy
// Array < Object
// Function < Object
+// RegExp < Object
//
// Class(map) < T iff instance_type(map) < T
// Constant(x) < T iff instance_type(map(x)) < T
// lattice (e.g., splitting up number types further) without invalidating any
// existing assumptions or tests.
//
+// Consequently, do not use pointer equality for type tests, always use Is!
+//
// Internally, all 'primitive' types, and their unions, are represented as
// bitsets via smis. Class is a heap pointer to the respective map. Only
// Constant's, or unions containing Class'es or Constant's, require allocation.
static Type* Undefined() { return from_bitset(kUndefined); }
static Type* Number() { return from_bitset(kNumber); }
- static Type* Integer31() { return from_bitset(kInteger31); }
- static Type* Integer32() { return from_bitset(kInteger32); }
+ static Type* Smi() { return from_bitset(kSmi); }
+ static Type* Signed32() { return from_bitset(kSigned32); }
+ static Type* Unsigned32() { return from_bitset(kUnsigned32); }
static Type* Double() { return from_bitset(kDouble); }
+ static Type* NumberOrString() { return from_bitset(kNumberOrString); }
static Type* Name() { return from_bitset(kName); }
static Type* UniqueName() { return from_bitset(kUniqueName); }
static Type* Undetectable() { return from_bitset(kUndetectable); }
static Type* Array() { return from_bitset(kArray); }
static Type* Function() { return from_bitset(kFunction); }
+ static Type* RegExp() { return from_bitset(kRegExp); }
static Type* Proxy() { return from_bitset(kProxy); }
static Type* Class(Handle<Map> map) { return from_handle(map); }
kNull = 1 << 0,
kUndefined = 1 << 1,
kBoolean = 1 << 2,
- kInteger31 = 1 << 3,
- kOtherInteger = 1 << 4,
- kDouble = 1 << 5,
- kSymbol = 1 << 6,
- kInternalizedString = 1 << 7,
- kOtherString = 1 << 8,
- kUndetectable = 1 << 9,
- kArray = 1 << 10,
- kFunction = 1 << 11,
- kOtherObject = 1 << 12,
- kProxy = 1 << 13,
+ kSmi = 1 << 3,
+ kOtherSigned32 = 1 << 4,
+ kUnsigned32 = 1 << 5,
+ kDouble = 1 << 6,
+ kSymbol = 1 << 7,
+ kInternalizedString = 1 << 8,
+ kOtherString = 1 << 9,
+ kUndetectable = 1 << 10,
+ kArray = 1 << 11,
+ kFunction = 1 << 12,
+ kRegExp = 1 << 13,
+ kOtherObject = 1 << 14,
+ kProxy = 1 << 15,
kOddball = kBoolean | kNull | kUndefined,
- kInteger32 = kInteger31 | kOtherInteger,
- kNumber = kInteger32 | kDouble,
+ kSigned32 = kSmi | kOtherSigned32,
+ kNumber = kSigned32 | kUnsigned32 | kDouble,
kString = kInternalizedString | kOtherString,
kUniqueName = kSymbol | kInternalizedString,
kName = kSymbol | kString,
- kObject = kUndetectable | kArray | kFunction | kOtherObject,
+ kNumberOrString = kNumber | kString,
+ kObject = kUndetectable | kArray | kFunction | kRegExp | kOtherObject,
kReceiver = kObject | kProxy,
kAllocated = kDouble | kName | kReceiver,
kAny = kOddball | kNumber | kAllocated,
Null(Type::Null(), isolate),
Undefined(Type::Undefined(), isolate),
Number(Type::Number(), isolate),
- Integer31(Type::Integer31(), isolate),
- Integer32(Type::Integer32(), isolate),
+ Integer31(Type::Smi(), isolate),
+ Integer32(Type::Signed32(), isolate),
Double(Type::Double(), isolate),
Name(Type::Name(), isolate),
UniqueName(Type::UniqueName(), isolate),