DFG should be able to set watchpoints on global variables
[WebKit-https.git] / Source / JavaScriptCore / bytecode / DFGExitProfile.h
index edabfab..d751ce6 100644 (file)
@@ -38,7 +38,10 @@ enum ExitKind {
     BadCache, // We exited because an inline cache was wrong.
     Overflow, // We exited because of overflow.
     NegativeZero, // We exited because we encountered negative zero.
+    InadequateCoverage, // We exited because we ended up in code that didn't have profiling coverage.
+    ArgumentsEscaped, // We exited because arguments escaped but we didn't expect them to.
     Uncountable, // We exited for none of the above reasons, and we should not count it. Most uses of this should be viewed as a FIXME.
+    UncountableWatchpoint // We exited because of a watchpoint, which isn't counted because watchpoints do tracking themselves.
 };
 
 inline const char* exitKindToString(ExitKind kind)
@@ -54,6 +57,14 @@ inline const char* exitKindToString(ExitKind kind)
         return "Overflow";
     case NegativeZero:
         return "NegativeZero";
+    case InadequateCoverage:
+        return "InadequateCoverage";
+    case ArgumentsEscaped:
+        return "ArgumentsEscaped";
+    case Uncountable:
+        return "Uncountable";
+    case UncountableWatchpoint:
+        return "UncountableWatchpoint";
     default:
         return "Unknown";
     }
@@ -66,6 +77,7 @@ inline bool exitKindIsCountable(ExitKind kind)
         ASSERT_NOT_REACHED();
     case BadType:
     case Uncountable:
+    case UncountableWatchpoint:
         return false;
     default:
         return true;
@@ -93,6 +105,15 @@ public:
         ASSERT(exitKindIsCountable(kind));
     }
     
+    // Use this constructor if you wish for the exit site to be counted globally within its
+    // code block.
+    explicit FrequentExitSite(ExitKind kind)
+        : m_bytecodeOffset(0)
+        , m_kind(kind)
+    {
+        ASSERT(exitKindIsCountable(kind));
+    }
+    
     bool operator!() const
     {
         return m_kind == ExitKindUnset;
@@ -175,6 +196,11 @@ public:
         return m_frequentExitSites.find(site) != m_frequentExitSites.end();
     }
     
+    bool hasExitSite(ExitKind kind) const
+    {
+        return hasExitSite(FrequentExitSite(kind));
+    }
+    
     bool hasExitSite(unsigned bytecodeIndex, ExitKind kind) const
     {
         return hasExitSite(FrequentExitSite(bytecodeIndex, kind));