Bug 1199719 part 2 - Move calleeToken functions to the Jit Frame section of the MacroAssembler. r=sstangl
☠☠ backed out by f11cf71a5cca ☠ ☠
authorNicolas B. Pierron <nicolas.b.pierron@mozilla.com>
Thu, 10 Sep 2015 22:36:11 +0200
changeset 296172 a49cedf75457d76a64bf7f4e11b0f80811d6a32b
parent 296171 67639ac86e67440fb912d37ff88f123457b38696
child 296173 399f2af808f36cc0c163edd099ca2cb1268028cd
push id962
push userjlund@mozilla.com
push dateFri, 04 Dec 2015 23:28:54 +0000
treeherdermozilla-release@23a2d286e80f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssstangl
bugs1199719
milestone43.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 1199719 part 2 - Move calleeToken functions to the Jit Frame section of the MacroAssembler. r=sstangl
js/src/jit/MacroAssembler-inl.h
js/src/jit/MacroAssembler.h
--- a/js/src/jit/MacroAssembler-inl.h
+++ b/js/src/jit/MacroAssembler-inl.h
@@ -208,16 +208,45 @@ MacroAssembler::makeFrameDescriptor(Regi
 
 void
 MacroAssembler::pushStaticFrameDescriptor(FrameType type)
 {
     uint32_t descriptor = MakeFrameDescriptor(framePushed(), type);
     Push(Imm32(descriptor));
 }
 
+void
+MacroAssembler::PushCalleeToken(Register callee, bool constructing)
+{
+    if (constructing) {
+        orPtr(Imm32(CalleeToken_FunctionConstructing), callee);
+        Push(callee);
+        andPtr(Imm32(uint32_t(CalleeTokenMask)), callee);
+    } else {
+        static_assert(CalleeToken_Function == 0, "Non-constructing call requires no tagging");
+        Push(callee);
+    }
+}
+
+void
+MacroAssembler::loadFunctionFromCalleeToken(Address token, Register dest)
+{
+#ifdef DEBUG
+    Label ok;
+    loadPtr(token, dest);
+    andPtr(Imm32(uint32_t(~CalleeTokenMask)), dest);
+    branchPtr(Assembler::Equal, dest, Imm32(CalleeToken_Function), &ok);
+    branchPtr(Assembler::Equal, dest, Imm32(CalleeToken_FunctionConstructing), &ok);
+    assumeUnreachable("Unexpected CalleeToken tag");
+    bind(&ok);
+#endif
+    loadPtr(token, dest);
+    andPtr(Imm32(uint32_t(CalleeTokenMask)), dest);
+}
+
 uint32_t
 MacroAssembler::buildFakeExitFrame(Register scratch)
 {
     mozilla::DebugOnly<uint32_t> initialDepth = framePushed();
 
     pushStaticFrameDescriptor(JitFrame_IonJS);
     uint32_t retAddr = pushFakeReturnAddress(scratch);
 
--- a/js/src/jit/MacroAssembler.h
+++ b/js/src/jit/MacroAssembler.h
@@ -586,16 +586,26 @@ class MacroAssembler : public MacroAssem
 
     // The frame descriptor is the second field of all Jit frames, pushed before
     // calling the Jit function.  It is a composite value defined in JitFrames.h
     inline void makeFrameDescriptor(Register frameSizeReg, FrameType type);
 
     // Push the frame descriptor, based on the statically known framePushed.
     inline void pushStaticFrameDescriptor(FrameType type);
 
+    // Push the callee token of a JSFunction which pointer is stored in the
+    // |callee| register. The callee token is packed with a |constructing| flag
+    // which correspond to the fact that the JS function is called with "new" or
+    // not.
+    inline void PushCalleeToken(Register callee, bool constructing);
+
+    // Unpack a callee token located at the |token| address, and return the
+    // JSFunction pointer in the |dest| register.
+    inline void loadFunctionFromCalleeToken(Address token, Register dest);
+
     // This function emulates a call by pushing an exit frame on the stack,
     // except that the fake-function is inlined within the body of the caller.
     //
     // This function assumes that the current frame is an IonJS frame.
     //
     // This function returns the offset of the /fake/ return address, in order to use
     // the return address to index the safepoints, which are used to list all
     // live registers.
@@ -756,31 +766,16 @@ class MacroAssembler : public MacroAssem
         loadPtr(Address(obj, JSObject::offsetOfGroup()), dest);
         loadPtr(Address(dest, ObjectGroup::offsetOfProto()), dest);
     }
 
     void loadStringLength(Register str, Register dest) {
         load32(Address(str, JSString::offsetOfLength()), dest);
     }
 
-    void loadFunctionFromCalleeToken(Address token, Register dest) {
-        loadPtr(token, dest);
-        andPtr(Imm32(uint32_t(CalleeTokenMask)), dest);
-    }
-    void PushCalleeToken(Register callee, bool constructing) {
-        if (constructing) {
-            orPtr(Imm32(CalleeToken_FunctionConstructing), callee);
-            Push(callee);
-            andPtr(Imm32(uint32_t(CalleeTokenMask)), callee);
-        } else {
-            static_assert(CalleeToken_Function == 0, "Non-constructing call requires no tagging");
-            Push(callee);
-        }
-    }
-
     void loadStringChars(Register str, Register dest);
     void loadStringChar(Register str, Register index, Register output);
 
     void branchIfRope(Register str, Label* label) {
         Address flags(str, JSString::offsetOfFlags());
         static_assert(JSString::ROPE_FLAGS == 0, "Rope type flags must be 0");
         branchTest32(Assembler::Zero, flags, Imm32(JSString::TYPE_FLAGS_MASK), label);
     }