Bug 914132 part 4 - Fold |typeof object| if possible. r=bhackett
authorJan de Mooij <jdemooij@mozilla.com>
Tue, 10 Sep 2013 16:18:49 +0200
changeset 159321 e112a8245e294e13071e95d8fd06e29620f49c52
parent 159320 8c452ca6d4165f69c4dc0901fc6bf9753e58afb2
child 159322 9aa9c1113d5e671c44db5675d33d6ac1b7b84566
push id2961
push userlsblakk@mozilla.com
push dateMon, 28 Oct 2013 21:59:28 +0000
treeherdermozilla-beta@73ef4f13486f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbhackett
bugs914132
milestone26.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 914132 part 4 - Fold |typeof object| if possible. r=bhackett
js/src/jit/MIR.cpp
--- a/js/src/jit/MIR.cpp
+++ b/js/src/jit/MIR.cpp
@@ -1883,16 +1883,24 @@ MTypeOf::foldsTo(bool useValueNumbers)
         type = JSTYPE_OBJECT;
         break;
       case MIRType_Undefined:
         type = JSTYPE_VOID;
         break;
       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;
     }
 
     JSRuntime *rt = GetIonContext()->runtime;
     return MConstant::New(StringValue(TypeName(type, rt)));
 }