Ignore:
Timestamp:
Jul 14, 2006, 3:39:58 PM (19 years ago)
Author:
ggaren
Message:

JavaScriptCore:

Reviewed by Maciej.


  • Implemented ref-counting of JSContexts by splitting into two datatypes: JSGlobalContext, which you can create/retain/release, and JSContext, which you can't.


Internally, you retain a JSGlobalContext/ExecState by retaining its
interpreter, which, in the case of a global ExecState, owns it.


  • Also made ~Interpreter() protected to catch places where Interpreter is manually deleted. (Can't make it private because some crazy fool decided it would be a good idea to subclass Interpreter in other frameworks. I pity da fool.)
  • API/APICast.h: (toJS): Added cast for new JSGlobalContext
  • API/JSStringRef.h: Changed vague "you must" language to more specific (but, ultimately, equally vague) "behavior is undefined if you don't" language. (KJS::Interpreter::Interpreter): Factored more common initialization into init()
  • kjs/interpreter.h: (KJS::Interpreter::ref): new (KJS::Interpreter::deref): new (KJS::Interpreter::refCount): new
  • kjs/testkjs.cpp: (doIt): Ref-count the interpreter.

JavaScriptGlue:

Reviewed by Maciej.


  • Updated JSInterpreter to work with Interpreter ref-counting in JavaScriptCore.

(JSInterpreter::JSInterpreter::~JSInterpreter): Now protected to catch
manual delete.

WebCore:

Reviewed by Maciej.

  • Updated ScriptInterpreter to work with Interpreter ref-counting in JavaScriptCore.

(KJS::ScriptInterpreter::~ScriptInterpreter): Now protected to catch
manual delete.

File:
1 edited

Legend:

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

    r15224 r15437  
    208208   
    209209Interpreter::Interpreter(JSObject* globalObject)
    210     : m_timeoutTime(0)
    211     , m_globalExec(this, 0)
     210    : m_globalExec(this, 0)
    212211    , m_globalObject(globalObject)
    213     , m_argumentsPropertyName(&argumentsPropertyName)
    214     , m_specialPrototypePropertyName(&specialPrototypePropertyName)
    215     , m_timeoutChecker(0)
    216     , m_timedOut(false)
    217     , m_startTimeoutCheckCount(0)
    218     , m_pauseTimeoutCheckCount(0)
    219212{
    220213    init();
     
    222215
    223216Interpreter::Interpreter()
    224     : m_timeoutTime(0)
    225     , m_globalExec(this, 0)
     217    : m_globalExec(this, 0)
    226218    , m_globalObject(new JSObject())
    227     , m_argumentsPropertyName(&argumentsPropertyName)
    228     , m_specialPrototypePropertyName(&specialPrototypePropertyName)
    229     , m_timeoutChecker(0)
    230     , m_timedOut(false)
    231     , m_startTimeoutCheckCount(0)
    232     , m_pauseTimeoutCheckCount(0)
    233219{
    234220    init();
     
    239225    JSLock lock;
    240226
     227    m_refCount = 0;
     228    m_timeoutTime = 0;
    241229    m_recursion = 0;
    242230    m_debugger= 0;
    243231    m_context = 0;
     232    m_timedOut = false;
     233    m_timeoutChecker = 0;
     234    m_startTimeoutCheckCount = 0;
     235    m_pauseTimeoutCheckCount = 0;
    244236    m_compatMode = NativeMode;
     237    m_argumentsPropertyName = &argumentsPropertyName;
     238    m_specialPrototypePropertyName = &specialPrototypePropertyName;
    245239
    246240    interpreterMap().set(m_globalObject, this);
Note: See TracChangeset for help on using the changeset viewer.