]> git.saurik.com Git - apple/javascriptcore.git/blobdiff - runtime/StringRecursionChecker.h
JavaScriptCore-1218.35.tar.gz
[apple/javascriptcore.git] / runtime / StringRecursionChecker.h
index 127d028e0f542f29b9a80caa8b711f266b49a582..07dc25ababc5c856afcbddda4e1f3385cf5933c1 100644 (file)
@@ -21,6 +21,8 @@
 #define StringRecursionChecker_h
 
 #include "Interpreter.h"
 #define StringRecursionChecker_h
 
 #include "Interpreter.h"
+#include <wtf/StackStats.h>
+#include <wtf/WTFThreadData.h>
 
 namespace JSC {
 
 
 namespace JSC {
 
@@ -41,14 +43,16 @@ private:
     ExecState* m_exec;
     JSObject* m_thisObject;
     JSValue m_earlyReturnValue;
     ExecState* m_exec;
     JSObject* m_thisObject;
     JSValue m_earlyReturnValue;
+
+    StackStats::CheckPoint stackCheckpoint;
 };
 
 inline JSValue StringRecursionChecker::performCheck()
 {
 };
 
 inline JSValue StringRecursionChecker::performCheck()
 {
-    int size = m_exec->globalData().stringRecursionCheckVisitedObjects.size();
-    if (size >= MaxSmallThreadReentryDepth && size >= m_exec->globalData().maxReentryDepth)
+    const StackBounds& nativeStack = wtfThreadData().stack();
+    if (!nativeStack.isSafeToRecurse())
         return throwStackOverflowError();
         return throwStackOverflowError();
-    bool alreadyVisited = !m_exec->globalData().stringRecursionCheckVisitedObjects.add(m_thisObject).isNewEntry;
+    bool alreadyVisited = !m_exec->vm().stringRecursionCheckVisitedObjects.add(m_thisObject).isNewEntry;
     if (alreadyVisited)
         return emptyString(); // Return empty string to avoid infinite recursion.
     return JSValue(); // Indicate success.
     if (alreadyVisited)
         return emptyString(); // Return empty string to avoid infinite recursion.
     return JSValue(); // Indicate success.
@@ -70,8 +74,8 @@ inline StringRecursionChecker::~StringRecursionChecker()
 {
     if (m_earlyReturnValue)
         return;
 {
     if (m_earlyReturnValue)
         return;
-    ASSERT(m_exec->globalData().stringRecursionCheckVisitedObjects.contains(m_thisObject));
-    m_exec->globalData().stringRecursionCheckVisitedObjects.remove(m_thisObject);
+    ASSERT(m_exec->vm().stringRecursionCheckVisitedObjects.contains(m_thisObject));
+    m_exec->vm().stringRecursionCheckVisitedObjects.remove(m_thisObject);
 }
 
 }
 }
 
 }