diff options
Diffstat (limited to 'Source/JavaScriptCore/runtime')
-rw-r--r-- | Source/JavaScriptCore/runtime/ExceptionHelpers.cpp | 1 | ||||
-rw-r--r-- | Source/JavaScriptCore/runtime/JSGlobalData.cpp | 19 | ||||
-rw-r--r-- | Source/JavaScriptCore/runtime/JSGlobalData.h | 15 | ||||
-rw-r--r-- | Source/JavaScriptCore/runtime/StringRecursionChecker.h | 5 |
4 files changed, 17 insertions, 23 deletions
diff --git a/Source/JavaScriptCore/runtime/ExceptionHelpers.cpp b/Source/JavaScriptCore/runtime/ExceptionHelpers.cpp index 38c525268..a3281b6d6 100644 --- a/Source/JavaScriptCore/runtime/ExceptionHelpers.cpp +++ b/Source/JavaScriptCore/runtime/ExceptionHelpers.cpp @@ -163,6 +163,7 @@ JSObject* throwOutOfMemoryError(ExecState* exec) JSObject* throwStackOverflowError(ExecState* exec) { + Interpreter::ErrorHandlingMode mode(exec); return throwError(exec, createStackOverflowError(exec)); } diff --git a/Source/JavaScriptCore/runtime/JSGlobalData.cpp b/Source/JavaScriptCore/runtime/JSGlobalData.cpp index bc3d00067..5fb682bdb 100644 --- a/Source/JavaScriptCore/runtime/JSGlobalData.cpp +++ b/Source/JavaScriptCore/runtime/JSGlobalData.cpp @@ -130,7 +130,7 @@ static bool enableAssembler(ExecutableAllocator& executableAllocator) } #endif // ENABLE(!ASSEMBLER) -JSGlobalData::JSGlobalData(GlobalDataType globalDataType, ThreadStackType threadStackType, HeapType heapType) +JSGlobalData::JSGlobalData(GlobalDataType globalDataType, HeapType heapType) : #if ENABLE(ASSEMBLER) executableAllocator(*this), @@ -171,7 +171,6 @@ JSGlobalData::JSGlobalData(GlobalDataType globalDataType, ThreadStackType thread #endif , dynamicGlobalObject(0) , cachedUTCOffset(std::numeric_limits<double>::quiet_NaN()) - , maxReentryDepth(threadStackType == ThreadStackTypeSmall ? MaxSmallThreadReentryDepth : MaxLargeThreadReentryDepth) , m_enabledProfiler(0) , m_regExpCache(new RegExpCache(this)) #if ENABLE(REGEXP_TRACING) @@ -198,7 +197,7 @@ JSGlobalData::JSGlobalData(GlobalDataType globalDataType, ThreadStackType thread #endif , m_inDefineOwnProperty(false) { - interpreter = new Interpreter; + interpreter = new Interpreter(*this); // Need to be careful to keep everything consistent here JSLockHolder lock(this); @@ -310,19 +309,19 @@ JSGlobalData::~JSGlobalData() #endif } -PassRefPtr<JSGlobalData> JSGlobalData::createContextGroup(ThreadStackType type, HeapType heapType) +PassRefPtr<JSGlobalData> JSGlobalData::createContextGroup(HeapType heapType) { - return adoptRef(new JSGlobalData(APIContextGroup, type, heapType)); + return adoptRef(new JSGlobalData(APIContextGroup, heapType)); } -PassRefPtr<JSGlobalData> JSGlobalData::create(ThreadStackType type, HeapType heapType) +PassRefPtr<JSGlobalData> JSGlobalData::create(HeapType heapType) { - return adoptRef(new JSGlobalData(Default, type, heapType)); + return adoptRef(new JSGlobalData(Default, heapType)); } -PassRefPtr<JSGlobalData> JSGlobalData::createLeaked(ThreadStackType type, HeapType heapType) +PassRefPtr<JSGlobalData> JSGlobalData::createLeaked(HeapType heapType) { - return create(type, heapType); + return create(heapType); } bool JSGlobalData::sharedInstanceExists() @@ -335,7 +334,7 @@ JSGlobalData& JSGlobalData::sharedInstance() GlobalJSLock globalLock; JSGlobalData*& instance = sharedInstanceInternal(); if (!instance) { - instance = adoptRef(new JSGlobalData(APIShared, ThreadStackTypeSmall, SmallHeap)).leakRef(); + instance = adoptRef(new JSGlobalData(APIShared, SmallHeap)).leakRef(); instance->makeUsableFromMultipleThreads(); } return *instance; diff --git a/Source/JavaScriptCore/runtime/JSGlobalData.h b/Source/JavaScriptCore/runtime/JSGlobalData.h index 6cc0aad8d..e97c0a015 100644 --- a/Source/JavaScriptCore/runtime/JSGlobalData.h +++ b/Source/JavaScriptCore/runtime/JSGlobalData.h @@ -104,11 +104,6 @@ namespace JSC { double increment; }; - enum ThreadStackType { - ThreadStackTypeLarge, - ThreadStackTypeSmall - }; - #if ENABLE(DFG_JIT) class ConservativeRoots; @@ -164,9 +159,9 @@ namespace JSC { static bool sharedInstanceExists(); JS_EXPORT_PRIVATE static JSGlobalData& sharedInstance(); - JS_EXPORT_PRIVATE static PassRefPtr<JSGlobalData> create(ThreadStackType, HeapType = SmallHeap); - JS_EXPORT_PRIVATE static PassRefPtr<JSGlobalData> createLeaked(ThreadStackType, HeapType = SmallHeap); - static PassRefPtr<JSGlobalData> createContextGroup(ThreadStackType, HeapType = SmallHeap); + JS_EXPORT_PRIVATE static PassRefPtr<JSGlobalData> create(HeapType = SmallHeap); + JS_EXPORT_PRIVATE static PassRefPtr<JSGlobalData> createLeaked(HeapType = SmallHeap); + static PassRefPtr<JSGlobalData> createContextGroup(HeapType = SmallHeap); JS_EXPORT_PRIVATE ~JSGlobalData(); void makeUsableFromMultipleThreads() { heap.machineThreads().makeUsableFromMultipleThreads(); } @@ -346,8 +341,6 @@ namespace JSC { String cachedDateString; double cachedDateStringValue; - int maxReentryDepth; - Profiler* m_enabledProfiler; RegExpCache* m_regExpCache; BumpPointerAllocator m_regExpAllocator; @@ -447,7 +440,7 @@ namespace JSC { private: friend class LLIntOffsetsExtractor; - JSGlobalData(GlobalDataType, ThreadStackType, HeapType); + JSGlobalData(GlobalDataType, HeapType); static JSGlobalData*& sharedInstanceInternal(); void createNativeThunk(); #if ENABLE(ASSEMBLER) diff --git a/Source/JavaScriptCore/runtime/StringRecursionChecker.h b/Source/JavaScriptCore/runtime/StringRecursionChecker.h index 831e25b46..a1b4a51fe 100644 --- a/Source/JavaScriptCore/runtime/StringRecursionChecker.h +++ b/Source/JavaScriptCore/runtime/StringRecursionChecker.h @@ -22,6 +22,7 @@ #include "Interpreter.h" #include <wtf/StackStats.h> +#include <wtf/WTFThreadData.h> namespace JSC { @@ -48,8 +49,8 @@ private: 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(); bool alreadyVisited = !m_exec->globalData().stringRecursionCheckVisitedObjects.add(m_thisObject).isNewEntry; if (alreadyVisited) |