Bug 914132 part 4 - Fold |typeof object| if possible. r=bhackett

This commit is contained in:
Jan de Mooij 2013-09-10 16:18:49 +02:00
parent 4f34c604ba
commit 3ee90ab4e8

View File

@ -1888,6 +1888,14 @@ MTypeOf::foldsTo(bool useValueNumbers)
case MIRType_Boolean:
type = JSTYPE_BOOLEAN;
break;
case MIRType_Object:
if (!inputMaybeCallableOrEmulatesUndefined()) {
// Object is not callable and does not emulate undefined, so it's
// safe to fold to "object".
type = JSTYPE_OBJECT;
break;
}
// FALL THROUGH
default:
return this;
}