Bug 1479603 - [Part 12] Simplify getKey computations r=jandem
authorMatthew Gaudet <mgaudet@mozilla.com>
Wed, 22 Aug 2018 14:58:33 -0400
changeset 831140 1d0c2d31df1e988a334a3cada9eb5113f1610e69
parent 831139 5a2381311cedc81a16222f90b854675fa004c4db
child 831141 7708abde9c7581d1013843ed19aa4c67edd4e518
push id118868
push userbmo:zjz@zjz.name
push dateFri, 24 Aug 2018 07:04:39 +0000
reviewersjandem
bugs1479603
milestone63.0a1
Bug 1479603 - [Part 12] Simplify getKey computations r=jandem
js/src/jit/BaselineIC.h
--- a/js/src/jit/BaselineIC.h
+++ b/js/src/jit/BaselineIC.h
@@ -1013,17 +1013,17 @@ class ICStubCompiler
 
 #ifdef DEBUG
     bool entersStubFrame_;
     uint32_t framePushedAtEnterStubFrame_;
 #endif
 
     // By default the stubcode key is just the kind.
     virtual int32_t getKey() const {
-        return static_cast<int32_t>(kind) << 1;
+        return static_cast<int32_t>(kind);
     }
 
     virtual MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm) = 0;
     virtual void postGenerateStubCode(MacroAssembler& masm, Handle<JitCode*> genCode) {}
 
     JitCode* getStubCode();
 
     ICStubCompiler(JSContext* cx, ICStub::Kind kind)
@@ -1226,18 +1226,18 @@ class TypeCheckPrimitiveSetStub : public
     }
 
     class Compiler : public ICStubCompiler {
       protected:
         TypeCheckPrimitiveSetStub* existingStub_;
         uint16_t flags_;
 
         virtual int32_t getKey() const override {
-            return static_cast<int32_t>(kind) << 1 |
-                  (static_cast<int32_t>(flags_) << 17);
+            return static_cast<int32_t>(kind) |
+                  (static_cast<int32_t>(flags_) << 16);
         }
 
       public:
         Compiler(JSContext* cx, Kind kind, TypeCheckPrimitiveSetStub* existingStub,
                  JSValueType type)
           : ICStubCompiler(cx, kind),
             existingStub_(existingStub),
             flags_((existingStub ? existingStub->typeFlags() : 0) | TypeToFlag(type))
@@ -1805,18 +1805,18 @@ class ICGetElem_Fallback : public ICMoni
 
     // Compiler for this stub kind.
     class Compiler : public ICStubCompiler {
       protected:
         bool hasReceiver_;
         MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm) override;
 
         virtual int32_t getKey() const override {
-            return static_cast<int32_t>(kind) << 1 |
-                  (static_cast<int32_t>(hasReceiver_) << 17);
+            return static_cast<int32_t>(kind) |
+                  (static_cast<int32_t>(hasReceiver_) << 16);
         }
 
       public:
         explicit Compiler(JSContext* cx, bool hasReceiver = false)
           : ICStubCompiler(cx, ICStub::GetElem_Fallback),
             hasReceiver_(hasReceiver)
         { }
 
@@ -2037,18 +2037,18 @@ class ICGetProp_Fallback : public ICMoni
     class Compiler : public ICStubCompiler {
       protected:
         CodeOffset bailoutReturnOffset_;
         bool hasReceiver_;
         MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm) override;
         void postGenerateStubCode(MacroAssembler& masm, Handle<JitCode*> code) override;
 
         virtual int32_t getKey() const override {
-            return static_cast<int32_t>(kind) << 1 |
-                  (static_cast<int32_t>(hasReceiver_) << 17);
+            return static_cast<int32_t>(kind) |
+                  (static_cast<int32_t>(hasReceiver_) << 16);
         }
 
       public:
         explicit Compiler(JSContext* cx, bool hasReceiver = false)
           : ICStubCompiler(cx, ICStub::GetProp_Fallback),
             hasReceiver_(hasReceiver)
         { }
 
@@ -2169,19 +2169,19 @@ class ICCall_Fallback : public ICMonitor
       protected:
         bool isConstructing_;
         bool isSpread_;
         CodeOffset bailoutReturnOffset_;
         MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm) override;
         void postGenerateStubCode(MacroAssembler& masm, Handle<JitCode*> code) override;
 
         virtual int32_t getKey() const override {
-            return static_cast<int32_t>(kind) << 1 |
-                  (static_cast<int32_t>(isSpread_) << 17) |
-                  (static_cast<int32_t>(isConstructing_) << 18);
+            return static_cast<int32_t>(kind) |
+                  (static_cast<int32_t>(isSpread_) << 16) |
+                  (static_cast<int32_t>(isConstructing_) << 17);
         }
 
       public:
         Compiler(JSContext* cx, bool isConstructing, bool isSpread)
           : ICCallStubCompiler(cx, ICStub::Call_Fallback),
             isConstructing_(isConstructing),
             isSpread_(isSpread)
         { }
@@ -2258,20 +2258,20 @@ class ICCallScriptedCompiler : public IC
     bool isSpread_;
     bool maybeCrossRealm_;
     RootedFunction callee_;
     RootedObject templateObject_;
     uint32_t pcOffset_;
     MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm) override;
 
     virtual int32_t getKey() const override {
-        return static_cast<int32_t>(kind) << 1 |
-              (static_cast<int32_t>(isConstructing_) << 17) |
-              (static_cast<int32_t>(isSpread_) << 18) |
-              (static_cast<int32_t>(maybeCrossRealm_) << 19);
+        return static_cast<int32_t>(kind) |
+              (static_cast<int32_t>(isConstructing_) << 16) |
+              (static_cast<int32_t>(isSpread_) << 17) |
+              (static_cast<int32_t>(maybeCrossRealm_) << 18);
     }
 
   public:
     ICCallScriptedCompiler(JSContext* cx, ICStub* firstMonitorStub,
                            JSFunction* callee, JSObject* templateObject,
                            bool isConstructing, bool isSpread, bool maybeCrossRealm,
                            uint32_t pcOffset)
       : ICCallStubCompiler(cx, ICStub::Call_Scripted),
@@ -2355,21 +2355,21 @@ class ICCall_Native : public ICMonitored
         bool isSpread_;
         bool isCrossRealm_;
         RootedFunction callee_;
         RootedObject templateObject_;
         uint32_t pcOffset_;
         MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm) override;
 
         virtual int32_t getKey() const override {
-            return static_cast<int32_t>(kind) << 1 |
-                  (static_cast<int32_t>(isSpread_) << 17) |
-                  (static_cast<int32_t>(isConstructing_) << 18) |
-                  (static_cast<int32_t>(ignoresReturnValue_) << 19) |
-                  (static_cast<int32_t>(isCrossRealm_) << 20);
+            return static_cast<int32_t>(kind) |
+                  (static_cast<int32_t>(isSpread_) << 16) |
+                  (static_cast<int32_t>(isConstructing_) << 17) |
+                  (static_cast<int32_t>(ignoresReturnValue_) << 18) |
+                  (static_cast<int32_t>(isCrossRealm_) << 19);
         }
 
       public:
         Compiler(JSContext* cx, ICStub* firstMonitorStub,
                  HandleFunction callee, HandleObject templateObject,
                  bool isConstructing, bool ignoresReturnValue, bool isSpread, bool isCrossRealm,
                  uint32_t pcOffset)
           : ICCallStubCompiler(cx, ICStub::Call_Native),
@@ -2435,18 +2435,18 @@ class ICCall_ClassHook : public ICMonito
         bool isConstructing_;
         const Class* clasp_;
         Native native_;
         RootedObject templateObject_;
         uint32_t pcOffset_;
         MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm) override;
 
         virtual int32_t getKey() const override {
-            return static_cast<int32_t>(kind) << 1 |
-                  (static_cast<int32_t>(isConstructing_) << 17);
+            return static_cast<int32_t>(kind) |
+                  (static_cast<int32_t>(isConstructing_) << 16);
         }
 
       public:
         Compiler(JSContext* cx, ICStub* firstMonitorStub,
                  const Class* clasp, Native native,
                  HandleObject templateObject, uint32_t pcOffset,
                  bool isConstructing)
           : ICCallStubCompiler(cx, ICStub::Call_ClassHook),