Title: [166345] trunk/Source/_javascript_Core
Revision
166345
Author
[email protected]
Date
2014-03-26 22:05:55 -0700 (Wed, 26 Mar 2014)

Log Message

Parse stackmaps liveOuts
https://bugs.webkit.org/show_bug.cgi?id=130801

Reviewed by Geoffrey Garen.
        
This just adds the code to parse them but doesn't do anything with them, yet.

* ftl/FTLLocation.cpp:
(JSC::FTL::Location::forStackmaps):
* ftl/FTLLocation.h:
(JSC::FTL::Location::forRegister):
(JSC::FTL::Location::forIndirect):
* ftl/FTLStackMaps.cpp:
(JSC::FTL::StackMaps::Location::parse):
(JSC::FTL::StackMaps::Location::dump):
(JSC::FTL::StackMaps::LiveOut::parse):
(JSC::FTL::StackMaps::LiveOut::dump):
(JSC::FTL::StackMaps::Record::parse):
(JSC::FTL::StackMaps::Record::dump):
* ftl/FTLStackMaps.h:

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (166344 => 166345)


--- trunk/Source/_javascript_Core/ChangeLog	2014-03-27 04:42:50 UTC (rev 166344)
+++ trunk/Source/_javascript_Core/ChangeLog	2014-03-27 05:05:55 UTC (rev 166345)
@@ -1,3 +1,26 @@
+2014-03-26  Filip Pizlo  <[email protected]>
+
+        Parse stackmaps liveOuts
+        https://bugs.webkit.org/show_bug.cgi?id=130801
+
+        Reviewed by Geoffrey Garen.
+        
+        This just adds the code to parse them but doesn't do anything with them, yet.
+
+        * ftl/FTLLocation.cpp:
+        (JSC::FTL::Location::forStackmaps):
+        * ftl/FTLLocation.h:
+        (JSC::FTL::Location::forRegister):
+        (JSC::FTL::Location::forIndirect):
+        * ftl/FTLStackMaps.cpp:
+        (JSC::FTL::StackMaps::Location::parse):
+        (JSC::FTL::StackMaps::Location::dump):
+        (JSC::FTL::StackMaps::LiveOut::parse):
+        (JSC::FTL::StackMaps::LiveOut::dump):
+        (JSC::FTL::StackMaps::Record::parse):
+        (JSC::FTL::StackMaps::Record::dump):
+        * ftl/FTLStackMaps.h:
+
 2014-03-26  Mark Lam  <[email protected]>
 
         Build fix after r166307.

Modified: trunk/Source/_javascript_Core/ftl/FTLLocation.cpp (166344 => 166345)


--- trunk/Source/_javascript_Core/ftl/FTLLocation.cpp	2014-03-27 04:42:50 UTC (rev 166344)
+++ trunk/Source/_javascript_Core/ftl/FTLLocation.cpp	2014-03-27 05:05:55 UTC (rev 166345)
@@ -45,10 +45,10 @@
         
     case StackMaps::Location::Register:
     case StackMaps::Location::Direct:
-        return forRegister(location.dwarfRegNum, location.offset);
+        return forRegister(location.dwarfReg, location.offset);
         
     case StackMaps::Location::Indirect:
-        return forIndirect(location.dwarfRegNum, location.offset);
+        return forIndirect(location.dwarfReg, location.offset);
         
     case StackMaps::Location::Constant:
         return forConstant(location.offset);

Modified: trunk/Source/_javascript_Core/ftl/FTLLocation.h (166344 => 166345)


--- trunk/Source/_javascript_Core/ftl/FTLLocation.h	2014-03-27 04:42:50 UTC (rev 166344)
+++ trunk/Source/_javascript_Core/ftl/FTLLocation.h	2014-03-27 05:05:55 UTC (rev 166345)
@@ -57,20 +57,20 @@
         u.constant = 1;
     }
     
-    static Location forRegister(int16_t dwarfRegNum, int32_t addend)
+    static Location forRegister(DWARFRegister dwarfReg, int32_t addend)
     {
         Location result;
         result.m_kind = Register;
-        result.u.variable.dwarfRegNum = dwarfRegNum;
+        result.u.variable.dwarfRegNum = dwarfReg.dwarfRegNum();
         result.u.variable.offset = addend;
         return result;
     }
     
-    static Location forIndirect(int16_t dwarfRegNum, int32_t offset)
+    static Location forIndirect(DWARFRegister dwarfReg, int32_t offset)
     {
         Location result;
         result.m_kind = Indirect;
-        result.u.variable.dwarfRegNum = dwarfRegNum;
+        result.u.variable.dwarfRegNum = dwarfReg.dwarfRegNum();
         result.u.variable.offset = offset;
         return result;
     }

Modified: trunk/Source/_javascript_Core/ftl/FTLStackMaps.cpp (166344 => 166345)


--- trunk/Source/_javascript_Core/ftl/FTLStackMaps.cpp	2014-03-27 04:42:50 UTC (rev 166344)
+++ trunk/Source/_javascript_Core/ftl/FTLStackMaps.cpp	2014-03-27 05:05:55 UTC (rev 166345)
@@ -77,13 +77,13 @@
 {
     kind = static_cast<Kind>(context.view->read<uint8_t>(context.offset, true));
     size = context.view->read<uint8_t>(context.offset, true);
-    dwarfRegNum = context.view->read<uint16_t>(context.offset, true);
+    dwarfReg = DWARFRegister(context.view->read<uint16_t>(context.offset, true));
     this->offset = context.view->read<int32_t>(context.offset, true);
 }
 
 void StackMaps::Location::dump(PrintStream& out) const
 {
-    out.print("(", kind, ", reg", dwarfRegNum, ", off:", offset, ", size:", size, ")");
+    out.print("(", kind, ", ", dwarfReg, ", off:", offset, ", size:", size, ")");
 }
 
 GPRReg StackMaps::Location::directGPR() const
@@ -97,6 +97,18 @@
     FTL::Location::forStackmaps(&stackmaps, *this).restoreInto(jit, savedRegisters, result);
 }
 
+void StackMaps::LiveOut::parse(StackMaps::ParseContext& context)
+{
+    dwarfReg = DWARFRegister(context.view->read<uint16_t>(context.offset, true)); // regnum
+    context.view->read<uint8_t>(context.offset, true); // reserved
+    size = context.view->read<uint8_t>(context.offset, true); // size in bytes
+}
+
+void StackMaps::LiveOut::dump(PrintStream& out) const
+{
+    out.print("(", dwarfReg, ", ", size, ")");
+}
+
 bool StackMaps::Record::parse(StackMaps::ParseContext& context)
 {
     int64_t id = context.view->read<int64_t>(context.offset, true);
@@ -114,12 +126,11 @@
     
     if (context.version >= 1)
         context.view->read<uint16_t>(context.offset, true); // padding
+
     unsigned numLiveOuts = context.view->read<uint16_t>(context.offset, true);
-    while (numLiveOuts--) {
-        context.view->read<uint16_t>(context.offset, true); // regnum
-        context.view->read<uint8_t>(context.offset, true); // reserved
-        context.view->read<uint8_t>(context.offset, true); // size in bytes
-    }
+    while (numLiveOuts--)
+        liveOuts.append(readObject<LiveOut>(context));
+
     if (context.version >= 1) {
         if (context.offset & 7) {
             ASSERT(!(context.offset & 3));
@@ -134,7 +145,8 @@
 {
     out.print(
         "(#", patchpointID, ", offset = ", instructionOffset, ", flags = ", flags,
-        ", [", listDump(locations), "])");
+        ", locations = [", listDump(locations), "]), liveOuts = [",
+        listDump(liveOuts), "]");
 }
 
 bool StackMaps::parse(DataView* view)

Modified: trunk/Source/_javascript_Core/ftl/FTLStackMaps.h (166344 => 166345)


--- trunk/Source/_javascript_Core/ftl/FTLStackMaps.h	2014-03-27 04:42:50 UTC (rev 166344)
+++ trunk/Source/_javascript_Core/ftl/FTLStackMaps.h	2014-03-27 05:05:55 UTC (rev 166345)
@@ -29,6 +29,7 @@
 #if ENABLE(FTL_JIT)
 
 #include "DataView.h"
+#include "FTLDWARFRegister.h"
 #include "GPRInfo.h"
 #include <wtf/HashMap.h>
 
@@ -70,8 +71,8 @@
             ConstantIndex
         };
         
-        uint16_t dwarfRegNum; // Represented as a 12-bit int in the section.
-        int8_t size;
+        DWARFRegister dwarfReg;
+        uint8_t size;
         Kind kind;
         int32_t offset;
         
@@ -82,12 +83,26 @@
         void restoreInto(MacroAssembler&, StackMaps&, char* savedRegisters, GPRReg result) const;
     };
     
+    // FIXME: Investigate how much memory this takes and possibly prune it from the
+    // format we keep around in FTL::JITCode. I suspect that it would be most awesome to
+    // have a CompactStackMaps struct that lossily stores only that subset of StackMaps
+    // and Record that we actually need for OSR exit.
+    // https://bugs.webkit.org/show_bug.cgi?id=130802
+    struct LiveOut {
+        DWARFRegister dwarfReg;
+        uint8_t size;
+        
+        void parse(ParseContext&);
+        void dump(PrintStream& out) const;
+    };
+    
     struct Record {
         uint32_t patchpointID;
         uint32_t instructionOffset;
         uint16_t flags;
         
         Vector<Location> locations;
+        Vector<LiveOut> liveOuts;
         
         bool parse(ParseContext&);
         void dump(PrintStream&) const;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to