Commit e5d3a406 authored by mjs's avatar mjs

Reviewed by: Richard Williamson

	Added explicit lock/unlock methods so Sherlock can grab the
	interpreter lock as needed.

	- partially addressed 3084320 - JavaScriptCore crash

        * kjs/internal.cpp:
        (InterpreterImp::InterpreterImp):
        (InterpreterImp::lock):
        (InterpreterImp::unlock):
        * kjs/internal.h:
        * kjs/interpreter.cpp:
        (Interpreter::lock):
        (Interpreter::unlock):
        * kjs/interpreter.h:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@2935 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 365dd053
2002-12-04 Maciej Stachowiak <mjs@apple.com>
Reviewed by: Richard Williamson
Added explicit lock/unlock methods so Sherlock can grab the
interpreter lock as needed.
- partially addressed 3084320 - JavaScriptCore crash
* kjs/internal.cpp:
(InterpreterImp::InterpreterImp):
(InterpreterImp::lock):
(InterpreterImp::unlock):
* kjs/internal.h:
* kjs/interpreter.cpp:
(Interpreter::lock):
(Interpreter::unlock):
* kjs/interpreter.h:
2002-12-04 Maciej Stachowiak <mjs@apple.com>
Reviewed by: Darin Adler
......
2002-12-04 Maciej Stachowiak <mjs@apple.com>
Reviewed by: Richard Williamson
Added explicit lock/unlock methods so Sherlock can grab the
interpreter lock as needed.
- partially addressed 3084320 - JavaScriptCore crash
* kjs/internal.cpp:
(InterpreterImp::InterpreterImp):
(InterpreterImp::lock):
(InterpreterImp::unlock):
* kjs/internal.h:
* kjs/interpreter.cpp:
(Interpreter::lock):
(Interpreter::unlock):
* kjs/interpreter.h:
2002-12-04 Maciej Stachowiak <mjs@apple.com>
Reviewed by: Darin Adler
......
......@@ -69,7 +69,6 @@ namespace KJS {
const double Inf = *(const double*) Inf_Bytes;
};
#if APPLE_CHANGES
static pthread_once_t interpreterLockOnce = PTHREAD_ONCE_INIT;
static pthread_mutex_t interpreterLock;
......@@ -94,7 +93,6 @@ static inline void unlockInterpreter()
pthread_mutex_unlock(&interpreterLock);
}
#endif
// ------------------------------ UndefinedImp ---------------------------------
......@@ -503,10 +501,8 @@ InterpreterImp::InterpreterImp(Interpreter *interp, const Object &glob)
{
// add this interpreter to the global chain
// as a root set for garbage collection
#if APPLE_CHANGES
lockInterpreter();
m_interpreter = interp;
#endif
if (s_hook) {
prev = s_hook;
next = s_hook->next;
......@@ -517,13 +513,8 @@ InterpreterImp::InterpreterImp(Interpreter *interp, const Object &glob)
s_hook = next = prev = this;
globalInit();
}
#if APPLE_CHANGES
unlockInterpreter();
#endif
#if !APPLE_CHANGES
m_interpreter = interp;
#endif
global = glob;
globExec = new ExecState(m_interpreter,0);
dbg = 0;
......@@ -535,6 +526,16 @@ InterpreterImp::InterpreterImp(Interpreter *interp, const Object &glob)
recursion = 0;
}
void InterpreterImp::lock()
{
lockInterpreter();
}
void InterpreterImp::unlock()
{
unlockInterpreter();
}
void InterpreterImp::initGlobalObject()
{
// Contructor prototype objects (Object.prototype, Array.prototype etc)
......
......@@ -223,6 +223,8 @@ namespace KJS {
Interpreter* interpreter() const { return m_interpreter; }
void initGlobalObject();
static void lock();
static void unlock();
void mark();
......
......@@ -89,6 +89,16 @@ void Interpreter::initGlobalObject()
rep->initGlobalObject();
}
void Interpreter::lock()
{
InterpreterImp::lock();
}
void Interpreter::unlock()
{
InterpreterImp::unlock();
}
ExecState *Interpreter::globalExec()
{
return rep->globalExec();
......
......@@ -145,6 +145,9 @@ namespace KJS {
void initGlobalObject();
static void lock();
static void unlock();
/**
* Returns the execution state object which can be used to execute
* scripts using this interpreter at a the "global" level, i.e. one
......@@ -211,7 +214,6 @@ namespace KJS {
*/
Object builtinArray() const;
/**
* Returns the builtin "Boolean" object.
*/
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment