Ignore:
Timestamp:
Dec 5, 2007, 6:31:41 PM (17 years ago)
Author:
[email protected]
Message:

JavaScriptCore:

Reviewed by Darin Adler.

Third step in refactoring JSGlobalObject: Moved data members and
functions accessing data members from Interpreter to JSGlobalObject.
Changed Interpreter member functions to static functions.


This resolves a bug in global object bootstrapping, where the global
ExecState could be used when uninitialized.


This is a big change, but it's mostly code motion and renaming.


Layout and JS tests, and testjsglue and testapi, pass. SunSpider reports
a .7% regression, but Shark sees no difference related to this patch,
and SunSpider reported a .7% speedup from an earlier step in this
refactoring, so I think it's fair to call that a wash.

JavaScriptGlue:

Reviewed by Darin Adler.

Third step in refactoring JSGlobalObject: Moved data members and data
member access from Interpreter to JSGlobalObject. Replaced JSInterpreter
subclass with JSGlobalObject subclass.


  • JSRun.cpp: (JSRun::JSRun): (JSRun::Evaluate): (JSRun::CheckSyntax):
  • JSRun.h: (JSGlueGlobalObject::JSGlueGlobalObject):
  • JSUtils.cpp: (KJSValueToCFTypeInternal):
  • JSValueWrapper.cpp: (getThreadGlobalExecState):

WebCore:

Reviewed by Darin Adler.

Third step in refactoring JSGlobalObject: Moved data members and data
member access from Interpreter to JSGlobalObject. Changed Interpreter
member functions to static functions. Same for the subclass,
ScriptInterpreter.


This is a big change, but it's mostly code motion and renaming.

WebKit/mac:

Reviewed by Darin Adler.

Third step in refactoring JSGlobalObject: Moved data members and data
member access from Interpreter to JSGlobalObject.


  • WebView/WebFrame.mm: (-[WebFrame _attachScriptDebugger]):

WebKit/win:

Reviewed by Darin Adler.

Third step in refactoring JSGlobalObject: Moved data members and data
member access from Interpreter to JSGlobalObject.


  • WebFrame.cpp: (WebFrame::globalContext): (WebFrame::attachScriptDebugger): (WebFrame::windowObjectCleared):
  • WebScriptDebugger.cpp: (WebScriptDebugger::WebScriptDebugger):
File:
1 edited

Legend:

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

    r17372 r28468  
    3232
    3333namespace KJS {
    34   struct AttachedInterpreter
     34  struct AttachedGlobalObject
    3535  {
    3636  public:
    37     AttachedInterpreter(Interpreter *i, AttachedInterpreter *ai) : interp(i), next(ai) { ++Debugger::debuggersPresent; }
    38     ~AttachedInterpreter() { --Debugger::debuggersPresent; }
    39     Interpreter *interp;
    40     AttachedInterpreter *next;
     37    AttachedGlobalObject(JSGlobalObject* o, AttachedGlobalObject* ai) : globalObj(o), next(ai) { ++Debugger::debuggersPresent; }
     38    ~AttachedGlobalObject() { --Debugger::debuggersPresent; }
     39    JSGlobalObject* globalObj;
     40    AttachedGlobalObject* next;
    4141  };
    4242
     
    5656}
    5757
    58 void Debugger::attach(Interpreter* interp)
     58void Debugger::attach(JSGlobalObject* globalObject)
    5959{
    60   Debugger *other = interp->debugger();
     60  Debugger* other = globalObject->debugger();
    6161  if (other == this)
    6262    return;
    6363  if (other)
    64     other->detach(interp);
    65   interp->setDebugger(this);
    66   rep->interps = new AttachedInterpreter(interp, rep->interps);
     64    other->detach(globalObject);
     65  globalObject->setDebugger(this);
     66  rep->globalObjects = new AttachedGlobalObject(globalObject, rep->globalObjects);
    6767}
    6868
    69 void Debugger::detach(Interpreter* interp)
     69void Debugger::detach(JSGlobalObject* globalObj)
    7070{
    71   // iterate the addresses where AttachedInterpreter pointers are stored
     71  // iterate the addresses where AttachedGlobalObject pointers are stored
    7272  // so we can unlink items from the list
    73   AttachedInterpreter **p = &rep->interps;
    74   AttachedInterpreter *q;
     73  AttachedGlobalObject **p = &rep->globalObjects;
     74  AttachedGlobalObject *q;
    7575  while ((q = *p)) {
    76     if (!interp || q->interp == interp) {
     76    if (!globalObj || q->globalObj == globalObj) {
    7777      *p = q->next;
    78       q->interp->setDebugger(0);
     78      q->globalObj->setDebugger(0);
    7979      delete q;
    8080    } else
     
    8282  }
    8383
    84   if (interp)
    85     latestExceptions.remove(interp);
     84  if (globalObj)
     85    latestExceptions.remove(globalObj);
    8686  else
    8787    latestExceptions.clear();
     
    9090bool Debugger::hasHandledException(ExecState *exec, JSValue *exception)
    9191{
    92     if (latestExceptions.get(exec->dynamicInterpreter()).get() == exception)
     92    if (latestExceptions.get(exec->dynamicGlobalObject()).get() == exception)
    9393        return true;
    9494
    95     latestExceptions.set(exec->dynamicInterpreter(), exception);
     95    latestExceptions.set(exec->dynamicGlobalObject(), exception);
    9696    return false;
    9797}
Note: See TracChangeset for help on using the changeset viewer.