diff --git a/js/src/jit/MIR.cpp b/js/src/jit/MIR.cpp index ff26b9e0126..5d8349bd848 100644 --- a/js/src/jit/MIR.cpp +++ b/js/src/jit/MIR.cpp @@ -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; }