]> git.saurik.com Git - apple/javascriptcore.git/blobdiff - dfg/DFGGenerationInfo.h
JavaScriptCore-7600.1.4.9.tar.gz
[apple/javascriptcore.git] / dfg / DFGGenerationInfo.h
index 964543c1b75ebacecc96c71ca676da13a983d847..e3330fa3b4567675f48c4007f5852157a38e24ef 100644 (file)
@@ -69,11 +69,12 @@ public:
         m_isConstant = true;
         ASSERT(m_useCount);
     }
-    void initInteger(Node* node, uint32_t useCount, GPRReg gpr)
+    void initGPR(Node* node, uint32_t useCount, GPRReg gpr, DataFormat format)
     {
+        ASSERT(gpr != InvalidGPRReg);
         m_node = node;
         m_useCount = useCount;
-        m_registerFormat = DataFormatInteger;
+        m_registerFormat = format;
         m_spillFormat = DataFormatNone;
         m_canFill = false;
         u.gpr = gpr;
@@ -81,20 +82,28 @@ public:
         m_isConstant = false;
         ASSERT(m_useCount);
     }
+    void initInt32(Node* node, uint32_t useCount, GPRReg gpr)
+    {
+        initGPR(node, useCount, gpr, DataFormatInt32);
+    }
+    void initInt52(Node* node, uint32_t useCount, GPRReg reg, DataFormat format)
+    {
+        ASSERT(format == DataFormatInt52 || format == DataFormatStrictInt52);
+        initGPR(node, useCount, reg, format);
+    }
+    void initInt52(Node* node, uint32_t useCount, GPRReg reg)
+    {
+        initGPR(node, useCount, reg, DataFormatInt52);
+    }
+    void initStrictInt52(Node* node, uint32_t useCount, GPRReg reg)
+    {
+        initGPR(node, useCount, reg, DataFormatStrictInt52);
+    }
 #if USE(JSVALUE64)
     void initJSValue(Node* node, uint32_t useCount, GPRReg gpr, DataFormat format = DataFormatJS)
     {
         ASSERT(format & DataFormatJS);
-
-        m_node = node;
-        m_useCount = useCount;
-        m_registerFormat = format;
-        m_spillFormat = DataFormatNone;
-        m_canFill = false;
-        u.gpr = gpr;
-        m_bornForOSR = false;
-        m_isConstant = false;
-        ASSERT(m_useCount);
+        initGPR(node, useCount, gpr, format);
     }
 #elif USE(JSVALUE32_64)
     void initJSValue(Node* node, uint32_t useCount, GPRReg tagGPR, GPRReg payloadGPR, DataFormat format = DataFormatJS)
@@ -115,27 +124,11 @@ public:
 #endif
     void initCell(Node* node, uint32_t useCount, GPRReg gpr)
     {
-        m_node = node;
-        m_useCount = useCount;
-        m_registerFormat = DataFormatCell;
-        m_spillFormat = DataFormatNone;
-        m_canFill = false;
-        u.gpr = gpr;
-        m_bornForOSR = false;
-        m_isConstant = false;
-        ASSERT(m_useCount);
+        initGPR(node, useCount, gpr, DataFormatCell);
     }
     void initBoolean(Node* node, uint32_t useCount, GPRReg gpr)
     {
-        m_node = node;
-        m_useCount = useCount;
-        m_registerFormat = DataFormatBoolean;
-        m_spillFormat = DataFormatNone;
-        m_canFill = false;
-        u.gpr = gpr;
-        m_bornForOSR = false;
-        m_isConstant = false;
-        ASSERT(m_useCount);
+        initGPR(node, useCount, gpr, DataFormatBoolean);
     }
     void initDouble(Node* node, uint32_t useCount, FPRReg fpr)
     {
@@ -152,15 +145,7 @@ public:
     }
     void initStorage(Node* node, uint32_t useCount, GPRReg gpr)
     {
-        m_node = node;
-        m_useCount = useCount;
-        m_registerFormat = DataFormatStorage;
-        m_spillFormat = DataFormatNone;
-        m_canFill = false;
-        u.gpr = gpr;
-        m_bornForOSR = false;
-        m_isConstant = false;
-        ASSERT(m_useCount);
+        initGPR(node, useCount, gpr, DataFormatStorage);
     }
 
     // Get the node that produced this value.
@@ -215,14 +200,29 @@ public:
     // Get the format of the value as it is spilled in the JSStack (or 'none').
     DataFormat spillFormat() { return m_spillFormat; }
     
+    bool isFormat(DataFormat expectedFormat)
+    {
+        return registerFormat() == expectedFormat || spillFormat() == expectedFormat;
+    }
+    
     bool isJSFormat(DataFormat expectedFormat)
     {
         return JSC::isJSFormat(registerFormat(), expectedFormat) || JSC::isJSFormat(spillFormat(), expectedFormat);
     }
     
-    bool isJSInteger()
+    bool isJSInt32()
+    {
+        return isJSFormat(DataFormatJSInt32);
+    }
+    
+    bool isInt52()
     {
-        return isJSFormat(DataFormatJSInteger);
+        return isFormat(DataFormatInt52);
+    }
+    
+    bool isStrictInt52()
+    {
+        return isFormat(DataFormatStrictInt52);
     }
     
     bool isJSDouble()
@@ -304,6 +304,15 @@ public:
         m_spillFormat = DataFormatNone;
         m_canFill = false;
     }
+    
+    void fillGPR(VariableEventStream& stream, GPRReg gpr, DataFormat format)
+    {
+        ASSERT(gpr != InvalidGPRReg);
+        m_registerFormat = format;
+        u.gpr = gpr;
+        if (m_bornForOSR)
+            appendFill(Fill, stream);
+    }
 
     // Record that this value is filled into machine registers,
     // tracking which registers, and what format the value has.
@@ -311,11 +320,7 @@ public:
     void fillJSValue(VariableEventStream& stream, GPRReg gpr, DataFormat format = DataFormatJS)
     {
         ASSERT(format & DataFormatJS);
-        m_registerFormat = format;
-        u.gpr = gpr;
-        
-        if (m_bornForOSR)
-            appendFill(Fill, stream);
+        fillGPR(stream, gpr, format);
     }
 #elif USE(JSVALUE32_64)
     void fillJSValue(VariableEventStream& stream, GPRReg tagGPR, GPRReg payloadGPR, DataFormat format = DataFormatJS)
@@ -330,28 +335,29 @@ public:
     }
     void fillCell(VariableEventStream& stream, GPRReg gpr)
     {
-        m_registerFormat = DataFormatCell;
-        u.gpr = gpr;
-        
-        if (m_bornForOSR)
-            appendFill(Fill, stream);
+        fillGPR(stream, gpr, DataFormatCell);
     }
 #endif
-    void fillInteger(VariableEventStream& stream, GPRReg gpr)
+    void fillInt32(VariableEventStream& stream, GPRReg gpr)
     {
-        m_registerFormat = DataFormatInteger;
-        u.gpr = gpr;
-        
-        if (m_bornForOSR)
-            appendFill(Fill, stream);
+        fillGPR(stream, gpr, DataFormatInt32);
+    }
+    void fillInt52(VariableEventStream& stream, GPRReg gpr, DataFormat format)
+    {
+        ASSERT(format == DataFormatInt52 || format == DataFormatStrictInt52);
+        fillGPR(stream, gpr, format);
+    }
+    void fillInt52(VariableEventStream& stream, GPRReg gpr)
+    {
+        fillGPR(stream, gpr, DataFormatInt52);
+    }
+    void fillStrictInt52(VariableEventStream& stream, GPRReg gpr)
+    {
+        fillGPR(stream, gpr, DataFormatStrictInt52);
     }
     void fillBoolean(VariableEventStream& stream, GPRReg gpr)
     {
-        m_registerFormat = DataFormatBoolean;
-        u.gpr = gpr;
-        
-        if (m_bornForOSR)
-            appendFill(Fill, stream);
+        fillGPR(stream, gpr, DataFormatBoolean);
     }
     void fillDouble(VariableEventStream& stream, FPRReg fpr)
     {
@@ -364,11 +370,7 @@ public:
     }
     void fillStorage(VariableEventStream& stream, GPRReg gpr)
     {
-        m_registerFormat = DataFormatStorage;
-        u.gpr = gpr;
-        
-        if (m_bornForOSR)
-            appendFill(Fill, stream);
+        fillGPR(stream, gpr, DataFormatStorage);
     }
 
     bool alive()