Changeset 58012 in webkit for trunk/JavaScriptCore/interpreter


Ignore:
Timestamp:
Apr 21, 2010, 1:59:14 PM (15 years ago)
Author:
[email protected]
Message:

Fix for https://bugs.webkit.org/show_bug.cgi?id=37937
Wean JavaScriptCore off calls to isMainThread()

Reviewed by Geoffrey Garen.

JavaScriptCore:

  • Replace use of isMainThread() for interpreter reentry checks with a stored value on the JSGlobalData.
  • Replace use of isMainThread() for useMainThread only check in the collector with a stored exclusive thread.
  • API/JSContextRef.cpp:

(JSContextGroupCreate):
Always default to a small stack type for uses of the JSC API. It is
unlikely that the interpreter reentry required on the web will be as
important for other uses of JavaScriptCore.

Update exports.

  • interpreter/Interpreter.cpp:

(JSC::Interpreter::execute):
(JSC::Interpreter::prepareForRepeatCall):
Use new stored JSGlobalData::maxReentryDepth instead of isMainThread().

  • interpreter/Interpreter.h:

Rename MaxMainThreadReentryDepth to MaxLargeThreadReentryDepth and
MaxSecondaryThreadReentryDepth to MaxSmallThreadReentryDepth.

  • jsc.cpp:

(main): Use the a large stack for jsc since it is always using the
main thread.

  • runtime/ArrayPrototype.cpp:

(JSC::arrayProtoFuncToString):
(JSC::arrayProtoFuncToLocaleString):
(JSC::arrayProtoFuncJoin):
Use new stored JSGlobalData::maxReentryDepth instead of isMainThread().

  • runtime/Collector.cpp:

(JSC::Heap::registerThread):
Use the concept of making JSC run on an exclusiveThread instead of
forcing a mainThreadOnly assertion.

  • runtime/JSGlobalData.cpp:

(JSC::JSGlobalData::JSGlobalData):
(JSC::JSGlobalData::createNonDefault):
(JSC::JSGlobalData::create):
(JSC::JSGlobalData::createLeaked):
(JSC::JSGlobalData::sharedInstance):

  • runtime/JSGlobalData.h:

Add ThreadStackType argument to JSGlobalData constructors and set
maxReentryDepth based on it.

WebCore:

No change in behavior.

  • bindings/js/JSDOMWindowBase.cpp:

(WebCore::JSDOMWindowBase::commonJSGlobalData):
Explicitly set a large stack type for the common JSGlobalData and
set the currently running thread as the exclusive thread for its
execution.

  • bindings/js/WorkerScriptController.cpp:

(WebCore::WorkerScriptController::WorkerScriptController):
Explicitly set a small stack type for the workers JSGlobalData.

Location:
trunk/JavaScriptCore/interpreter
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/interpreter/Interpreter.cpp

    r57955 r58012  
    581581    ASSERT(!scopeChain->globalData->exception);
    582582
    583     if (m_reentryDepth >= MaxSecondaryThreadReentryDepth) {
    584         if (!isMainThread() || m_reentryDepth >= MaxMainThreadReentryDepth) {
     583    if (m_reentryDepth >= MaxSmallThreadReentryDepth) {
     584        if (m_reentryDepth >= callFrame->globalData().maxReentryDepth) {
    585585            *exception = createStackOverflowError(callFrame);
    586586            return jsNull();
     
    642642    ASSERT(!scopeChain->globalData->exception);
    643643
    644     if (m_reentryDepth >= MaxSecondaryThreadReentryDepth) {
    645         if (!isMainThread() || m_reentryDepth >= MaxMainThreadReentryDepth) {
     644    if (m_reentryDepth >= MaxSmallThreadReentryDepth) {
     645        if (m_reentryDepth >= callFrame->globalData().maxReentryDepth) {
    646646            *exception = createStackOverflowError(callFrame);
    647647            return jsNull();
     
    704704    ASSERT(!scopeChain->globalData->exception);
    705705   
    706     if (m_reentryDepth >= MaxSecondaryThreadReentryDepth) {
    707         if (!isMainThread() || m_reentryDepth >= MaxMainThreadReentryDepth) {
     706    if (m_reentryDepth >= MaxSmallThreadReentryDepth) {
     707        if (m_reentryDepth >= callFrame->globalData().maxReentryDepth) {
    708708            *exception = createStackOverflowError(callFrame);
    709709            return CallFrameClosure();
     
    780780    ASSERT(!scopeChain->globalData->exception);
    781781
    782     if (m_reentryDepth >= MaxSecondaryThreadReentryDepth) {
    783         if (!isMainThread() || m_reentryDepth >= MaxMainThreadReentryDepth) {
     782    if (m_reentryDepth >= MaxSmallThreadReentryDepth) {
     783        if (m_reentryDepth >= callFrame->globalData().maxReentryDepth) {
    784784            *exception = createStackOverflowError(callFrame);
    785785            return jsNull();
  • trunk/JavaScriptCore/interpreter/Interpreter.h

    r49409 r58012  
    6565    };
    6666
    67     enum { MaxMainThreadReentryDepth = 256, MaxSecondaryThreadReentryDepth = 32 };
     67    enum { MaxLargeThreadReentryDepth = 256, MaxSmallThreadReentryDepth = 32 };
    6868
    6969    class Interpreter : public FastAllocBase {
Note: See TracChangeset for help on using the changeset viewer.